From 1be0fc2909fbcefd800d20cfff1420234fd0715b Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Thu, 4 Sep 2008 11:03:14 +0000 Subject: Avoid duplicating compute_lpc_coefs() function in both the RA288 and AAC decoders. Originally committed as revision 15193 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/lpc.c | 48 ++++++++---------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) (limited to 'libavcodec/lpc.c') diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 253267c5aa..dd145ca875 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -21,45 +21,10 @@ #include "libavutil/lls.h" #include "dsputil.h" -#include "lpc.h" - - -/** - * Levinson-Durbin recursion. - * Produces LPC coefficients from autocorrelation data. - */ -static void compute_lpc_coefs(const double *autoc, int max_order, - double lpc[][MAX_LPC_ORDER], double *ref) -{ - int i, j; - double err = autoc[0]; - double lpc_tmp[MAX_LPC_ORDER]; - - for(i=0; i>1; j++) { - double tmp = lpc_tmp[j]; - lpc_tmp[j] += r * lpc_tmp[i-1-j]; - lpc_tmp[i-1-j] += r * tmp; - } - - if(i & 1) - lpc_tmp[j] += lpc_tmp[j] * r; +#define LPC_USE_DOUBLE +#include "lpc.h" - for(j=0; j<=i; j++) - lpc[i][j] = -lpc_tmp[j]; - } -} /** * Quantize LPC coefficients @@ -106,7 +71,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision, /* output quantized coefficients and level shift */ error=0; for(i=0; iflac_compute_autocorr(samples, blocksize, max_order, autoc); - compute_lpc_coefs(autoc, max_order, lpc, ref); + compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); + + for(i=0; i0; i--) -- cgit v1.2.3