comparison intercom/ilbc/syntFilter.c @ 2:13be24d74cd2

import intercom-0.4.1
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 09:57:52 +0200
parents
children
comparison
equal deleted inserted replaced
1:9cadc470e3da 2:13be24d74cd2
1
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(float *Out, /* (i/o) Signal to be filtered */
20 float *a, /* (i) LP parameters */
21 int len, /* (i) Length of signal */
22 float *mem /* (i/o) Filter state */
23 )
24 {
25 int i, j;
26 float *po, *pi, *pa, *pm;
27
28 po = Out;
29
30 /* Filter first part using memory from past */
31
32 for (i = 0; i < LPC_FILTERORDER; i++) {
33 pi = &Out[i - 1];
34 pa = &a[1];
35 pm = &mem[LPC_FILTERORDER - 1];
36 for (j = 1; j <= i; j++) {
37 *po -= (*pa++) * (*pi--);
38 }
39 for (j = i + 1; j < LPC_FILTERORDER + 1; j++) {
40 *po -= (*pa++) * (*pm--);
41 }
42 po++;
43 }
44
45 /* Filter last part where the state is entirely in
46 the output vector */
47
48 for (i = LPC_FILTERORDER; i < len; i++) {
49 pi = &Out[i - 1];
50 pa = &a[1];
51 for (j = 1; j < LPC_FILTERORDER + 1; j++) {
52 *po -= (*pa++) * (*pi--);
53 }
54 po++;
55 }
56
57 /* Update state vector */
58
59 memcpy(mem, &Out[len - LPC_FILTERORDER],
60 LPC_FILTERORDER * sizeof(float));
61 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.