Deflate algorithm - deflate stream format - documentation beyond RFC1951
-
07-07-2019 - |
Question
I'm interested on documentation of the deflate stream format or deflate algorithm which goes beyond RFC1951. Sample streams, implementation hints whatever may be interesting.
Solution
I worked on a streaming implementation of deflate once and found this description helpful:
http://www.zlib.net/feldspar.html
At first I tried the zlib source, but it is not an easy read.
OTHER TIPS
You could just use zlib rather than rolling your own?
To support pre-compressed preambles, you could:
Use the raw API (those using z_streamp
as a parameter) rather than the higher level wrappers.
Initialise the compressed preamble with it's own z_streamp
and place the output in a buffer.
Then for all subsequent uses of the preamble, copy the preamble output buffer to the output, and copy the preamble's z_streamp
and use that copy for compressing the subsequent bytes.