richgel999 / lzham_codec

Lossless data compression codec with LZMA-like ratios but 1.5x-8x faster decompression speed, C/C++
Other
695 stars 71 forks source link

What is the main purpose of zlib interface? #12

Closed AndrewSav closed 9 years ago

AndrewSav commented 9 years ago

Hello, could you please tell me what the purpose if zlib interface in lzham is? I can see two possible reasons:

- So that the code using zlib could switch to lzham easily 
- To allow support zlib binary format (rfc1950)

In my view the first of the two is most practical, as I can't see much advantage from supporting zlib format with a different compression method. Could you please confirm/expand?

The practical reason for this question is that I'm thinking of a .net managed wrapper around lzham and I think that zlib support reason in lzham can affect how the wrapper should function.

richgel999 commented 9 years ago

The zlib interface is there to slightly lower the barrier of entry to adopting LZHAM. It's probably the most used compression API around (zlib being so popular), it's a very well documented API, and there's lots of existing code that uses it. IMO all compression libs that support streaming should support this interface too.

With that being said, the LZHAM codec itself doesn't naively support the zlib API (it's just bolted on top of it). It should be more efficient to just go straight to the lower level LZHAM API's and not bother with the zlib interface if you're writing new code.