diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
commit | f8247040e6231c4b3b5099ea3a526348b7941566 (patch) | |
tree | 0cc92ad6ebf6ae49a62f6e7ef8ec819121d63630 /trunk/codecs/ilbc/anaFilter.c | |
parent | d88e56c61ce2042544c1a8a71c93b69ab2e6ffba (diff) |
Creating tag for the release of asterisk-1.6.0-beta1v1.6.0-beta1
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0-beta1@99163 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'trunk/codecs/ilbc/anaFilter.c')
-rw-r--r-- | trunk/codecs/ilbc/anaFilter.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/trunk/codecs/ilbc/anaFilter.c b/trunk/codecs/ilbc/anaFilter.c new file mode 100644 index 000000000..f88fefaa0 --- /dev/null +++ b/trunk/codecs/ilbc/anaFilter.c @@ -0,0 +1,71 @@ + +/****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + anaFilter.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + +******************************************************************/ + +#include <string.h> +#include "anaFilter.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 entierly + 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)); +} + + |