diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2009-11-09 12:06:19 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2009-11-09 12:06:19 +0000 |
commit | e26d1318458e598bbea796508b812917d983cef6 (patch) | |
tree | d2b8f05a95678945a3b760d1b3df8dcd66d2697f /libavcodec/lsp.c | |
parent | 91cc5d37679b112d03c20d053905c3941c0a8992 (diff) | |
download | ffmpeg-e26d1318458e598bbea796508b812917d983cef6.tar.gz |
Do not hardcode filter order in ff_acelp_lspd2lpc()
Originally committed as revision 20485 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lsp.c')
-rw-r--r-- | libavcodec/lsp.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c index 09c9259c70..420921639f 100644 --- a/libavcodec/lsp.c +++ b/libavcodec/lsp.c @@ -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]; - int i; + double pa[lp_half_order+1], qa[lp_half_order+1]; + float *lpc2 = lpc + (lp_half_order << 1) - 1; - lsp2polyf(lsp, pa, 5); - lsp2polyf(lsp + 1, qa, 5); + lsp2polyf(lsp, pa, lp_half_order); + lsp2polyf(lsp + 1, qa, lp_half_order); - for (i=4; i>=0; i--) - { - double paf = pa[i+1] + pa[i]; - double qaf = qa[i+1] - qa[i]; + while (lp_half_order--) { + double paf = pa[lp_half_order+1] + pa[lp_half_order]; + double qaf = qa[lp_half_order+1] - qa[lp_half_order]; - lpc[i ] = 0.5*(paf+qaf); - lpc[9-i] = 0.5*(paf-qaf); + lpc [ lp_half_order] = 0.5*(paf+qaf); + lpc2[-lp_half_order] = 0.5*(paf-qaf); } } |