mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Do not hardcode filter order in ff_acelp_lspd2lpc()
Originally committed as revision 20485 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
91cc5d3767
commit
e26d131845
@ -155,20 +155,19 @@ static void lsp2polyf(const double *lsp, double *f, int lp_half_order)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_acelp_lspd2lpc(const double *lsp, float *lpc)
|
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
|
||||||
{
|
{
|
||||||
double pa[6], qa[6];
|
double pa[lp_half_order+1], qa[lp_half_order+1];
|
||||||
int i;
|
float *lpc2 = lpc + (lp_half_order << 1) - 1;
|
||||||
|
|
||||||
lsp2polyf(lsp, pa, 5);
|
lsp2polyf(lsp, pa, lp_half_order);
|
||||||
lsp2polyf(lsp + 1, qa, 5);
|
lsp2polyf(lsp + 1, qa, lp_half_order);
|
||||||
|
|
||||||
for (i=4; i>=0; i--)
|
while (lp_half_order--) {
|
||||||
{
|
double paf = pa[lp_half_order+1] + pa[lp_half_order];
|
||||||
double paf = pa[i+1] + pa[i];
|
double qaf = qa[lp_half_order+1] - qa[lp_half_order];
|
||||||
double qaf = qa[i+1] - qa[i];
|
|
||||||
|
|
||||||
lpc[i ] = 0.5*(paf+qaf);
|
lpc [ lp_half_order] = 0.5*(paf+qaf);
|
||||||
lpc[9-i] = 0.5*(paf-qaf);
|
lpc2[-lp_half_order] = 0.5*(paf-qaf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,10 @@ void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd
|
|||||||
* @param lsp line spectral pairs in cosine domain
|
* @param lsp line spectral pairs in cosine domain
|
||||||
* @param lpc linear predictive coding coefficients
|
* @param lpc linear predictive coding coefficients
|
||||||
*
|
*
|
||||||
|
* @note buffers should have a minimux size of 2*lp_half_order elements.
|
||||||
|
*
|
||||||
* TIA/EIA/IS-733 2.4.3.3.5
|
* TIA/EIA/IS-733 2.4.3.3.5
|
||||||
*/
|
*/
|
||||||
void ff_acelp_lspd2lpc(const double *lsp, float *lpc);
|
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order);
|
||||||
|
|
||||||
#endif /* AVCODEC_LSP_H */
|
#endif /* AVCODEC_LSP_H */
|
||||||
|
@ -578,7 +578,7 @@ static void lspf2lpc(const float *lspf, float *lpc)
|
|||||||
for (i=0; i<10; i++)
|
for (i=0; i<10; i++)
|
||||||
lsp[i] = cos(M_PI * lspf[i]);
|
lsp[i] = cos(M_PI * lspf[i]);
|
||||||
|
|
||||||
ff_acelp_lspd2lpc(lsp, lpc);
|
ff_acelp_lspd2lpc(lsp, lpc, 5);
|
||||||
|
|
||||||
for (i=0; i<10; i++)
|
for (i=0; i<10; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user