PackScaleFactors_MP3

Applies noiseless coding to scalefactors and packs output into bitstream buffer.

Syntax

IppStatus ippsPackScaleFactors_MP3_8s1u(const Ipp8s* pSrcScalefactor, Ipp8u** ppBitStream, int* pOffset, IppMP3FrameHeader* pFrameHeader, IppMP3SideInfo* pSideInfo, int* pScfsi, int granule, int channel);

Parameters

pSrcScaleFactor

Pointer to a vector of scalefactors generated during the quantization process for one channel of one granule.

ppBitStream

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

pOffset

Updated bitstream bit pointer. The pOffset 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.

pSideInfo

Pointer to the IppMP3SideInfo structure for the current granule and channel.

pScfsi

Pointer to the scale factor selection information table.

granule

Index of the current granule. 0 stands for granule 1, 1 stands for granule 2.

channel

Index of the current channel. 0 stands for channel 1, 1 stands for channel 2.

Description

The function is declared in the ippac.h file. This function applies noiseless coding to the scalefactors and then packs the output into the bitstream buffer. This function operates on one channel of one granule at a time. Therefore, this function must be called for each channel of each granule.

Length of the scale factor vector pSrcScaleFactor depends on the block mode. Short block granule scale factor vectors contain 36 elements, or 12 elements for each subblock. Long block granule scale factor vectors contain 21 elements.

Thus short block scale factor vectors are indexed as follows: pSrcScaleFactor[sb * 12+sfb], where

Long block scale factor vectors are indexed as follows: pSrcScaleFactor [sfb], where sfb is the scale factor band index (0-20). The associated side information for an individual granule/channel can be used to select the appropriate indexing scheme.

Upon the function entry, the fields id and modeExt of the pFrameHeader must contain, respectively, the algorithm id (MPEG-1 or MPEG-2) and the joint stereo coding commands generated by the psychoacoustic model. All other fields of the pFrameHeader are ignored. Only MPEG‑1 (id = 1) is supported.

Upon function entry, the fields blockType, mixedBlock, and sfCompress of the pSideInfo must contain, respectively, the block type indicator start, short, or stop, filter bank mixed block analysis mode specifier, and scale factor bit allocation. All other pSideInfo fields are ignored by the scale factor encoder.

A scale factor selection information table pScfsi contains the set of binary flags that indicate whether scalefactors are shared across granules of a frame within the predefined scale factor selection groups.

For example, bands 0,1,2,3,4,5 form one group and bands 6,7,8,9,10 form a second group (as defined in ISO/IEC 11172-3). The vector is indexed as follows: pScfsi[ ch][scfsi_band ], where ch is the channel index (0 stands for channel 1, 1 stands for channel 2), and scfsi_band is the scale factor selection group number:

group 0 includes SFBs 0-5, group 1 includes SFBs 6-10, group 2 includes SFBs 11-15, group 3 includes SFBs 16-20.

The resulting bitstream is fully compliant with the syntax specified in ISO/IEC 11172-3.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when at least one of the specified pointers is NULL.

ippStsMP3SideInfoErr

Indicates an error when pFrameHeader->id == IPP_MP3_ID_MPEG1 and pSideInfo->sfCompress exceeds [0..15]; pFrameHeader->id == IPP_MP3_ID_MPEG2 and pSideInfo->sfCompress exceeds [0..511].

ippStsMP3FrameHeaderErr

Indicates an error when pFrameHeader->id == IPP_MP3_ID_MPEG2 and pFrameHeader->modeExt exceeds [0..3].

Submit feedback on this help topic

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