# - Acharya T.

ISBN 0-471-48422-9

**Download**(direct link)

**:**

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

(0, 3)(â€”6), (0, 3)(6), (0, 3)(â€”5), (1, 2)(2), (1, 1)(-1), (5, 1)(-1), (2, 1)(-1), (0, 1)(1), (0,0).

The first significant (nonzero) AC coefficient in the zig-zag sequence is â€”6. It is represented as (0, 3)(â€”6) because it precedes with no run of zeros (i.e., RUNLENGTH â€” 0) and the AMPLITUDE = â€”6 belongs to CATEGORY = 3. Similarly, the following two nonzero coefficients 6 and â€”5 are represented as (0, 3)(6) and (0, 3)(â€”5) respectively. The next significant coefficient 2 is represented by (1, 2)(2) because it precedes a 0 coefficient (i.e., RUNLENGTH = 1) and AMPLITUDE = 2 belongs to CATEGORY = 2. Similarly, the next significant symbol is represented as (1, 1)( â€”1). The following significant coefficient â€”1 is represented as (5, 1)(â€”1) because it precedes five 0â€™s (i.e., RUNLENGTH = 5) and AMPLITUDE = -1 belongs to CATEGORY = 1. Following the same procedure, the next two nonzero coefficients â€” 1 and 1 are represented by (2, 1)(â€”1) and (0, 1)(1) respectively. There are no other nonzero coefficients in the remainder of the zig-zag sequence. It is represented by a special symbol (0,0) to indicate that the remaining elements in the zig-zag block are all zeros. Each (RUNLENGTH,

72

JPEG: STILL IMAGE COMPRESSION STANDARD

CATEGORY) pair is encoded using a Huffman code and the corresponding AMPLITUDE is encoded by the VLI code.

There are two special symbols in encoding the zig-zag sequence of AC coefficientsâ€”(0,0) and (15, 0). The first special symbol is (0,0), and it is referred to as EOB (end-of-block), to indicate that the remaining elements in the zig-zag block are zeros. The other special symbol is (15, 0) and it is also referred to as ZRL (zero-run-length) to indicate a run of 16 zeros. Maximum length of a run of zeros allowed in baseline JPEG is 16. If there are more than 16 zeros, then the run is broken into the number of runs of zeros of length 16. For example, consider 57 zeros before a nonzero coefficient, say â€” 29. This will be represented by (15, 0) (15, 0) (15, 0), (9, 5)(â€”29). The first three (15, 0) pairs represent 48 zeros and (9, 5)(â€”29) represents 9 zeros followed by the coefficient â€”29 which belongs to the category 5.

The baseline JPEG allows maximum four Huffman tablesâ€”two for encoding AC coefficients and two for encoding DC coefficients. In luminance-chrominance image data, usually two Huffman tables (one for AC and one for DC) are used for encoding luminance data and similarly two for encoding chrominance data. The Huffman tables used during the compression process are stored as header information in the compressed image file in order to uniquely decode the coefficients during the decompression process. There are two Huffman tables (Table K.5 and K.6) for encoding the AC coefficients and two others (Table K.3 and K.4) for encoding the DC coefficients in Annex Ðš of the baseline JPEG standard for reference. The users can choose any table of their choice and store it as part of the header of the compressed file [1]. Tables K.3 and K.5 are recommended for luminance DC differences and AC coefficients. Tables K.4 and K.6 are recommended for corresponding chrominance channels.

Let us now allocate the variable-length codes in the last example. The codewords for (0, 0), (0, 1), (0, 3), (1, 1), (1, 2), (2, 1), and (5, 1) from Table K.5 are 1010, 00, 100, 1100, 11011, 11100, and 1111010 respectively. VLI codes for the nonzero AC coefficients 1, â€”1, 2, â€”5, 6 and â€”6 are 1, 0, 10, 010, 110, and 001 respectively. Codeword for the differential DC value is 01101. The compressed bitstream for the 8x8 block is shown below, and it requires only 52 bits as opposed to 512 bits required by the original 8x8 block of 8-bit pixels,

01101 100001100110100010 11011101100011110100 111000001 1010

where the first five bits, 01101, represent the DC coefficient and the other 47 bits represent the AC coefficients. Hence, we achieved approximately 10:1 compression using baseline JPEG to compress the block as shown above.

3.3.6 Decompression Process in Baseline JPEG

Decompression is the inverse process to decode the compressed bit-stream in order to properly reconstruct the image. The inverse functions in the de-

BASELINE JPEG COMPRESSION 73

compression process are obvious and the corresponding block diagram of the baseline decompression algorithm is shown in Figure 3.3(b). During the decompression process, the system first parses the header of the compressed file in order to retrieve all the relevant informationâ€”image type, number of components, format, quantization matrices, and the Huffman tables that were used to compress the original image, etc. After parsing the header information, the decompression algorithm is applied on the compressed bitstream as shown in Figure 3.3(b). The entropy decoding step in Figure 3.3(b) decodes the bitstream of the compressed data using the Huffman tables that were used during the compression process. The purpose of this step is to regenerate the zig-zag-ordered sequence of the quantized DCT coefficients. This zig-zag sequence is then reordered by the zig-zag reordering step to create the 8x8 block of quantized DCT coefficients. Each DCT coefficient in the quantized block is then dequantized as

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