filter.c File Reference

#include "iLBC_define.h"

Include dependency graph for filter.c:

Go to the source code of this file.

Functions

void AllPoleFilter (float *InOut, float *Coef, int lengthInOut, int orderCoef)
void AllZeroFilter (float *In, float *Coef, int lengthInOut, int orderCoef, float *Out)
void DownSample (float *In, float *Coef, int lengthIn, float *state, float *Out)
void ZeroPoleFilter (float *In, float *ZeroCoef, float *PoleCoef, int lengthInOut, int orderCoef, float *Out)


Function Documentation

void AllPoleFilter ( float *  InOut,
float *  Coef,
int  lengthInOut,
int  orderCoef 
)

Definition at line 19 of file filter.c.

Referenced by AbsQuantW(), iCBSearch(), and ZeroPoleFilter().

00032     {
00033        int n,k;
00034 
00035        for(n=0;n<lengthInOut;n++){
00036            for(k=1;k<=orderCoef;k++){
00037                *InOut -= Coef[k]*InOut[-k];
00038 
00039 
00040 
00041 
00042 
00043            }
00044            InOut++;
00045        }
00046    }

void AllZeroFilter ( float *  In,
float *  Coef,
int  lengthInOut,
int  orderCoef,
float *  Out 
)

Definition at line 52 of file filter.c.

Referenced by ZeroPoleFilter().

00063     {
00064        int n,k;
00065 
00066        for(n=0;n<lengthInOut;n++){
00067            *Out = Coef[0]*In[0];
00068            for(k=1;k<=orderCoef;k++){
00069                *Out += Coef[k]*In[-k];
00070            }
00071            Out++;
00072            In++;
00073        }
00074    }

void DownSample ( float *  In,
float *  Coef,
int  lengthIn,
float *  state,
float *  Out 
)

Definition at line 110 of file filter.c.

References DELAY_DS, FACTOR_DS, FILTERORDER_DS, and stop.

Referenced by enhancerInterface().

00116     {
00117        float   o;
00118        float *Out_ptr = Out;
00119        float *Coef_ptr, *In_ptr;
00120        float *state_ptr;
00121        int i, j, stop;
00122 
00123        /* LP filter and decimate at the same time */
00124 
00125        for (i = DELAY_DS; i < lengthIn; i+=FACTOR_DS)
00126        {
00127            Coef_ptr = &Coef[0];
00128            In_ptr = &In[i];
00129            state_ptr = &state[FILTERORDER_DS-2];
00130 
00131            o = (float)0.0;
00132 
00133            stop = (i < FILTERORDER_DS) ? i + 1 : FILTERORDER_DS;
00134 
00135            for (j = 0; j < stop; j++)
00136            {
00137                o += *Coef_ptr++ * (*In_ptr--);
00138            }
00139            for (j = i + 1; j < FILTERORDER_DS; j++)
00140            {
00141                o += *Coef_ptr++ * (*state_ptr--);
00142            }
00143 
00144 
00145 
00146 
00147 
00148 
00149            *Out_ptr++ = o;
00150        }
00151 
00152        /* Get the last part (use zeros as input for the future) */
00153 
00154        for (i=(lengthIn+FACTOR_DS); i<(lengthIn+DELAY_DS);
00155                i+=FACTOR_DS) {
00156 
00157            o=(float)0.0;
00158 
00159            if (i<lengthIn) {
00160                Coef_ptr = &Coef[0];
00161                In_ptr = &In[i];
00162                for (j=0; j<FILTERORDER_DS; j++) {
00163                        o += *Coef_ptr++ * (*Out_ptr--);
00164                }
00165            } else {
00166                Coef_ptr = &Coef[i-lengthIn];
00167                In_ptr = &In[lengthIn-1];
00168                for (j=0; j<FILTERORDER_DS-(i-lengthIn); j++) {
00169                        o += *Coef_ptr++ * (*In_ptr--);
00170                }
00171            }
00172            *Out_ptr++ = o;
00173        }
00174    }

void ZeroPoleFilter ( float *  In,
float *  ZeroCoef,
float *  PoleCoef,
int  lengthInOut,
int  orderCoef,
float *  Out 
)

Definition at line 80 of file filter.c.

References AllPoleFilter(), and AllZeroFilter().

Referenced by StateConstructW(), and StateSearchW().

00101     {
00102        AllZeroFilter(In,ZeroCoef,lengthInOut,orderCoef,Out);
00103        AllPoleFilter(Out,PoleCoef,lengthInOut,orderCoef);
00104    }


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