diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2009-10-27 23:53:18 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2009-10-27 23:53:18 +0000 |
commit | 504eee37debbf7ce6ec3b79ae8825727258c3fd7 (patch) | |
tree | 094306ce1889f1e9ddf817f67e6d86c681ed6aa4 /libavcodec/acelp_filters.c | |
parent | 2be414c8dee911744268341b5bd94b9e6a96f67c (diff) |
Commit some functions that are used by both SIPR and AMR.
Based on AMR SoC code by Robert Swain and Colin McQuillan.
Originally committed as revision 20392 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/acelp_filters.c')
-rw-r--r-- | libavcodec/acelp_filters.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c index 2db69d595d..9f720a5b96 100644 --- a/libavcodec/acelp_filters.c +++ b/libavcodec/acelp_filters.c @@ -73,6 +73,26 @@ void ff_acelp_interpolate(int16_t* out, const int16_t* in, } } +void ff_acelp_interpolatef(float *out, const float *in, + const float *filter_coeffs, int precision, + int frac_pos, int filter_length, int length) +{ + int n, i; + + for (n = 0; n < length; n++) { + int idx = 0; + float v = 0; + + for (i = 0; i < filter_length;) { + v += in[n + i] * filter_coeffs[idx + frac_pos]; + idx += precision; + i++; + v += in[n - i] * filter_coeffs[idx - frac_pos]; + } + out[n] = v; + } +} + void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2], const int16_t* in, int length) @@ -110,3 +130,16 @@ void ff_acelp_apply_order_2_transfer_function(float *buf, mem[0] = tmp; } } + +void ff_tilt_compensation(float *mem, float tilt, float *samples, int size) +{ + float new_tilt_mem = samples[size - 1]; + int i; + + for (i = size - 1; i > 0; i--) + samples[i] -= tilt * samples[i - 1]; + + samples[0] -= tilt * *mem; + *mem = new_tilt_mem; +} + |