background image
ISO/IEC 10918-1 : 1993(E)
F.1.1.5
Encoding models for the sequential DCT procedures
The two dimensional array of quantized DCT coefficients is rearranged in a zig-zag sequence order defined in A.3.6. The
zig-zag order coefficients are denoted ZZ (0) through ZZ(63) with:
ZZ(0)
=
Sq
00
,ZZ(1)
=
Sq
01
,ZZ(2)
=
Sq
10,
·
,
·,·
,
ZZ(63)
=
Sq
77
Sq
vu
are defined in Figure A.6.
Two coding procedures are used, one for the DC coefficient ZZ(0) and the other for the AC coefficients ZZ(1)..ZZ(63).
The coefficients are encoded in the order in which they occur in zig-zag sequence order, starting with the DC coefficient.
The coefficients are represented as two's complement integers.
F.1.1.5.1
Encoding model for DC coefficients
The DC coefficients are coded differentially, using a one-dimensional predictor, PRED, which is the quantized DC value
from the most recently coded 8
×
8 block from the same component. The difference, DIFF, is obtained from
DIFF
=
ZZ(0) ­ PRED
At the beginning of the scan and at the beginning of each restart interval, the prediction for the DC coefficient prediction
is initialized to 0. (Recall that the input data have been level shifted to two's complement representation.)
F.1.1.5.2
Encoding model for AC coefficients
Since many coefficients are zero, runs of zeros are identified and coded efficiently. In addition, if the remaining
coefficients in the zig-zag sequence order are all zero, this is coded explicitly as an end-of-block (EOB).
F.1.2
Baseline Huffman encoding procedures
The baseline encoding procedure is for 8-bit sample precision. The encoder may employ up to two DC and two AC
Huffman tables within one scan.
F.1.2.1
Huffman encoding of DC coefficients
F.1.2.1.1
Structure of DC code table
The DC code table consists of a set of Huffman codes (maximum length 16 bits) and appended additional bits (in most
cases) which can code any possible value of DIFF, the difference between the current DC coefficient and the prediction.
The Huffman codes for the difference categories are generated in such a way that no code consists entirely of 1-bits
(X'FF' prefix marker code avoided).
The two's complement difference magnitudes are grouped into 12 categories, SSSS, and a Huffman code is created for
each of the 12 difference magnitude categories (see Table F.1).
For each category, except SSSS
=
0, an additional bits field is appended to the code word to uniquely identify which
difference in that category actually occurred. The number of extra bits is given by SSSS; the extra bits are appended to the
LSB of the preceding Huffman code, most significant bit first. When DIFF is positive, the SSSS low order bits of DIFF
are appended. When DIFF is negative, the SSSS low order bits of (DIFF ­ 1) are appended. Note that the most significant
bit of the appended bit sequence is 0 for negative differences and 1 for positive differences.
F.1.2.1.2
Defining Huffman tables for the DC coefficients
The syntax for specifying the Huffman tables is given in Annex B. The procedure for creating a code table from this
information is described in Annex C. No more than two Huffman tables may be defined for coding of DC coefficients.
Two examples of Huffman tables for coding of DC coefficients are provided in Annex K.
88
CCITT Rec. T.81 (1992 E)
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186]