blob: 190eb009db7029d1cc5bfe8740d5fe153c0d5da0 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001
2 /******************************************************************
3
4 iLBC Speech Coder ANSI-C Source Code
5
6 syntFilter.c
7
8 Copyright (C) The Internet Society (2004).
9 All Rights Reserved.
10
11 ******************************************************************/
12
13 #include "iLBC_define.h"
14
15 /*----------------------------------------------------------------*
16 * LP synthesis filter.
17 *---------------------------------------------------------------*/
18
19 void syntFilter(
20 float *Out, /* (i/o) Signal to be filtered */
21 float *a, /* (i) LP parameters */
22 int len, /* (i) Length of signal */
23
24
25
26
27
28 float *mem /* (i/o) Filter state */
29 ){
30 int i, j;
31 float *po, *pi, *pa, *pm;
32
33 po=Out;
34
35 /* Filter first part using memory from past */
36
37 for (i=0; i<LPC_FILTERORDER; i++) {
38 pi=&Out[i-1];
39 pa=&a[1];
40 pm=&mem[LPC_FILTERORDER-1];
41 for (j=1; j<=i; j++) {
42 *po-=(*pa++)*(*pi--);
43 }
44 for (j=i+1; j<LPC_FILTERORDER+1; j++) {
45 *po-=(*pa++)*(*pm--);
46 }
47 po++;
48 }
49
50 /* Filter last part where the state is entirely in
51 the output vector */
52
53 for (i=LPC_FILTERORDER; i<len; i++) {
54 pi=&Out[i-1];
55 pa=&a[1];
56 for (j=1; j<LPC_FILTERORDER+1; j++) {
57 *po-=(*pa++)*(*pi--);
58 }
59 po++;
60 }
61
62 /* Update state vector */
63
64 memcpy(mem, &Out[len-LPC_FILTERORDER],
65 LPC_FILTERORDER*sizeof(float));
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80