
25
CHAPTER 1 OVERVIEW
(5) Quantization and zigzag scan
It is said that the human eye can barely recognize changes in high-frequency components but can easily
recognize the most subtle changes in low-frequency components. To increase the compression ratio,
JPEG compression divides low-frequency components by a small value and high-frequency components
by a greater value. This processing is called quantization. To expand compressed data, the data is
multiplied by the same value by which it was divided (reverse quantization). However, the data cannot
be fully restored by applying quantization and reverse quantization (cannot be reversed). This is because,
when data is quantized, only the quotient resulting from division is used as information, the remainder
being ignored. In this way, the JPEG standard enables an increase in the compression ratio without visibly
degrading the image.
Figure 1-8. Quantized Matrix and Quantization
Data obtained by applying DCT to a block of the original image is notable in that the data of the Y component
differs from that of the Cb/Cr component. Therefore, JPEG uses two types of quantized matrixes for the
Y and Cb/Cr components, respectively (in some cases, only one quantized matrix is used). These
quantized matrixes can be defined independently for each image (JPEG file). Information relating to these
quantized matrixes is stored as a DQT segment in the header of the JPEG file.
As shown by the example in Figure 1-8, if most of the values in the obtained matrix are 0, the information
that “there is a sequence of n zeroes followed by a value that is not zero” is interpreted to increase the
compression rate. The JPEG standard refers to this “sequence of zeroes” as “the length of zero run.”
The non-zero values in the matrix obtained as a result of quantization gather in the upper left part of the
matrix most of the time. For this reason, the length of the zero run is counted by JPEG in the sequence
illustrated below (zigzag scan).
Example of quantized matrix
Example of quantized 8 x 8 matrix
8 16 19 22 26 27 29 34
16 16 22 24 27 29 34 37
19 22 26 27 29 34 34 38
22 22 26 27 29 34 37 40
22 26 27 29 32 35 40 48
26 27 29 32 35 40 48 58
26 27 29 34 38 46 56 69
27 29 35 38 46 56 69 83
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
Q(i j) =