porgarmingduod
porgarmingduod

Reputation: 7878

Packet oriented lossless compression library

Does anyone know of a free (non-GPL), decently performing compression library that supports packet oriented compression in C/C++?

With packet oriented, I mean the kind of feature QuickLZ (GPL) has, where multiple packets of a stream can be compressed and decompressed individually while a history is being maintained across packets to achieve sensible compression.

I'd favor compression ratio over CPU usage as long as the CPU usage isn't ridiculous, but I've had a hard time finding this feature at all, so anything is of interest.

Upvotes: 19

Views: 4102

Answers (5)

Roland Pihlakas
Roland Pihlakas

Reputation: 4573

The public domain Crush algorithm by Ilia Muraviev has similar performance and compression ratio as QuickLZ has, Crush being a bit more powerful. The algorithms are conceptually similar too, Crush containing a bit more tricks.
The BALZ algorithm that was already mentioned earlier is also by Ilia Muraviev.
See http://compressme.net/

Upvotes: 1

Bob
Bob

Reputation: 3351

Google's new SPDY protocol uses zlib to compress individual messages, and maintains the zlib state for the life of the connection to achieve better compression. I don't think there's a standalone library that handles this behavior exactly, but there are several open-source implementations of SPDY that could show you how it's done.

Upvotes: 2

Seth
Seth

Reputation: 2667

Google's Snappy may be a good option, if you need speed more than compression and are just looking to save a moderate amount of space.

Alternatively, Ilia Muraviev put a small piece of compression code called BALZ in public domain some time ago. It is quite decent for many kinds of data.

Both of these support stream flushing and independent state variables to do multiple, concurrent streams across packets.

Upvotes: 5

chedi
chedi

Reputation: 308

may be you could use lzma compression SDK, it's written and placed in the public domain by Igor Pavlov.

And since it can compress stream files, and has memory to memory compression I think it's possible to compress packet stream (may be with some changes) but not sure.

Upvotes: 0

pmdj
pmdj

Reputation: 23428

zlib's main deflate() function takes a flush parameter, which allows various different flushing modes. If you pass Z_SYNC_FLUSH at the end of each packet, that should produce the desired effect.

The details are explained in the zLib manual.

bzip2 has flushing functionality as well, which might let you do this kind of thing. See http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzCompress

Upvotes: 9

Related Questions