
26
μSAP705100-B03, μSAP70732-B03 USER'S MANUAL
Figure 1-9. Zigzag Scan and Coding
(6) Entropy encoding
With Baseline DCT version of JPEG, entropy encoding that uses Huffman coding is performed. In entropy
encoding, the absolute values and distribution of the DC and AC components differ.
While the absolute value of an AC component is relatively low, the absolute value of the DC component
tends to be great. This is because the DC component is the average value of a given block. With JPEG,
a difference between the DC component of the current block and the DC component of the preceding block
is calculated for each of the Y, Cb, and Cr components, and this difference is compressed by means of
entropy when the DC component is compressed. For the AC coefficients, the combination of the length
of the zero run and the value of a non-zero coefficient (LEVEL value) is compressed by means of entropy.
The compressed code is called a VLC (Variable Length Code).
In JPEG compression, the DC and AC components are compressed in accordance with different Huffman
encoding conventions. This is referred to as “the DC and AC components using different Huffman tables.”
Moreover, like quantization, because the distribution of values differs between the Y and Cb/Cr compo-
nents, separate Huffman tables are usually used for the Y and Cb/Cr components. Consequently, four
Huffman tables are used for JPEG compression. Information relating to these Huffman tables can be
defined by each JPEG file, and is stored as a DHT segment in the JPEG file header.
For entropy encoding of a certain value, an absolute value of n bits can only contain n bits of information.
In other words, a value whose absolute value is n bits can be expressed using n bits. In signal processing,
values are usually defined as follows:
Positive number consisting of n bits: lower n bits of value
Negative number consisting of n bits: lower n bits of value, with the sign inverted
In JPEG compression, entropy encoding follows the above scheme.
43 -9
0
1
0
0
0
0
-8
-4
0
1
0
0
0
0
0
3
2
0
-1
0
0
0
-1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
(RUN, LEVEL)
(0, -9)
(0, -8)
(1, -4)
(1, 1)
(1, 3)
(0, -1)
(1, 1)
(0, 2)
(0, 1)
(5, 1)
(5, -1)
EOB
VLC
0000 0001 1000 1
0000 0001 1101 1
0000 0011 001
0110
0010 0101 0
111
0110
0100 0
110
0001 110
0001 111
10
0x01, 0x88,
0x0E, 0xC0,
0xCB, 0x12,
0xBB, 0x21,
0x87, 0x0F,
0x80,