summaryrefslogtreecommitdiff
path: root/libavcodec/acelp_filters.c
diff options
context:
space:
mode:
authorColin McQuillan <m.niloc@googlemail.com>2009-08-15 11:22:55 +0000
committerRobert Swain <robert.swain@gmail.com>2009-08-15 11:22:55 +0000
commitbb937155ec5c035865256a86e3659f9aa83fc5ba (patch)
tree0049cfabf40350573bb03a7789576bb506e3eccf /libavcodec/acelp_filters.c
parent735a38045a67975390af6969c6c957668d364606 (diff)
Add a function that can apply an order 2 rational transfer function in-place.
This function will be used in the upcoming AMR-NB floating point decoder for high-pass filtering. Patch by Colin McQuillan ( m.niloc googlemail com ) Originally committed as revision 19649 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/acelp_filters.c')
-rw-r--r--libavcodec/acelp_filters.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c
index b31f301fba..2db69d595d 100644
--- a/libavcodec/acelp_filters.c
+++ b/libavcodec/acelp_filters.c
@@ -93,3 +93,20 @@ void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
hpf_f[0] = tmp;
}
}
+
+void ff_acelp_apply_order_2_transfer_function(float *buf,
+ const float zero_coeffs[2],
+ const float pole_coeffs[2],
+ float gain, float mem[2], int n)
+{
+ int i;
+ float tmp;
+
+ for (i = 0; i < n; i++) {
+ tmp = gain * buf[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1];
+ buf[i] = tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1];
+
+ mem[1] = mem[0];
+ mem[0] = tmp;
+ }
+}