You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
FSE needs to encode and decode in reverse directions.
There are multiple conventions possible, this implementation selects to write the compressed bitstream forward, and read backward.
This results in a bitstream format, which is built around the assumption of forward writing, and backward reading.
For simplicity, the Huffman implementation in this repository employs the same bitstream.
Since the compressed bitstream will be read backward, but we still want the decoded symbols to be written forward, it follows that they must be written in the compressed bitstream in reverse order.
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.
FSE needs to encode and decode in reverse directions. There are multiple conventions possible, this implementation selects to write the compressed bitstream forward, and read backward. This results in a bitstream format, which is built around the assumption of forward writing, and backward reading.
For simplicity, the Huffman implementation in this repository employs the same bitstream. Since the compressed bitstream will be read backward, but we still want the decoded symbols to be written forward, it follows that they must be written in the compressed bitstream in reverse order.
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.
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: