I'm trying to decode a buffer encoded with Modified Huffman Coding.
Here's the beginning of the buffer: 000111100001111011111010001000011101000011101000011110
From looking at the translation table, it looks like the prefix property required for Modified Huffman isn't guaranteed. According to the table, I see that 00011
signifies 7B
, but 000111
signifies 1W
. In this case, how do I decode the buffer above? Am I reading the table wrong or is there some nuance to the algorithm that I'm missing?
Modified Huffman Coding assumes you start with a run of white pixels, as noted in the translation table in your link. If it doesn't, the code for a run of "0" white pixels is used.
00110101 = 0W
000111 = 1W
and so on...
In your example you start with 1W 000111
then 3B 10
and so on...
As John has pointed out, your translation table is wrong. The correct table can be found here: Correct Modified Huffman Coding Translation Table