Quantizes the LSP coefficients.
IppStatus ippsLSPQuant_G729_16s(const Ipp16s* pSrcLSP, Ipp16s* pSrcDstPrevFreq, Ipp16s* pDstQLSP, Ipp16s* pDstQLSPIndex);
IppStatus ippsLSPQuant_G729E_32f (const Ipp32f* pSrcLSP, Ipp32f* pSrcDstPrevFreq, Ipp32f* pDstQLSF, Ipp32f* pDstQLSP, int* pDstQLspIndex);
pSrcLSP |
Pointer to the LSP coefficients vector [10], in Q15 for 16s data. |
pSrcDstPrevFreq |
Pointer to the four previous and updated quantized frequencies vector [40], in Q13 for 16s data. Elements 0 to 9 are for the newest frame and elements 30 to 39 are for the oldest frame. |
pDstQLSF |
Pointer to the LSF coefficients vector [10]. |
pDstQLSP |
Pointer to the LSP coefficients vector [10], in Q15 for 16s data. |
pDstQLSPIndex |
Pointer to the combined codebook indices L0, L1, L2 and L3, of length 2. Its first element represents indices L0 and L1 in the following combination: L1 occupies the first 7 bits starting from LSB, whereas L0 resides in the next 1 bit adjacent to L1. The second element represents indices L2 and L3 in the following combination: L3 occupies the first 5 bits starting from LSB, and L2 resides in the next 5 bits adjacent to L3. |
The functions ippsLSPQuant_G729 are declared in the ippsc.h file. These functions obtain the quantized LSP coefficients and the codebook indices. They perform the following operations:
1. Converts the LSP coefficients gi to LSF coefficients ωi in the normalized frequency domain [0, π] as:
ωi = arccos(gi), i = 1,...,10
2. Uses a switched 4th order MA prediction to predict the LSF coefficients of the current frame. The difference between the computed and predicted coefficients is quantized using a two-stage vector quantizer. The first stage is a 10-dimensional VQ using codebook L1 with 128 entries (7 bits). The second stage is a 10 bit VQ which was implemented as a split VQ using two 5-dimensional codebooks, L2 and L3, containing 32 entries (5 bits) each. To explain the quantization process, it is convenient to first describe the decoding process. Each coefficient is obtained from the sum of two codebooks:
where L1, L 2 and L3 are the codebook indices.
3. The vector to be quantized for the current frame m is obtained from:
for
i = 1,...,10 ,
where pi,k are the coefficients of the switched MA predictor. The first codebook L1 is searched and the entry L1 that minimizes the (unweighted) mean-squared error is selected. This is followed by a search of the second codebook L2, which defines the lower part of the second stage. To avoid sharp resonances in the quantized LP synthesis filter, the partial vector Îi , i = 1,...,5, is rearranged such that adjacent coefficients have a minimum distance of J. The rearrangement procedure is shown below:
for i = 2,..., 10
where J is 0.0012 for the first pass. Using the selected first stage vector L1 and the lower part of the second stage L2, the higher part of the second stage is searched from the codebook L3. Again, the rearrangement procedure is used to guarantee a minimum distance of 0.0012. The resulting vector Îi , i = 1,...,10 , is rearranged to guarantee a minimum distance of 0.0006. The quantized LSF coefficients for the current frame m are obtained from the weighted sum of previous quantizer outputs Îi(m-k), and the current quantizer output Îi(m):
There are two MA predictors. Which MA predictor to use is defined by a single bit L0. It is determined by the one that minimizes the weighted mean-squared error:
The weights wi are made adaptive as a function of the unquantized LSF coefficients,
In addition, the weights w5 and w6 are multiplied by 1.2 each.
4. To avoid sharp resonance in the LP filter, the rearrangement procedure is applied twice to the resulting vector Îi with J = 0.0012 and 0.0006 sequentially.
5. After computing quantized LSF coefficients, the corresponding filter is checked for stability. This is done as follows:
Order the coefficients in increasing value;
6. Convert the quantized LSF vectors to LSP vectors.
The function ippsLSPQuant is actually a combination of ippsLSPToLSF, ippsLSFQuant , and ippsLSFToLSP functions. The following code details the correspondence.
IppStatus ippsLSPQuant_G729_16s(const Ipp16s* pSrcLSP, Ipp16s* pSrcDstPrevFreq, Ipp16s* pDstQLSP, Ipp16s* pDstQLSPIndex) { __ALIGN(8) short lsf[LP_ORDER]; __ALIGN(8) short lsp_q[LP_ORDER]; short q_index[4]; IppStatus sts=ippsLSPToLSF_G729_16s(pSrcLSP, lsf); if (sts != ippStsNoErr) return sts; sts = ippsLSFQuant_G729_16s(lsf, pSrcDstPrevFreq, lsf_q, q_index ); if(sts != ippStsNoErr) return sts; pDstQLSPIndex[0] = (q_index[0]<<G729_NC0_B) | q_index[1]; pDstQLSPIndex[1] = (q_index[2]<<G729_NC1_B) | q_index[3]; ippsLSFToLSP_G729_16s(lsp_q, pDstQLSP) return ippStsNoErr; }
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when one of the specified pointers is NULL. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.