diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-25 16:22:21 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-29 00:05:32 +0200 |
commit | c35a6709d077c3221f50235446c88d7c96234d5b (patch) | |
tree | bbd029dbd310f515de1189fa136ba344fcc45331 /libavcodec/lsp.c | |
parent | e0980629d8ef1970488eaaaa56a55e198d5549d4 (diff) | |
download | ffmpeg-c35a6709d077c3221f50235446c88d7c96234d5b.tar.gz |
avcodec/lsp: Make ff_lsp2polyf() static
Possible since 48ac225db2563fe534b1d9e999bf8e70d5a577f8.
Furthermore, the current code would not work on mips
in case ff_lsp2polyf() were used outside of lsp.c,
because it is not compiled on mips since commit
3827a86eacd04d9d7b356f769be553f7b8cca361 at all;
instead it is overridden with a static av_always_inline
function which only works for the callers in lsp.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/lsp.c')
-rw-r--r-- | libavcodec/lsp.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c index 9536d8078b..275984097d 100644 --- a/libavcodec/lsp.c +++ b/libavcodec/lsp.c @@ -124,8 +124,18 @@ 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) +#ifndef lsp2polyf +/** + * Compute the Pa / (1 + z(-1)) or Qa / (1 - z(-1)) coefficients + * needed for LSP to LPC conversion. + * We only need to calculate the 6 first elements of the polynomial. + * + * @param lsp line spectral pairs in cosine domain + * @param[out] f polynomial input/output as a vector + * + * TIA/EIA/IS-733 2.4.3.3.5-1/2 + */ +static void lsp2polyf(const double *lsp, double *f, int lp_half_order) { f[0] = 1.0; f[1] = -2 * lsp[0]; @@ -138,7 +148,7 @@ void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) f[1] += val; } } -#endif /* ff_lsp2polyf */ +#endif /* lsp2polyf */ void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order) { @@ -172,8 +182,8 @@ void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) qa[-1] = 0.0; - ff_lsp2polyf(lsp , pa, lp_half_order ); - ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); + lsp2polyf(lsp , pa, lp_half_order ); + lsp2polyf(lsp + 1, qa, lp_half_order - 1); for (i = 1, j = lp_order - 1; i < lp_half_order; i++, j--) { double paf = pa[i] * (1 + lsp[lp_order - 1]); @@ -214,8 +224,8 @@ void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order) av_assert2(lp_half_order <= MAX_LP_HALF_ORDER); - ff_lsp2polyf(lsp, pa, lp_half_order); - ff_lsp2polyf(lsp + 1, qa, lp_half_order); + lsp2polyf(lsp, pa, lp_half_order); + lsp2polyf(lsp + 1, qa, lp_half_order); while (lp_half_order--) { double paf = pa[lp_half_order+1] + pa[lp_half_order]; |