EncodeHuffman8X8

Encode data block with bit accumulation

Synopsis

FwStatus   fwiEncodeHuffman8x8_JPEG_16s1u_C1 ( const Fw16s * pSrcFw8u * pDstint dstLenBytesint * pDstCurrPosFw16s * pLastDCconst FwiEncodeHuffmanSpec * pDcTableconst FwiEncodeHuffmanSpec * pAcTableFwiEncodeHuffmanState * pEncHuffStateint bFlushState );

Parameters

bFlushState   Indicates the last 8X8 block in a scan.
dstLenBytes   Destination buffer length in bytes.
pAcTable   Pointer to the Huffman AC coefficient table.
pDcTable   Pointer to the Huffman DC coefficient table.
pDst   Pointer to a location in a destination buffer.
pDstCurrPos   Pointer to the shift value at the current destination buffer in bytes.
pEncHuffState   Pointer to the FwiEncodeHuffmanState structure.
pLastDC   Pointer to the last DC coefficient, which is in the previous 8X8 block.
pSrc   Pointer to a location in a source buffer.

Description

This function performs Huffman baseline encoding of an 8X8 data block of quantized DCT coefficients using the DC and AC encoding tables.

The encoding process follows CCITT Rec. T.81, Annex F.1.2. The function writes only full bytes to the output buffer.

Incomplete bits from data blocks in a stream are accumulated in the Huffman encode state structure.

To place all the accumulated bits into the encoded bitstream, set the pSrc to NULL bFlushState to 1. This should be done after encoding all the 8X8 blocks in the image or at the end of each restart interval.