Mercurial > libavcodec.hg
changeset 10502:f132cde57bbe libavcodec
Do not hardcode filter order in ff_acelp_lspd2lpc()
author | vitor |
---|---|
date | Mon, 09 Nov 2009 12:06:19 +0000 |
parents | bdf4a9ca162a |
children | 8d536f190e6e |
files | lsp.c lsp.h qcelpdec.c |
diffstat | 3 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/lsp.c Mon Nov 09 09:11:35 2009 +0000 +++ b/lsp.c Mon Nov 09 12:06:19 2009 +0000 @@ -155,20 +155,19 @@ } } -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; - - lsp2polyf(lsp, pa, 5); - lsp2polyf(lsp + 1, qa, 5); + double pa[lp_half_order+1], qa[lp_half_order+1]; + float *lpc2 = lpc + (lp_half_order << 1) - 1; - for (i=4; i>=0; i--) - { - double paf = pa[i+1] + pa[i]; - double qaf = qa[i+1] - qa[i]; + lsp2polyf(lsp, pa, lp_half_order); + lsp2polyf(lsp + 1, qa, lp_half_order); - lpc[i ] = 0.5*(paf+qaf); - lpc[9-i] = 0.5*(paf-qaf); + 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 [ lp_half_order] = 0.5*(paf+qaf); + lpc2[-lp_half_order] = 0.5*(paf-qaf); } }
--- a/lsp.h Mon Nov 09 09:11:35 2009 +0000 +++ b/lsp.h Mon Nov 09 12:06:19 2009 +0000 @@ -86,8 +86,10 @@ * @param lsp line spectral pairs in cosine domain * @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 */ -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 */