libvoipcodecs  0.0.1
filter.h
1 /*
2  * iLBC - a library for the iLBC codec
3  *
4  * filter.h - The iLBC low bit rate speech codec.
5  *
6  * Adapted by Steve Underwood <steveu@coppice.org> from the reference
7  * iLBC code supplied in RFC3951.
8  *
9  * Original code Copyright (C) The Internet Society (2004).
10  * All changes to produce this version Copyright (C) 2008 by Steve Underwood
11  * All Rights Reserved.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * $Id: filter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
18  */
19 
20 #ifndef __iLBC_FILTER_H
21 #define __iLBC_FILTER_H
22 
23 void AllPoleFilter(float *InOut, /* (i/o) on entrance InOut[-orderCoef] to
24  InOut[-1] contain the state of the
25  filter (delayed samples). InOut[0] to
26  InOut[lengthInOut-1] contain the filter
27  input, on en exit InOut[-orderCoef] to
28  InOut[-1] is unchanged and InOut[0] to
29  InOut[lengthInOut-1] contain filtered
30  samples */
31  const float *Coef, /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */
32  int lengthInOut, /* (i) number of input/output samples */
33  int orderCoef); /* (i) number of filter coefficients */
34 
35 void AllZeroFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain
36  filter input samples */
37  const float *Coef, /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */
38  int lengthInOut, /* (i) number of input/output samples */
39  int orderCoef, /* (i) number of filter coefficients */
40  float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1]
41  contain the filter state, on exit Out[0]
42  to Out[lengthInOut-1] contain filtered
43  samples */
44 
45 void ZeroPoleFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain filter
46  input samples In[-orderCoef] to In[-1]
47  contain state of all-zero section */
48  const float *ZeroCoef, /* (i) filter coefficients for all-zero
49  section (ZeroCoef[0] is assumed to
50  be 1.0) */
51  const float *PoleCoef, /* (i) filter coefficients for all-pole section
52  (ZeroCoef[0] is assumed to be 1.0) */
53  int lengthInOut, /* (i) number of input/output samples */
54  int orderCoef, /* (i) number of filter coefficients */
55  float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1]
56  contain state of all-pole section. On
57  exit Out[0] to Out[lengthInOut-1]
58  contain filtered samples */
59 
60 void DownSample(const float *In, /* (i) input samples */
61  const float *Coef, /* (i) filter coefficients */
62  int lengthIn, /* (i) number of input samples */
63  float *state, /* (i) filter state */
64  float *Out); /* (o) downsampled output */
65 
66 #endif