16adf6de8c
This patch includes the iLBC source code for distribution with Asterisk. Clarification regarding the iLBC source code was provided by Google, and the appropriate licenses have been included in the codecs/ilbc folder. Review: https://reviewboard.asterisk.org/r/1675 Review: https://reviewboard.asterisk.org/r/1649 (closes issue: ASTERISK-18943) Reporter: Leif Madsen Tested by: Matt Jordan ........ Merged revisions 351450 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 351451 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
73 lines
1.7 KiB
C
73 lines
1.7 KiB
C
|
|
/******************************************************************
|
|
|
|
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));
|
|
}
|
|
|