4 ms·
Length-Limited Prefix Codes
- nayuki 5y agoIt's good to see that the optimal package-merge algorithm is mentioned. The author linked to a paper, but Wikipedia has a shorter description that I found to be more helpful: https://en.wikipedia.org/wiki/Package-merge_algorithm https://en.wikipedia.org/wiki/Package-merge_algorithm
- Rendello 5y agoI found the article after trying to pick up my DEFLATE project again. I quit 6 months ago after trying endlessly to understand package-merge, so I'm glad this was written in the meantime. I posted some (slightly mistaken) comments at the time: https://news.ycombinator.com/item?id=26220442 https://news.ycombinator.com/item?id=26220442
- dunham 5y agoI went through something similar a year or so ago. I wrote deflate for a little javascript PDF writer. For my first pass, I used the static tables. A little research pointed me at package merge (I think Go used it, and zlib itself was inscrutable). After a couple of evenings, I gave up on it as not worth the effort, since my primary goal was writing PDFs, not implementing zlib. From the article, it sounds like zlib might not even be using package-merge.
- Rendello 5y agoRelatedly, I was looking at Zlib's source today and realized they still use old, 70s-style function declarations: int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; int level; { z_stream stream; int err; const uInt max = (uInt)-1; … https://github.com/madler/zlib/blob/master/compress.c https://github.com/madler/zlib/blob/master/compress.c
- Unbanshee343 5y agoThank you. I will try your methods to increase my knowledge. https://www.publixoasis.us/ https://www.publixoasis.us/