# - Acharya T.

ISBN 0-471-48422-9

**Download**(direct link)

**:**

**32**> 33 34 35 36 37 38 .. 100 >> Next

J oJhc if 1 < Q-JPEG < 50

[ 2 - q-J5P0Eq if 50 < Q.JPEG < 100,

subject to the condition that the minimum value of the scaled quantization matrix elements, aQ(u,v) is 1. For the best reconstructed quality, Q.JPEG is set to 100.

After quantization of the DCT coefficients, the quantized DC coefficient is encoded by differential encoding. The DC coefficient DCi of the current block is subtracted by the DC coefficient DCi-\ of the previous block and the difference DIFF — DCi ~ DC{-\ is encoded as shown in Figure 3.5(b). This is done to exploit the spatial correlation between the DC values of the adjacent blocks. Encoding of the AC coefficients is not straightforward. Instead of encoding each AC coefficient in the block, only the significant (nonzero) coefficients are encoded by an efficient manner such that the runs of zeros

BASELINE JPEG COMPRESSION 69

-01

- 07

AC

* /- ?» a 7*

/ / / / / / / <

V / / / / / / }

t / / / / / /

V / / / / / / }

i / / / / / / <

Y / / / / X / >

< JL u JL

-AC

37

70

AC 72

(a)

AC-

DIFF j = DC, - DC i_j (b)

Fig. 3.5 (a) Zig-zag ordering of AC coefficients; (b) differential coding of DC.

preceding a nonzero value are embedded into the encoding. Usually there are few significant low-frequency AC coefficients in the whole 8x8 block and most of the higher-frequency coefficients are quantized to 0’s. In order to exploit this property, the AC coefficients are ordered in a particular irregular order sequence as shown in Figure 3.5(a). This irregular ordering of the AC coefficients is called zig-zag ordering. This is done to keep the low-frequency coefficients together and form long runs of 0’s corresponding to the higher-frequency quantized coefficients. This zig-zag sequence is then broken into runs of zeros ending in a nonzero value. Before we explain the entropy encoding procedure, let us show the results of level shifting, DCT, quantization, and zig-zag ordering with an example 8x8 block extracted from a natural image.

Example: A Sample 8 x 8 Data Block

110 110 118 118 121 126 131 131

108 111 125 122 120 125 134 135

106 119 129 127 125 127 138 144

110 126 130 133 133 131 141 148

115 116 119 120 122 125 137 139

115 106 99 110 107 116 130 127

110 91 82 101 99 104 120 118

103 76 70 95 92 91 107 106

70 JPEG: STILL IMAGE COMPRESSION STANDARD

The 8 x 8 Data Block After Level Shifting

-18 -18 -10 -10 -7 -2 3 3

-20 -17 -3 -6 -8 -3 6 7

-22 -9 1 -1 -3 -1 10 16

-18 -2 2 5 5 3 13 20

-13 -12 -9 -8 -6 -3 9 11

-13 -22 -29 -18 -21 -12 2 -1

-18 -37 -46 -27 29 -24 -8 -10

-25 -52 -58 -33 -36 -37 -21 -22

DCT Coefficients of the Above 8x8 Block

-89.00 -63.47 18.21 -6.85 7.50 13.45 -7.00 0.13

74.14 -2.90 -19.93 -21.04 -17.88 -10.81 8.29 5.26

-63.65 3.10 5.08 14.82 10.12 9.33 1.31 -0.62

3.73 2.85 6.67 8.99 -3.38 1.54 1.04 -0.62

2.50 0.57 -4.46 0.52 3.00 -2.89 -0.32 1.33

7.52 -1.80 -0.63 -0.10 0.41 -3.21 -2.74 -2.07

-3.40 0.43 0.81 0.28 -0.40 -0.19 -0.58 -1.09

-2.26 -0.88 1.73 0.23 -0.21 -0.12 1.23 1.61

Results of DCT Coefficients Quantized by Luminance Quantization Matrix

After the DC coefficient is differentially encoded, the AC coefficients are ordered in the zig-zag sequence and the sequence is subsequently broken into

BASELINE JPEG COMPRESSION 71

a number of runs of zeros ending in a nonzero coefficient. The entropy encoding procedure for differentially encoded DC coefficient is identical to the entropy encoding of the prediction error values that we explained for lossless JPEG. For 8-bit images in baseline JPEG, the DCT coefficients fall in the range [—1023, +1023). Since the DC coefficient is differentially encoded, the differential values of DC fall in the range [—2047, +2047]. Assuming that the DC coefficient of the previous block is —4 as an example, the differential DC value of the present block is —2. From Table 3.2, we find that this belongs to category 2 and hence —2 is described as (2, 01). If the Huffman code of category 2 is 011, then —2 is coded as 01101, where last two bits 01 represent the variable-length integer (VLI) code of —2. There are two Huffman tables (Table K.3 and K.4) for encoding the DC coefficients in Annex K of the baseline JPEG standard for reference. But the user can choose any table and add them as part of the header of the compressed file [1]. Table K.3 is supplied for coding the luminance DC differences as a reference. Table K.4 is supplied for chrominance DC differences.

After zig-zag ordering of the AC coefficients in the example, the resulting sequence is—6 6 —5 020 —1 00000 —1 00 —1 100000000000

0000000000000000000000000000000000 0. This sequence of AC coefficients can be mapped into an intermediate sequence of a combination of two symbols, symboli and symbol- symbol\ is represented by a pair (RUN LENGTH, CATEGORY), where RUN LENGTH is the number of consecutive zeros preceding the nonzero AC coefficient being encoded and CATEGORY is the number of bits to represent the VLI code of this nonzero AC coefficient; symbol is a single piece of information designated (AMPLITUDE) that is encoded by the VLI code of the nonzero AC coefficient. Accordingly, the zig-zag sequence in the example can be compactly represented as:

**32**> 33 34 35 36 37 38 .. 100 >> Next