ISO/IEC 10918-1 : 1993(E)
The format for the additional bits is the same as in the coding of the DC coefficients. The value of SSSS gives the number
of additional bits required to specify the sign and precise amplitude of the coefficient. The additional bits are either the
low-order SSSS bits of ZZ(K) when ZZ(K) is positive or the low-order SSSS bits of ZZ(K) 1 when ZZ(K) is negative.
ZZ(K) is the Kth coefficient in the zig-zag sequence of coefficients being coded.
F.1.2.2.2
Defining Huffman tables for the AC 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.
In the baseline system no more than two Huffman tables may be defined for coding of AC coefficients. Two examples of
Huffman tables for coding of AC coefficients are provided in Annex K.
F.1.2.2.3
Huffman encoding procedures for AC coefficients
As defined in Annex C, the Huffman code table is assumed to be available as a pair of tables, EHUFCO (containing the
code bits) and EHUFSI (containing the length of each code in bits), both indexed by the composite value defined above.
The procedure for encoding the AC coefficients in a block is shown in Figures F.2 and F.3. In Figure F.2, K is the index
to the zig-zag scan position and R is the run length of zero coefficients.
The procedure "Append EHUFSI(X'F0') bits of EHUFCO(X'F0')" codes a run of 16 zero coefficients (ZRL code of
Figure F.1). The procedure "Code EHUFSI(0) bits of EHUFCO(0)" codes the end-of-block (EOB code). If the last
coefficient (K
=
63) is not zero, the EOB code is bypassed.
CSIZE is a procedure which maps an AC coefficient to the SSSS value as defined in Table F.2.
F.1.2.3
Byte stuffing
In order to provide code space for marker codes which can be located in the compressed image data without decoding,
byte stuffing is used.
Whenever, in the course of normal encoding, the byte value X'FF' is created in the code string, a X'00' byte is stuffed
into the code string.
If a X'00' byte is detected after a X'FF' byte, the decoder must discard it. If the byte is not zero, a marker has been
detected, and shall be interpreted to the extent needed to complete the decoding of the scan.
Byte alignment of markers is achieved by padding incomplete bytes with 1-bits. If padding with 1-bits creates a X'FF'
value, a zero byte is stuffed before adding the marker.
F.1.3
Extended sequential DCT-based Huffman encoding process for 8-bit sample precision
This process is identical to the Baseline encoding process described in F.1.2, with the exception that the number of sets of
Huffman table destinations which may be used within the same scan is increased to four. Four DC and four AC Huffman
table destinations is the maximum allowed by this Specification.
F.1.4
Extended sequential DCT-based arithmetic encoding process for 8-bit sample precision
This subclause describes the use of arithmetic coding procedures in the sequential DCT-based encoding process.
NOTE The arithmetic coding procedures in this Specification are defined for the maximum precision to encourage
interchangeability.
The arithmetic coding extensions have the same DCT model as the Baseline DCT encoder. Therefore, Annex F.1.1 also
applies to arithmetic coding. As with the Huffman coding technique, the binary arithmetic coding technique is lossless. It
is possible to transcode between the two systems without either FDCT or IDCT computations, and without modification of
the reconstructed image.
The basic principles of adaptive binary arithmetic coding are described in Annex D. Up to four DC and four AC
conditioning table destinations and associated statistics areas may be used within one scan.
The arithmetic encoding procedures for encoding binary decisions, initializing the statistics area, initializing the encoder,
terminating the code string, and adding restart markers are listed in Table D.1 of Annex D.
CCITT Rec. T.81 (1992 E)
91