0
votes

I am a little confused about the Huffman code. So as I read the books, it states that after the zigzag ordering, it will be the run length encoding and the Huffman for the run length. I have 3 questions: 1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale). I mean like could I just scan the block 8x8 and count the frequency of appearance of characters, then create the codewords. 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image. 3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused. Thank you for helping me out This is the link for the Annex K https://www.w3.org/Graphics/JPEG/itu-t81.pdf

1

1 Answers

0
votes

You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.

1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).

For it to be a JPEG stream, you have to do both.

2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.

Some encoders do that to generate optimum Huffman tables.

3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.

Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.