anaFilter.c

Go to the documentation of this file.
00001 
00002    /******************************************************************
00003 
00004        iLBC Speech Coder ANSI-C Source Code
00005 
00006        anaFilter.c
00007 
00008        Copyright (C) The Internet Society (2004).
00009        All Rights Reserved.
00010 
00011    ******************************************************************/
00012 
00013    #include <string.h>
00014    #include "iLBC_define.h"
00015 
00016    /*----------------------------------------------------------------*
00017     *  LP analysis filter.
00018     *---------------------------------------------------------------*/
00019 
00020    void anaFilter(
00021        float *In,  /* (i) Signal to be filtered */
00022        float *a,   /* (i) LP parameters */
00023        int len,/* (i) Length of signal */
00024        float *Out, /* (o) Filtered signal */
00025        float *mem  /* (i/o) Filter state */
00026    ){
00027        int i, j;
00028        float *po, *pi, *pm, *pa;
00029 
00030        po = Out;
00031 
00032        /* Filter first part using memory from past */
00033 
00034        for (i=0; i<LPC_FILTERORDER; i++) {
00035            pi = &In[i];
00036            pm = &mem[LPC_FILTERORDER-1];
00037            pa = a;
00038            *po=0.0;
00039 
00040 
00041 
00042 
00043 
00044            for (j=0; j<=i; j++) {
00045                *po+=(*pa++)*(*pi--);
00046            }
00047            for (j=i+1; j<LPC_FILTERORDER+1; j++) {
00048 
00049                *po+=(*pa++)*(*pm--);
00050            }
00051            po++;
00052        }
00053 
00054        /* Filter last part where the state is entirely
00055           in the input vector */
00056 
00057        for (i=LPC_FILTERORDER; i<len; i++) {
00058            pi = &In[i];
00059            pa = a;
00060            *po=0.0;
00061            for (j=0; j<LPC_FILTERORDER+1; j++) {
00062                *po+=(*pa++)*(*pi--);
00063            }
00064            po++;
00065        }
00066 
00067        /* Update state vector */
00068 
00069        memcpy(mem, &In[len-LPC_FILTERORDER],
00070            LPC_FILTERORDER*sizeof(float));
00071    }
00072 

Generated on Thu Apr 16 06:27:06 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6