X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Facelp_filters.c;h=94ec94792f408f50f9153fe3679d1e28f9c3733a;hb=87a9173679118beef867c7e9626868b4a3dfc837;hp=581da306f342adb9662bbcd39dc99502dc8a6f70;hpb=2ad0d96a24879b96153a3fbbc1707372baa2615e;p=ffmpeg diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c index 581da306f34..94ec94792f4 100644 --- a/libavcodec/acelp_filters.c +++ b/libavcodec/acelp_filters.c @@ -81,65 +81,6 @@ void ff_acelp_interpolate( } } -void ff_acelp_convolve_circ( - int16_t* fc_out, - const int16_t* fc_in, - const int16_t* filter, - int len) -{ - int i, k; - - memset(fc_out, 0, len * sizeof(int16_t)); - - /* Since there are few pulses over an entire subframe (i.e. almost - all fc_in[i] are zero) it is faster to loop over fc_in first. */ - for(i=0; i> 15; - - for(k=i; k> 15; - } - } -} - -int ff_acelp_lp_synthesis_filter( - int16_t *out, - const int16_t* filter_coeffs, - const int16_t* in, - int buffer_length, - int filter_length, - int stop_on_overflow, - int rounder) -{ - int i,n; - - // These two lines are to avoid a -1 subtraction in the main loop - filter_length++; - filter_coeffs--; - - for(n=0; n> 12) + in[n]; - - if(sum + 0x8000 > 0xFFFFU) - { - if(stop_on_overflow) - return 1; - sum = (sum >> 31) ^ 32767; - } - out[n] = sum; - } - - return 0; -} void ff_acelp_high_pass_filter( int16_t* out, @@ -152,11 +93,13 @@ void ff_acelp_high_pass_filter( for(i=0; i>13; /* (14.13) = (13.13) * (1.13) */ - tmp += (hpf_f[1]* -7667LL)>>13; /* (13.13) = (13.13) * (0.13) */ - tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]); /* (14.13) = (0.13) * (14.0) */ + tmp = (hpf_f[0]* 15836LL)>>13; + tmp += (hpf_f[1]* -7667LL)>>13; + tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]); - out[i] = av_clip_int16((tmp + 0x800) >> 12); /* (15.0) = 2 * (13.13) = (14.13) */ + /* With "+0x800" rounding, clipping is needed + for ALGTHM and SPEECH tests. */ + out[i] = av_clip_int16((tmp + 0x800) >> 12); hpf_f[1] = hpf_f[0]; hpf_f[0] = tmp;