aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/ilbc/anaFilter.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-15 04:36:52 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-15 04:36:52 +0000
commit9fa1f6563a431a73d7eb0c8a284e4cf419cbc2fa (patch)
tree468bcd1944564d1b84b5a9d46b2eb437fe3c73a3 /codecs/ilbc/anaFilter.c
parent0cc1bf692bcfc7f3f9ffef9d62c6621cd9ab9f4a (diff)
Add iLBC codec
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@852 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/ilbc/anaFilter.c')
-rwxr-xr-xcodecs/ilbc/anaFilter.c68
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));
+}
+
+