**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)**