Mercurial > libavcodec.hg
comparison acelp_filters.c @ 10057:cfb009484d2d libavcodec
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 )
author | superdump |
---|---|
date | Sat, 15 Aug 2009 11:22:55 +0000 |
parents | 05ea4942df9b |
children | 9f35b262d3f0 |
comparison
equal
deleted
inserted
replaced
10056:646065f63290 | 10057:cfb009484d2d |
---|---|
91 | 91 |
92 hpf_f[1] = hpf_f[0]; | 92 hpf_f[1] = hpf_f[0]; |
93 hpf_f[0] = tmp; | 93 hpf_f[0] = tmp; |
94 } | 94 } |
95 } | 95 } |
96 | |
97 void ff_acelp_apply_order_2_transfer_function(float *buf, | |
98 const float zero_coeffs[2], | |
99 const float pole_coeffs[2], | |
100 float gain, float mem[2], int n) | |
101 { | |
102 int i; | |
103 float tmp; | |
104 | |
105 for (i = 0; i < n; i++) { | |
106 tmp = gain * buf[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1]; | |
107 buf[i] = tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1]; | |
108 | |
109 mem[1] = mem[0]; | |
110 mem[0] = tmp; | |
111 } | |
112 } |