RM0082
LS_JPEG codec
Doc ID 018672 Rev 1
569/844
Each AC table requires 176 x 12 bit words. Each DC table requires 16 x 12 bit words. All the
AC and DC tables occupy contiguous locations in the JPGCHuffEnc memory.
Each Huffman code is stored as record containing the actual code HCODE (bits [7:0] of
each 12 bit word) and its length HLEN (bits [11:8] of each 12 bit word).
HLEN are the 4 most significant bits of the huffman code. It is the number of bits in the
Huffman code minus 1.
HCODE are the 8 least significant bits of the huffman code. If the huffman code is less than
8 bits long, the bits that are not used must be 0.
Although Huffman codes used in the JPEG algorithm can be up to 16 bits long, when the
code is more than 8 bits long, the most significant bits are always 1. Therefore, it is
unnecessary to specify more than 8 bits for any code, as the most significant bits are
generated internally.
162 Huffman codes are required for the encoding the AC run-length codes and 12 for the
DC coefficients.
The location of the Huffman codes for the 162 run-length codes in an AC table is shown in
Table 489.
JPGCHuffEnc memory map
First address
Last address
Table
0
175
AC Huffman table 0
176
351
AC Huffman table 1
352
367
DC Huffman table 0
368
383
DC Huffman table 1
Table 490.
Location of AC huffman codes in JPGCHuffEnc memory
Address
Value
0-9
Huffman code of run lengths 0/1 to 0/A
10-19
Huffman code of run lengths 1/1 to 1/A
20-29
Huffman code of run lengths 2/1 to 2/A
30-39
Huffman code of run lengths 3/1 to 3/A
40-49
Huffman code of run lengths 4/1 to 4/A
50-59
Huffman code of run lengths 5/1 to 5/A
60-69
Huffman code of run lengths 6/1 to 6/A
70-79
Huffman code of run lengths 7/1 to 7/A
80-89
Huffman code of run lengths 8/1 to 8/A
90-99
Huffman code of run lengths 9/1 to 9/A
100-109
Huffman code of run lengths A/1 to A/A
110-119
Huffman code of run lengths B/1 to B/A
120-129
Huffman code of run lengths C/1 to C/A
130-139
Huffman code of run lengths D/1 to D/A