diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-31 15:25:14 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-31 15:25:14 +0000 |
commit | 2d507021e3078779c8b48c44c8881558f0ee6242 (patch) | |
tree | a9e27e7543b728242bca923417cdaf527b2d5515 /pjmedia/src/pjmedia-codec/ilbc/anaFilter.c | |
parent | ce9088d8978fdd457158ec0ea4c8e11e10b2960f (diff) |
Really add the iLBC files into SVN now (duh!).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@638 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/pjmedia-codec/ilbc/anaFilter.c')
-rw-r--r-- | pjmedia/src/pjmedia-codec/ilbc/anaFilter.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/pjmedia/src/pjmedia-codec/ilbc/anaFilter.c b/pjmedia/src/pjmedia-codec/ilbc/anaFilter.c new file mode 100644 index 00000000..c161f98a --- /dev/null +++ b/pjmedia/src/pjmedia-codec/ilbc/anaFilter.c @@ -0,0 +1,72 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + anaFilter.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include <string.h> + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * LP analysis filter. + *---------------------------------------------------------------*/ + + void anaFilter( + float *In, /* (i) Signal to be filtered */ + float *a, /* (i) LP parameters */ + int len,/* (i) Length of signal */ + float *Out, /* (o) Filtered signal */ + float *mem /* (i/o) Filter state */ + ){ + int i, j; + float *po, *pi, *pm, *pa; + + po = Out; + + /* Filter first part using memory from past */ + + for (i=0; i<LPC_FILTERORDER; i++) { + pi = &In[i]; + pm = &mem[LPC_FILTERORDER-1]; + pa = a; + *po=0.0; + + + + + + for (j=0; j<=i; j++) { + *po+=(*pa++)*(*pi--); + } + for (j=i+1; j<LPC_FILTERORDER+1; j++) { + + *po+=(*pa++)*(*pm--); + } + po++; + } + + /* Filter last part where the state is entirely + in the input vector */ + + for (i=LPC_FILTERORDER; i<len; i++) { + pi = &In[i]; + pa = a; + *po=0.0; + for (j=0; j<LPC_FILTERORDER+1; j++) { + *po+=(*pa++)*(*pi--); + } + po++; + } + + /* Update state vector */ + + memcpy(mem, &In[len-LPC_FILTERORDER], + LPC_FILTERORDER*sizeof(float)); + } + |