LZ77 Extra Bits in DEFLATE

152 views Asked by At

In the LZ77 phase of the DEFLATE compression, extra bits are used to represent the length and distances of the back reference. However, are these extra bits concatenated onto the base values to form a unique code to be Huffman coded, or is the base value alone Huffman coded with the extra bits tacked on afterwards, i.e. during encoding?

In the first case, the lengths 11 and 12 would be different Huffman tree nodes, with each node representing their respective frequencies. But in the second case, 11 and 12 would be the same Huffman tree nodes and the frequency of said node being the combination of 11 and 12.

In the former case, the extra bits would be added pre-Huffman coding. But in the latter case, extra bits would be added after Huffman coding.

Thanks!

1

There are 1 answers

0
Mark Adler On BEST ANSWER

The base value alone is Huffman coded, with that code followed by the associated number of extra bits representing a value to be added to the base.