[FFmpeg-devel] [Question] Optimal Huffman Table for MJPEG

Indrani Kundu Saha indranikundusaha
Sat Apr 11 04:03:10 CEST 2009

Suppose after the frame has been encoded, I have the following encoded
symbols for DC Luminance:

14 24 6 29 14 29 62 150

Now, I create a huffman tree out of these symbols and assign codes as follows:
29:00 14:01 6:100 24:011 150:010 62:001

Thus, we have two codes of length 02, and 3 codes of length 03.

Now the Huffman table takes in only the codeword length and the code
word itself.
How do I convert this to a Huffman table representation (i.e. length -

Can I use:
length - Bits - Code
02       00,01 -  01, 02
03       011,010,001 - 03,04,05

I have a bug in my code and I think it might be related to my updating the DHT.

Similar logic applies to DC chrominance and AC luminance/chrominance.


More information about the ffmpeg-devel mailing list