Databases Reference
In-Depth Information
T A B L E 13 . 9
Coding of the differences of the DC labels.
0
0
1
1
1
2
3
2
2
3
3
7
···
4
4
···
7
4
15
···
8
8
···
15
5
31
···
16
16
···
31
63
···
32
···
6
32
63
···
···
7
127
64
64
127
8
255
···
128
128
···
255
9
511
···
256
256
···
511
10
1,023
···
512
512
···
1,023
11
2,047
···
1,024
1,024
···
2,047
12
4,095
···
2,048
2,048
···
4,095
13
8,191
···
4,096
4,096
···
8,191
14
16,383
···
8,192
8,192
···
16,383
15
32,767
···
16,384
16,384
···
32,767
16
32,768
From Figure 13.4 , we can see that the basis matrix corresponding to the DC coefficient
is a constant matrix. Thus, the DC coefficient is some multiple of the average value in the
8
×
8 block. The average pixel value in any 8
×
8 block will not differ substantially from the
average value in the neighboring 8
8 block; therefore, the DC coefficient values will be quite
close. Given that the labels are obtained by dividing the coefficients with the corresponding
entry in the quantization table, the labels corresponding to these coefficients will be closer still.
Therefore, it makes sense to encode the differences between neighboring labels rather than to
encode the labels themselves.
Depending on the number of bits used to encode the pixel values, the number of values that
the labels and, hence, the differences can take on may become quite large. A Huffman code
for such a large alphabet would be quite unmanageable. The JPEG recommendation resolves
this problem by partitioning the possible values that the differences can take on into categories.
The size of these categories grows as a power of two. Thus, Category 0 has only one member
(0), Category 1 has two members (
×
2, 2, 3),
and so on. The category numbers are then Huffman coded. The number of codewords in the
Huffman code is equal to the base two logarithm of the number of possible values that the label
differences can take on. If the differences can take on 4,096 possible values, the size of the
Huffman code is log 2 4096
1 and 1), Category 2 has four members (
3,
12. The elements within each category are specified by tacking
on extra bits to the end of the Huffman code for that category. As the categories are different
sizes, we need a differing number of bits to identify the value in each category. For example,
because Category 0 contains only one element, we need no additional bits to specify the value.
Category 1 contains two elements, so we need 1 bit tacked on to the end of the Huffman code
for Category 1 to specify the particular element in that category. Similarly, we need 2 bits to
specify the element in Category 2, 3 bits for Category 3, and n bits for Category n .
=
 
Search WWH ::




Custom Search