Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
PivCo-Huffman “merge” operations (fgiesen.wordpress.com)
43 points by luu 41 days ago | hide | past | favorite | 4 comments


This is a good optimization when you can use it, but it is somewhat uncommon to decode a large number of consecutive symbols using the same Huffman code. Actual compression formats switch between multiple codes, as one switches between decoding prediction modes, literals, run lengths, offsets, and etc., and more importantly, you often do not know the code that will be used for the next symbol before you have decoded the previous symbols. That all makes it rather difficult to apply in practice.


It depends on the format. Brotli switches the Huffman codes used based on the previously decoded bytes, but gzip and bzip2 for example use the same Huffman codes for a bigger block of data. But even then, there might be some more details that you'd need to work out, like the decoding of LZ offsets.


I love this kind of thing—going to try and use this in my data structures course.


I was happy to confirm my suspicion that the author is polish and the name is indeed a pun (piwko being a small beer in polish).




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: