Asterisk - The Open Source Telephony Project  18.5.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions
filter.h File Reference
This graph shows which files directly or indirectly include this file:

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

◆ AllPoleFilter()

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

Definition at line 19 of file filter.c.

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

32  {
33  int n,k;
34 
35  for(n=0;n<lengthInOut;n++){
36  for(k=1;k<=orderCoef;k++){
37  *InOut -= Coef[k]*InOut[-k];
38 
39 
40 
41 
42 
43  }
44  InOut++;
45  }
46  }

◆ AllZeroFilter()

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

Definition at line 52 of file filter.c.

Referenced by ZeroPoleFilter().

63  {
64  int n,k;
65 
66  for(n=0;n<lengthInOut;n++){
67  *Out = Coef[0]*In[0];
68  for(k=1;k<=orderCoef;k++){
69  *Out += Coef[k]*In[-k];
70  }
71  Out++;
72  In++;
73  }
74  }

◆ DownSample()

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().

116  {
117  float o;
118  float *Out_ptr = Out;
119  float *Coef_ptr, *In_ptr;
120  float *state_ptr;
121  int i, j, stop;
122 
123  /* LP filter and decimate at the same time */
124 
125  for (i = DELAY_DS; i < lengthIn; i+=FACTOR_DS)
126  {
127  Coef_ptr = &Coef[0];
128  In_ptr = &In[i];
129  state_ptr = &state[FILTERORDER_DS-2];
130 
131  o = (float)0.0;
132 
133  stop = (i < FILTERORDER_DS) ? i + 1 : FILTERORDER_DS;
134 
135  for (j = 0; j < stop; j++)
136  {
137  o += *Coef_ptr++ * (*In_ptr--);
138  }
139  for (j = i + 1; j < FILTERORDER_DS; j++)
140  {
141  o += *Coef_ptr++ * (*state_ptr--);
142  }
143 
144 
145 
146 
147 
148 
149  *Out_ptr++ = o;
150  }
151 
152  /* Get the last part (use zeros as input for the future) */
153 
154  for (i=(lengthIn+FACTOR_DS); i<(lengthIn+DELAY_DS);
155  i+=FACTOR_DS) {
156 
157  o=(float)0.0;
158 
159  if (i<lengthIn) {
160  Coef_ptr = &Coef[0];
161  In_ptr = &In[i];
162  for (j=0; j<FILTERORDER_DS; j++) {
163  o += *Coef_ptr++ * (*Out_ptr--);
164  }
165  } else {
166  Coef_ptr = &Coef[i-lengthIn];
167  In_ptr = &In[lengthIn-1];
168  for (j=0; j<FILTERORDER_DS-(i-lengthIn); j++) {
169  o += *Coef_ptr++ * (*In_ptr--);
170  }
171  }
172  *Out_ptr++ = o;
173  }
174  }
unsigned int stop
Definition: app_meetme.c:1096
#define FILTERORDER_DS
Definition: iLBC_define.h:94
#define FACTOR_DS
Definition: iLBC_define.h:96
#define DELAY_DS
Definition: iLBC_define.h:95

◆ ZeroPoleFilter()

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().

101  {
102  AllZeroFilter(In,ZeroCoef,lengthInOut,orderCoef,Out);
103  AllPoleFilter(Out,PoleCoef,lengthInOut,orderCoef);
104  }
void AllZeroFilter(float *In, float *Coef, int lengthInOut, int orderCoef, float *Out)
Definition: filter.c:52
void AllPoleFilter(float *InOut, float *Coef, int lengthInOut, int orderCoef)
Definition: filter.c:19