diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-25 16:14:53 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-29 00:05:32 +0200 |
commit | e0980629d8ef1970488eaaaa56a55e198d5549d4 (patch) | |
tree | 7a41acee142c5f518f038a2cd97a8e157ac0dd68 /libavcodec/lsp.c | |
parent | ba07c84bf961e034b8b8f80603358f8ebab6c171 (diff) | |
download | ffmpeg-e0980629d8ef1970488eaaaa56a55e198d5549d4.tar.gz |
avcodec/lsp: Move ff_lsp2polyf() upwards in lsp.c
Will avoid a forward declaration lateron.
Also adapt the function to modern style while at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/lsp.c')
-rw-r--r-- | libavcodec/lsp.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c index 9e7bc5f87a..9536d8078b 100644 --- a/libavcodec/lsp.c +++ b/libavcodec/lsp.c @@ -124,6 +124,22 @@ static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order) } } +#ifndef ff_lsp2polyf +void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) +{ + f[0] = 1.0; + f[1] = -2 * lsp[0]; + lsp -= 2; + for (int i = 2; i <= lp_half_order; i++) { + double val = -2 * lsp[2*i]; + f[i] = val * f[i-1] + 2*f[i-2]; + for (int j = i-1; j > 1; j--) + f[j] += f[j-1] * val + f[j-2]; + f[1] += val; + } +} +#endif /* ff_lsp2polyf */ + void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order) { int i; @@ -191,25 +207,6 @@ void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd ff_acelp_lsp2lpc(lp_2nd, lsp_2nd, lp_order >> 1); } -#ifndef ff_lsp2polyf -void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) -{ - int i, j; - - f[0] = 1.0; - f[1] = -2 * lsp[0]; - lsp -= 2; - for(i=2; i<=lp_half_order; i++) - { - double val = -2 * lsp[2*i]; - f[i] = val * f[i-1] + 2*f[i-2]; - for(j=i-1; j>1; j--) - f[j] += f[j-1] * val + f[j-2]; - f[1] += val; - } -} -#endif /* ff_lsp2polyf */ - void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order) { double pa[MAX_LP_HALF_ORDER+1], qa[MAX_LP_HALF_ORDER+1]; |