Transforms independent left and right channel spectral coefficient vectors into combined mid/side and/or intensity mode coefficient vectors suitable for quantization.
IppStatus ippsJointStereoEncode_MP3_32s_I(Ipp32s* pSrcDstXrL, Ipp32s* pSrcDstXrR, Ipp8s* pDstScaleFactorR, IppMP3FrameHeader* pFrameHeader, IppMP3SideInfo* pSideInfo, int* pIsSfbBound);
pSrcDstXrL |
Pointer to the 576-element spectral coefficient output vector generated by the analysis filterbank for the left channel of input audio. All coefficients are represented using the Q5.26 format. |
pSrcDstXrR |
Pointer to the 576-element spectral coefficient output vector generated by the analysis filterbank for the right channel of input audio. All coefficients are represented using the Q5.26 format. |
pFrameHeader |
Pointer to the IppMP3FrameHeader structure that contains the header information associated with the current frame. |
pSideInfo |
Pointer to the pair of IppMP3SideInfo structures associated with the channel pair to be jointly encoded. The number of elements in the set is 2, and ordering of the set elements is as follows: pSideInfo[0] describes channel 1, and pSideInfo[1] describes channel 2. |
pIsSfbBound |
Pointer to the list of intensity coding SFB lower bounds for both channels of the current granule above which all L/R channel spectral coefficients are combined into an intensity-coded representation. |
pDstScaleFactorR |
Pointer to the vector of scalefactors associated with one granule of the right/S channel. |
The function is declared in the ippac.h file. This function transforms the independent left and right channel spectral coefficient vectors into combined mid/side (MS) and/or intensity (IS) mode coefficient vectors suitable for quantization.
Upon function entry, the IppMP3FrameHeader structure fields samplingFreq, id, mode, and modeExt must contain, respectively, the sample rate associated with the current input audio, the algorithm id (MPEG-1 or MPEG-2), and the joint stereo coding commands generated by the psychoacoustic model. All other pFrameHeader fields are ignored. Only MPEG-1 (id = 1) is supported.
Upon the function entry, the blockType side information fields of the structure IppMP3SideInfo for both channels must reflect the analysis modes (short or long block) selected by the psychoacoustic model on each channel. All other fields in the pSideInfo[0] and pSideInfo [1] structures are ignored.
The number of elements of the pIsSfbBound depends on the block type associated with the current granule. For short blocks, the SFB bounds are represented in the following order: pIsSfbBound[0] describes block 1, pIsSfbBound[1] describes block 2, and pIsSfbBound[2] describes block 3. For long blocks, only a single SFB lower bound decision is required and is represented in pIsSfbBound[0]. If both MS and intensity coding are enabled, the SFB intensity coding lower bound simultaneously represents the upper bound SFB for MS coding. If only MS coding is enabled, the SFB bound represents the lowest non-MS SFB.
If intensity coding has been enabled by the psychoacoustic model above a certain SFB lower bound, as indicated by the frame header and the vector pointed to by pIsSfbBound, the function StereoEncode_MP3_32s_I updates with the appropriate scalefactors those elements of pDstScaleFactorR[] that are associated with intensity coded scale factor bands. Other SFB entries in the scale factor vector remain unmodified. The length of the vector referenced by pDstScaleFactorR varies as a function of block size. The vector contains 21 elements for long block granules, or 36 elements for short block granules
If MS coding is enabled (pFrameHeader -> modeExt & 0x10 == 1), the left and right channels are converted to Mid and Side channels as follows:
This function is called on dual granule basis. You must call it for every granule/2 channels.
If intensity coding is enabled (pFrameHeader -> modeExt & 0x01 = 1), the left channel carries the intensity data for SFBs above the SFB intensity lower bound and the right channel above the SFB lower bound is cleared. All coefficients are set to 0.
L = L+ R, R = 0
In order to facilitate energy-proportional recovery of the left and right spectral coefficients at the decoder, an intensity energy scale factor, is_pos, is transmitted in place of the right channel scale factor since the right channel spectral coefficients above the SFB bound are eliminated. The energy normalization constant is derived from the L/R SFB energy ratios and then transformed to improve its quantization properties. That is,
where L_energy and R_energy are, respectively, the SFB energies associated with the spectral coefficients of the left and right channels. At the decoder, the is_pos scale factor is used to apportion jointly coded signal energy between the left and right channels in a manner consistent with the distribution of signal energy prior to joint coding. The is_pos intensity scalefactors are returned in the vector pDstScalefactorR.
On each granule, joint stereo coding is applied once per channel pair (576 samples per granule on each channel). The function JointStereoEncode_MP3_32s_I must therefore be called once per granule, or twice per frame.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when at least one of the pointers pSrcDstXrL, pSrcDstXrR, pDstScaleFactorR, pFrameHeader, pSideInfo, or pIsSfbBound is NULL. |
ippStsMP3SideInfoErr |
Indicates an error if pSideInfo[0].blockType!= pSideInfo[1].blockType when IS or MS is used. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.