Asterisk - The Open Source Telephony Project GIT-master-7921072
hpInput.c
Go to the documentation of this file.
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(
24 float *In, /* (i) vector to filter */
25 int len, /* (i) length of vector to filter */
26 float *Out, /* (o) the resulting filtered vector */
27 float *mem /* (i/o) the filter state */
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 }
float hpi_pole_coefsTbl[3]
Definition: constants.c:77
float hpi_zero_coefsTbl[3]
Definition: constants.c:74
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void hpInput(float *In, int len, float *Out, float *mem)
Definition: hpInput.c:23