Optimize the huffman coding of the jpegs