-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why Huffman code in reverse order? #110
Comments
FSE needs to encode and decode in reverse directions. For simplicity, the Huffman implementation in this repository employs the same bitstream. Obviously, other conventions could have been used. And it's also possible to read + write huffman forward, which is probably easier to follow. This would "just" require another bitstream implementation. |
Thank you for your reply!Your answer made me suddenly understand. |
This is essentially the same limitation of ANS - in order to work with fractional bits per encoded byte, you end up treating the data like a stack. You push things on at the writer, and pop them off at the reader. Last in, first out. From the tutorials I've seen, some ANS implementations chose to reverse a block of data as step 1 and then process it so the reader is simpler. |
I'm very interested in compression.Huffman coding can be performed sequentially,I can't understand why huffman code is executed in reverse order in the code.
The text was updated successfully, but these errors were encountered: