2
|
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(float *In, /* (i) vector to filter */
|
|
20 int len, /* (i) length of vector to filter */
|
|
21 float *Out, /* (o) the resulting filtered vector */
|
|
22 float *mem /* (i/o) the filter state */
|
|
23 )
|
|
24 {
|
|
25 int i;
|
|
26 float *pi, *po;
|
|
27
|
|
28 /* all-zero section */
|
|
29
|
|
30 pi = &In[0];
|
|
31 po = &Out[0];
|
|
32 for (i = 0; i < len; i++) {
|
|
33 *po = hpo_zero_coefsTbl[0] * (*pi);
|
|
34 *po += hpo_zero_coefsTbl[1] * mem[0];
|
|
35 *po += hpo_zero_coefsTbl[2] * mem[1];
|
|
36
|
|
37 mem[1] = mem[0];
|
|
38 mem[0] = *pi;
|
|
39 po++;
|
|
40 pi++;
|
|
41
|
|
42 }
|
|
43
|
|
44 /* all-pole section */
|
|
45
|
|
46 po = &Out[0];
|
|
47 for (i = 0; i < len; i++) {
|
|
48 *po -= hpo_pole_coefsTbl[1] * mem[2];
|
|
49 *po -= hpo_pole_coefsTbl[2] * mem[3];
|
|
50
|
|
51 mem[3] = mem[2];
|
|
52 mem[2] = *po;
|
|
53 po++;
|
|
54 }
|
|
55 }
|