00001 /* 00002 * iLBC - a library for the iLBC codec 00003 * 00004 * filter.h - The iLBC low bit rate speech codec. 00005 * 00006 * Adapted by Steve Underwood <steveu@coppice.org> from the reference 00007 * iLBC code supplied in RFC3951. 00008 * 00009 * Original code Copyright (C) The Internet Society (2004). 00010 * All changes to produce this version Copyright (C) 2008 by Steve Underwood 00011 * All Rights Reserved. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * 00017 * $Id: filter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $ 00018 */ 00019 00020 #ifndef __iLBC_FILTER_H 00021 #define __iLBC_FILTER_H 00022 00023 void AllPoleFilter(float *InOut, /* (i/o) on entrance InOut[-orderCoef] to 00024 InOut[-1] contain the state of the 00025 filter (delayed samples). InOut[0] to 00026 InOut[lengthInOut-1] contain the filter 00027 input, on en exit InOut[-orderCoef] to 00028 InOut[-1] is unchanged and InOut[0] to 00029 InOut[lengthInOut-1] contain filtered 00030 samples */ 00031 const float *Coef, /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */ 00032 int lengthInOut, /* (i) number of input/output samples */ 00033 int orderCoef); /* (i) number of filter coefficients */ 00034 00035 void AllZeroFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain 00036 filter input samples */ 00037 const float *Coef, /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */ 00038 int lengthInOut, /* (i) number of input/output samples */ 00039 int orderCoef, /* (i) number of filter coefficients */ 00040 float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1] 00041 contain the filter state, on exit Out[0] 00042 to Out[lengthInOut-1] contain filtered 00043 samples */ 00044 00045 void ZeroPoleFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain filter 00046 input samples In[-orderCoef] to In[-1] 00047 contain state of all-zero section */ 00048 const float *ZeroCoef, /* (i) filter coefficients for all-zero 00049 section (ZeroCoef[0] is assumed to 00050 be 1.0) */ 00051 const float *PoleCoef, /* (i) filter coefficients for all-pole section 00052 (ZeroCoef[0] is assumed to be 1.0) */ 00053 int lengthInOut, /* (i) number of input/output samples */ 00054 int orderCoef, /* (i) number of filter coefficients */ 00055 float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1] 00056 contain state of all-pole section. On 00057 exit Out[0] to Out[lengthInOut-1] 00058 contain filtered samples */ 00059 00060 void DownSample(const float *In, /* (i) input samples */ 00061 const float *Coef, /* (i) filter coefficients */ 00062 int lengthIn, /* (i) number of input samples */ 00063 float *state, /* (i) filter state */ 00064 float *Out); /* (o) downsampled output */ 00065 00066 #endif