diff options
author | Mark Spencer <markster@digium.com> | 2003-04-15 04:36:52 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2003-04-15 04:36:52 +0000 |
commit | c4da749362b2842ba0478dcdb309c29dd353c795 (patch) | |
tree | 468bcd1944564d1b84b5a9d46b2eb437fe3c73a3 /codecs/ilbc/anaFilter.c | |
parent | dbe00ec2d2029c61ffb7b58ee6184274058767f4 (diff) |
Add iLBC codec
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs/ilbc/anaFilter.c')
-rwxr-xr-x | codecs/ilbc/anaFilter.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/codecs/ilbc/anaFilter.c b/codecs/ilbc/anaFilter.c new file mode 100755 index 000000000..19b502ef0 --- /dev/null +++ b/codecs/ilbc/anaFilter.c @@ -0,0 +1,68 @@ + +/****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + anaFilter.c + + Copyright (c) 2001, + Global IP Sound AB. + 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 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)); +} + + |