starting encode with Huffman trees