asterisk/codecs/ilbc/anaFilter.c
Mark Spencer 37b7bccc61 Asterisk:
#72 - Should eliminate probs on VMWI
#41 - Dynamic add survives reload
#73 - Make festival honor its arguments
#93 - Make events on FXO interfaces more logical
#26 - Prefer "bindaddr" to logical address for registrations
??? - Record crashes AGI


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2003-08-15 04:38:39 +00:00

70 lines
1.6 KiB
C
Executable file

/******************************************************************
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"
#include "anaFilter.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));
}