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