background image
ISO/IEC 10918-1 : 1993(E)
TISO1460-93/d084
Decode_ZZ(K)
ZZ(K) = RECEIVE(SSSS)
ZZ(K) = EXTEND(ZZ(K),SSSS)
Done
Figure F.14 ­ Decoding a non-zero AC coefficient
Figure F.14 [D84] = 7 cm = 273 %
The decoding of the amplitude and sign of the non-zero coefficient is done in the procedure "Decode_ZZ(K)", shown in
Figure F.14.
DECODE is a procedure which returns the value, RS, associated with the next Huffman code in the code stream
(see F.2.2.3). The values SSSS and R are derived from RS. The value of SSSS is the four low order bits of the composite
value and R contains the value of RRRR (the four high order bits of the composite value). The interpretation of these
values is described in F.1.2.2. EXTEND is shown in Figure F.12.
F.2.2.3
The DECODE procedure
The DECODE procedure decodes an 8-bit value which, for the DC coefficient, determines the difference magnitude
category. For the AC coefficient this 8-bit value determines the zero run length and non-zero coefficient category.
Three tables, HUFFVAL, HUFFCODE, and HUFFSIZE, have been defined in Annex C. This particular implementation
of DECODE makes use of the ordering of the Huffman codes in HUFFCODE according to both value and code size.
Many other implementations of DECODE are possible.
NOTE ­ The values in HUFFVAL are assigned to each code in HUFFCODE and HUFFSIZE in sequence. There are no
ordering requirements for the values in HUFFVAL which have assigned codes of the same length.
The implementation of DECODE described in this subclause uses three tables, MINCODE, MAXCODE and VALPTR,
to decode a pointer to the HUFFVAL table. MINCODE, MAXCODE and VALPTR each have 16 entries, one for each
possible code size. MINCODE(I) contains the smallest code value for a given length I, MAXCODE(I) contains the largest
code value for a given length I, and VALPTR(I) contains the index to the start of the list of values in HUFFVAL which
are decoded by code words of length I. The values in MINCODE and MAXCODE are signed 16-bit integers; therefore, a
value of ­1 sets all of the bits.
The procedure for generating these tables is shown in Figure F.15. The procedure for DECODE is shown in Figure F.16.
Note that the 8-bit "VALUE" is returned to the procedure which invokes DECODE.
CCITT Rec. T.81 (1992 E)
107
[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]