Modified huffman encoder.