ISO/IEC 10918-1 : 1993(E)
ZZ(K) = RECEIVE(SSSS)
ZZ(K) = EXTEND(ZZ(K),SSSS)
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
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.
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)