X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flpc.c;h=49e41d8c3447e11f3df320dc24a87e2d5c8f93ec;hb=4fab6627697100ccc3135a13f4d0eb483cbe3227;hp=a8971d3c84726ff0886acd51f9395433eae60658;hpb=81fc8a63c5eed8b151d3035ef6422663ca4cfce4;p=ffmpeg diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index a8971d3c847..49e41d8c344 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -1,6 +1,6 @@ /** * LPC utility code - * Copyright (c) 2006 Justin Ruggles + * Copyright (c) 2006 Justin Ruggles * * This file is part of FFmpeg. * @@ -21,48 +21,71 @@ #include "libavutil/lls.h" #include "dsputil.h" + +#define LPC_USE_DOUBLE #include "lpc.h" /** - * Levinson-Durbin recursion. - * Produces LPC coefficients from autocorrelation data. + * Apply Welch window function to audio block */ -static void compute_lpc_coefs(const double *autoc, int max_order, - double lpc[][MAX_LPC_ORDER], double *ref) +static void apply_welch_window(const int32_t *data, int len, double *w_data) { - int i, j, i2; - double r, err, tmp; - double lpc_tmp[MAX_LPC_ORDER]; - - for(i=0; i> 1); - lpc_tmp[i] = r; - for(j=0; j> 1); + c = 2.0 / (len - 1.0); + + w_data+=n2; + data+=n2; + for(i=0; i= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER); + assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && use_lpc > 0); if(use_lpc == 1){ - s->flac_compute_autocorr(samples, blocksize, max_order, autoc); + s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); + + compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); - compute_lpc_coefs(autoc, max_order, lpc, ref); + for(i=0; i0; i--)