Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | |
| 2 | /****************************************************************** |
| 3 | |
| 4 | iLBC Speech Coder ANSI-C Source Code |
| 5 | |
| 6 | hpOutput.c |
| 7 | |
| 8 | Copyright (C) The Internet Society (2004). |
| 9 | All Rights Reserved. |
| 10 | |
| 11 | ******************************************************************/ |
| 12 | |
| 13 | #include "constants.h" |
| 14 | |
| 15 | /*----------------------------------------------------------------* |
| 16 | * Output high-pass filter |
| 17 | *---------------------------------------------------------------*/ |
| 18 | |
| 19 | void hpOutput( |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | float *In, /* (i) vector to filter */ |
| 26 | int len,/* (i) length of vector to filter */ |
| 27 | float *Out, /* (o) the resulting filtered vector */ |
| 28 | float *mem /* (i/o) the filter state */ |
| 29 | ){ |
| 30 | int i; |
| 31 | float *pi, *po; |
| 32 | |
| 33 | /* all-zero section*/ |
| 34 | |
| 35 | pi = &In[0]; |
| 36 | po = &Out[0]; |
| 37 | for (i=0; i<len; i++) { |
| 38 | *po = hpo_zero_coefsTbl[0] * (*pi); |
| 39 | *po += hpo_zero_coefsTbl[1] * mem[0]; |
| 40 | *po += hpo_zero_coefsTbl[2] * mem[1]; |
| 41 | |
| 42 | mem[1] = mem[0]; |
| 43 | mem[0] = *pi; |
| 44 | po++; |
| 45 | pi++; |
| 46 | |
| 47 | } |
| 48 | |
| 49 | /* all-pole section*/ |
| 50 | |
| 51 | po = &Out[0]; |
| 52 | for (i=0; i<len; i++) { |
| 53 | *po -= hpo_pole_coefsTbl[1] * mem[2]; |
| 54 | *po -= hpo_pole_coefsTbl[2] * mem[3]; |
| 55 | |
| 56 | mem[3] = mem[2]; |
| 57 | mem[2] = *po; |
| 58 | po++; |
| 59 | } |
| 60 | } |
| 61 | |