HuffmanEncode_MP3

Applies lossless Huffman encoding to quantized samples and packs output into bitstream buffer.

Syntax

IppStatus ippsHuffmanEncode_MP3_32s1u(Ipp32s* pSrcIx, Ipp8u** ppBitStream, int* pOffset, IppMP3FrameHeader* pFrameHeader, IppMP3SideInfo* pSideInfo, int count1Len, int hufSize);

Parameters

pSrcIx

Pointer to the quantized samples of a granule. The buffer length is 576. Depending on which type of joint coding has been applied, if any, the coefficient vector might be associated with either the L, R, M, S, and/or intensity channel of the quantized spectral data.

ppBitStream

Updated double pointer to the bitstream byte. It points to the first available bitstream buffer byte immediately following the bits generated by the spectral coefficient Huffman encoder and sequentially written into the stream buffer. The Huffman symbol bits are formatted according to the bitstream syntax given in ISO/IEC 11172-3.

pOffset

Updated bitstream bit pointer. This parameter indexes the next available bit in the next available byte referenced by the updated bitstream buffer byte pointer ppBitStream. This parameter is valid within the range of 0 to 7, where 0 corresponds to the most significant bit and 7 corresponds to the least significant bit.

pFrameHeader

Pointer to the IppMP3FrameHeader structure for this frame. The Huffman encoder uses the frame header id field in connection with the side information (as described below) to compute the Huffman table region boundaries for the big value spectral region. The Huffman encoder ignores all other frame header fields.Only MPEG‑1 (id = 1) is supported.

pSideInfo

Pointer to the IppMP3SideInfo structure for the current granule and channel. The structure elements bigVals, pTableSelect[0]-[2], reg0Cnt, and reg1Cnt are used to control coding of spectral coefficients in the big value region. The structure element cnt1TabSel is used to select the appropriate Huffman table for the (-1,0,+1)-valued 4-tuples in the count1 region. For detailed descriptions of all side information elements, see the structure definition header file.

count1Len

The count1 region length specifier. Indicates the number of spectral samples for the current granule/channel above the big value region that can be combined into 4-tuples in which all elements are of magnitude less than or equal to 1.

hufSize

Huffman coding bit allocation specifier. Indicates the total number of bits that are required to represent the Huffman-encoded quantized spectral coefficients for the current granule/channel in both the bigValsand count1 regions.

When necessary, this bit count must be augmented to include the number of bits required to manage the bit reservoir. For frames in which the reservoir has reached maximum capacity, the surplus bits are expended by padding with additional bits the Huffman representation of the spectral samples.

The pDstHufSize result returned by the function Quantize_MP3_32s_I reflects these padding requirements. That is, pDstHufSize[i] is equal to the total of the number of bits required for Huffman symbols and the number of padding bits.

Description

The function is declared in the ippac.h file. This function applies lossless Huffman encoding to the quantized samples and packs the output into the bitstream buffer.

The function encodes one granule at a time, and therefore must be called once for each granule of each channel.

The resulting bitstream is fully compliant with ISO/IEC 11172-3.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsBadArgErr

Indicates an error when pOffset exceeds [0,7].

ippStsMP3SideInfoErr

Indicates an error when pSideInfo->bigVals*2> IPP_MP3_GRANULE_LEN (pSideInfo->reg0Cnt + pSideInfo-> reg1Cnt + 2) >= 23, pSideInfo->cnt1TabSel exceeds [0,1], pSideInfo->pTableSelect [i] exceeds [0..31].

ippStsMP3FrameHeader

Indicates an error when pFrameHeader->id != IPP_MP3_ID_MPEG1 pFrameHeader->layer != 1 pFrameHeader->samplingFreq exceeds [0..2].

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.