All the filters functions currently supported by the DSP library.
The following functions are using coefficients to operate. These coefficients define the properties of the filter used and must be generated first.
There are different ways to do it:
The following shows how to generate 4th order lowpass filter coefficients using Scilab.
This function computes a real FIR filter using the impulse response of the desire filter onto a fixedlength signal. It returns a signal of a length equals to (size  h_size + 1) elements.
Here is the formula of the FIR filter:
Relative functions:
This function computes a real IIR filter using the coefficients of the desire filter onto a fixedlength signal. It returns a signal of a length equals to size elements.
Here is the formula of the IIR filter:
Relative functions:
This function computes a real IIR filter using the coefficients of the desire filter onto a fixedlength signal. It returns a signal of a length equals to (size  num_size + 1) elements.
Here is the formula of the IIR filter:
Relative functions:
This function computes an adaptive LMS filter. It returns a (size)length signal.
Here is the formula of the LMS filter:
Relative functions:
This function computes an adaptive NLMS filter. It returns a (size)length signal.
Here is the formula of the NLMS filter:
Relative functions:
This function performs an interpolation over the input signal. It returns a (vect2_size * interpolation_ratio)length signal.
Here is the principle of the interpolation:
Relative functions:
These functions calculate lowpass FIR filter's coefficients.
Relative functions:
Functions  
static void  dsp16_filt_fir (dsp16_t *vect1, dsp16_t *vect2, int size, dsp16_t *h, int h_size) 
16 bits fixed point version of the FIR . More...  
void  dsp16_filt_iir (dsp16_t *y, dsp16_t *x, int size, dsp16_t *num, int num_size, dsp16_t *den, int den_size, int num_prediv, int den_prediv) 
16bit fixed point version of the IIR . More...  
void  dsp16_filt_iirpart (dsp16_t *vect1, dsp16_t *vect2, int size, dsp16_t *num, int num_size, dsp16_t *den, int den_size, int num_prediv, int den_prediv) 
16 bits fixed point version of the IIR . More...  
void  dsp16_filt_interpolation (dsp16_t *vect1, dsp16_t *vect2, int vect2_size, dsp16_t *h, int h_size, int interpolation_ratio) 
This function interpolates a vector. More...  
void  dsp16_filt_interpolation_coefsort (dsp16_t *fir_coefs, int n_tap, int interpolation_ratio) 
This function resort the coefficients of a FIR filter to be used with the function dsp16_filt_interpolation. More...  
void  dsp16_filt_lms (dsp16_t *x, dsp16_t *w, int size, dsp16_t new_x, dsp16_t d, dsp16_t *y, dsp16_t *e) 
16bit fixed point version of the LMS filter. More...  
void  dsp16_filt_lpfirdesign (dsp16_t *c, int fc, int fs, int order) 
16bit fixed point version of the lowpass FIR filter design. More...  
void  dsp16_filt_lpfirdesign_windowed_sinc (dsp16_t *c, int fc_hz, int fs_hz, int order) 
16bit fixed point version of the windowed sinc lowpass FIR filter design. More...  
void  dsp16_filt_nlms (dsp16_t *x, dsp16_t *w, int size, dsp16_t new_x, dsp16_t d, dsp16_t *y, dsp16_t *e) 
16bit fixed point version of the NLMS filter. More...  
static void  dsp32_filt_fir (dsp32_t *vect1, dsp32_t *vect2, int size, dsp32_t *h, int h_size) 
32 bits fixed point version of the FIR . More...  
void  dsp32_filt_iir (dsp32_t *y, dsp32_t *x, int size, dsp32_t *num, int num_size, dsp32_t *den, int den_size, int num_prediv, int den_prediv) 
32bit fixed point version of the IIR . More...  
void  dsp32_filt_iirpart (dsp32_t *vect1, dsp32_t *vect2, int size, dsp32_t *num, int num_size, dsp32_t *den, int den_size, int num_prediv, int den_prediv) 
32 bits fixed point version of the IIR . More...  
void  dsp32_filt_lms (dsp32_t *x, dsp32_t *w, int size, dsp32_t new_x, dsp32_t d, dsp32_t *y, dsp32_t *e) 
32bit fixed point version of the LMS filter. More...  
void  dsp32_filt_nlms (dsp32_t *x, dsp32_t *w, int size, dsp32_t new_x, dsp32_t d, dsp32_t *y, dsp32_t *e) 
32bit fixed point version of the NLMS filter. More...  

inlinestatic 
16 bits fixed point version of the FIR .
vect1  A pointer on a 16bit fixedpoint vector of (size  h_size + 1) elements corresponding to the output buffer. 
vect2  A pointer on a 16bit fixedpoint vector of size elements corresponding to the input buffer. 
size  The length of the input buffer (must be greater or equals to 4). 
h  A pointer on a 16bit fixedpoint vector of h_size elements corresponding to the buffer containing the impulse response coefficients. 
h_size  The length of the impulse response of the filter (must be greater than 7) 
References dsp16_vect_convpart().
void dsp16_filt_iir  (  dsp16_t *  y, 
dsp16_t *  x,  
int  size,  
dsp16_t *  num,  
int  num_size,  
dsp16_t *  den,  
int  den_size,  
int  num_prediv,  
int  den_prediv  
) 
16bit fixed point version of the IIR .
y  A pointer on a 16bit fixedpoint vector of size elements corresponding to the output buffer. The den_size previous elements correspond to values of old output samples and have to be set to 0 at the initialization (y1, y2, ...). 
x  A pointer on a 16bit fixedpoint vector of size elements corresponding to the input buffer. The num_size previous elements correspond to old samples input samples have to be set to 0 at the initialization (x1, x2, ...). 
size  The length of the input buffer. 
num  A pointer on a 16bit fixedpoint vector of num_size elements corresponding to the buffer containing the numerator's coefficients of the filter. 
num_size  The length of the numerator's coefficients of the filter (must be a multiple of 2). 
den  A pointer on a 16bit fixedpoint vector of den_size elements corresponding to the buffer containing the denominator's coefficients of the filter. 
den_size  The length of the denominator's coefficients of the filter (must be a multiple of 2). 
num_prediv  The predivisor used to scale down the numerator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the numerator's coefficients by 2^num_prediv else leave this field to 0. 
den_prediv  The predivisor used to scale down the denominator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the denominator's coefficients by 2^den_prediv else leave this field to 0. 
void dsp16_filt_iirpart  (  dsp16_t *  vect1, 
dsp16_t *  vect2,  
int  size,  
dsp16_t *  num,  
int  num_size,  
dsp16_t *  den,  
int  den_size,  
int  num_prediv,  
int  den_prediv  
) 
16 bits fixed point version of the IIR .
vect1  A pointer on a 16bit fixedpoint vector of (size  num_size + 1) elements corresponding to the output buffer. 
vect2  A pointer on a 16bit fixedpoint vector of size elements corresponding to the input buffer. 
size  The length of the input buffer. 
num  A pointer on a 16bit fixedpoint vector of num_size elements corresponding to the buffer containing the numerator's coefficients of the filter. 
num_size  The length of the numerator's coefficients of the filter. 
den  A pointer on a 16bit fixedpoint vector of den_size elements corresponding to the buffer containing the denominator's coefficients of the filter. 
den_size  The length of the denominator's coefficients of the filter. 
num_prediv  The predivisor used to scale down the numerator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the numerator's coefficients by 2^num_prediv else leave this field to 0. 
den_prediv  The predivisor used to scale down the denominator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the denominator's coefficients by 2^den_prediv else leave this field to 0. 
void dsp16_filt_interpolation  (  dsp16_t *  vect1, 
dsp16_t *  vect2,  
int  vect2_size,  
dsp16_t *  h,  
int  h_size,  
int  interpolation_ratio  
) 
This function interpolates a vector.
vect1  A pointer on a 16bit fixedpoint vector where to store the result. It must be of a size (in sample) equals to the size of the input buffer multiplied by the interpolation factor. 
vect2  A pointer on a 16bit fixedpoint vector containig the input samples. 
vect2_size  The size of the input buffer. 
h  A pointer on a 16bit fixedpoint vector which contains the coefficients of the filter. These coefficients must be reorder with the function dsp16_filt_interpolation_coefsort before being used. 
h_size  The size of this buffer. 
interpolation_ratio  The interpolation factor desired for this interpolation. 
References DSP16_INTREPOLATION_FILTER_FUNCTION_NAME, DSP16_INTREPOLATION_NO_LOOP_FILTER_FUNCTION_NAME, LOOP_UNROLL, LOOP_UNROLL_PLUS_ONE, and MREPEAT().
void dsp16_filt_interpolation_coefsort  (  dsp16_t *  fir_coefs, 
int  n_tap,  
int  interpolation_ratio  
) 
This function resort the coefficients of a FIR filter to be used with the function dsp16_filt_interpolation.
fir_coefs  A pointer on a 16bit fixedpoint vector where the coefficients are stored. 
n_tap  The number of tap of this filter. 
interpolation_ratio  The interpolation factor of the interpolation to perform with this filter. 
References get_new_index().
Referenced by dsp16_resampling_setup().
void dsp16_filt_lms  (  dsp16_t *  x, 
dsp16_t *  w,  
int  size,  
dsp16_t  new_x,  
dsp16_t  d,  
dsp16_t *  y,  
dsp16_t *  e  
) 
16bit fixed point version of the LMS filter.
x  A pointer on a 16bit fixedpoint vector of (size) elements that acts as a circular buffer, filled with the input samples. Its elements have to be initialized to zero and then you just need to reinject this vector each time you call this functions without filling any of its values. 
w  A pointer on a 16bit fixedpoint vector of size elements corresponding to the coefficients of the filter. Just initialize its elements to zero and after several iterations, this buffer will be filled with the actual coefficients of the filter. 
size  The length of the circular buffer (x) and of the coefficient's buffer (w). It must be a multiple of 4. 
new_x  A 16bit fixedpoint value which contains a new input sample signal. 
d  A 16bit fixedpoint value which contains the current sample of the reference's signal. 
y  A pointer on a 16bit fixedpoint value corresponding to the current sample of the output signal. 
e  A pointer on a 16bit fixedpoint value corresponding to the current sample of the output error signal. 
References DSP16_QB, DSP_LMS_MU, i, and temp.
void dsp16_filt_lpfirdesign  (  dsp16_t *  c, 
int  fc,  
int  fs,  
int  order  
) 
16bit fixed point version of the lowpass FIR filter design.
c  A pointer on a 16bit fixedpoint vector of "order" size, used to store the coefficients of the filter designed. 
fc  Cutoff frequency of the lowpass filter. 
fs  Sample rate of the signal to filter. 
order  Order of the filter to design. 
References CST_PI, DSP16_MUL_TO_DSP32, dsp16_op_mul(), DSP16_Q, DSP16_QB, DSP32_DIV_TO_DSP16, dsp32_op_sin(), DSP_Q, and i.
void dsp16_filt_lpfirdesign_windowed_sinc  (  dsp16_t *  c, 
int  fc_hz,  
int  fs_hz,  
int  order  
) 
16bit fixed point version of the windowed sinc lowpass FIR filter design.
c  A pointer on a 16bit fixedpoint vector of "order" size, used to store the coefficients of the filter designed. 
fc  Cutoff frequency of the lowpass filter. 
fs  Sample rate of the signal to filter. 
order  Order of the filter to design. 
16bit fixed point version of the windowed sinc lowpass FIR filter design.
k is chosen so that coef(order/2+1) equals 1.
fc = f_hz / fs_hz; for i=0:(order1), if (i  order/2) <> 0, cst = sin(2 * pi * fc * (i  order/2)) / (i  order/2); coef(i+1) = k * cst * (0.42  0.5 * cos(2 * pi * i / order) + 0.08 * cos(4 * pi * i / order)); end end coef(order/2+1) = k * 2 * pi * fc;
References CST_PI, dsp16_op_cos(), dsp16_op_mul(), dsp16_op_sin(), DSP16_Q, DSP16_QB, DSP_Q, and i.
void dsp16_filt_nlms  (  dsp16_t *  x, 
dsp16_t *  w,  
int  size,  
dsp16_t  new_x,  
dsp16_t  d,  
dsp16_t *  y,  
dsp16_t *  e  
) 
16bit fixed point version of the NLMS filter.
x  A pointer on a 16bit fixedpoint vector of (size) elements that acts as a circular buffer, filled with the input samples. Its elements have to be initialized to zero and then you just need to reinject this vector each time you call this functions without filling any of its values. 
w  A pointer on a 16bit fixedpoint vector of size elements corresponding to the coefficients of the filter. Just initialize its elements to zero and after several iterations, this buffer will be filled with the actual coefficients of the filter. 
size  The length of the circular buffer (x) and of the coefficient's buffer (w). It must be a multiple of 4. 
new_x  A 16bit fixedpoint value which contains a new input sample signal. 
d  A 16bit fixedpoint value which contains the current sample of the reference's signal. 
y  A pointer on a 16bit fixedpoint value corresponding to the current sample of the output signal. 
e  A pointer on a 16bit fixedpoint value corresponding to the current sample of the output error signal. 
References DSP16_QB, DSP_NLMS_MU, i, and temp.

inlinestatic 
32 bits fixed point version of the FIR .
vect1  A pointer on a 32bit fixedpoint vector of (size  h_size + 1) elements corresponding to the output buffer. 
vect2  A pointer on a 32bit fixedpoint vector of size elements corresponding to the input buffer. 
size  The length of the input buffer (must be greater or equals to 4). 
h  A pointer on a 32bit fixedpoint vector of h_size elements corresponding to the buffer containing the impulse response coefficients. 
h_size  The length of the impulse response of the filter (must be greater than 7) 
References dsp32_vect_convpart().
void dsp32_filt_iir  (  dsp32_t *  y, 
dsp32_t *  x,  
int  size,  
dsp32_t *  num,  
int  num_size,  
dsp32_t *  den,  
int  den_size,  
int  num_prediv,  
int  den_prediv  
) 
32bit fixed point version of the IIR .
y  A pointer on a 32bit fixedpoint vector of size elements corresponding to the output buffer. The den_size previous elements correspond to values of old output samples and have to be set to 0 at the initialization (y1, y2, ...). 
x  A pointer on a 32bit fixedpoint vector of size elements corresponding to the input buffer. The num_size previous elements correspond to old samples input samples have to be set to 0 at the initialization (x1, x2, ...). 
size  The length of the input buffer. 
num  A pointer on a 32bit fixedpoint vector of num_size elements corresponding to the buffer containing the numerator's coefficients of the filter. 
num_size  The length of the numerator's coefficients of the filter (must be a multiple of 2). 
den  A pointer on a 32bit fixedpoint vector of den_size elements corresponding to the buffer containing the denominator's coefficients of the filter. 
den_size  The length of the denominator's coefficients of the filter (must be a multiple of 2). 
num_prediv  The predivisor used to scale down the numerator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the numerator's coefficients by 2^num_prediv else leave this field to 0. 
den_prediv  The predivisor used to scale down the denominator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the denominator's coefficients by 2^den_prediv else leave this field to 0. 
void dsp32_filt_iirpart  (  dsp32_t *  vect1, 
dsp32_t *  vect2,  
int  size,  
dsp32_t *  num,  
int  num_size,  
dsp32_t *  den,  
int  den_size,  
int  num_prediv,  
int  den_prediv  
) 
32 bits fixed point version of the IIR .
vect1  A pointer on a 32bit fixedpoint vector of (size  num_size + 1) elements corresponding to the output buffer. 
vect2  A pointer on a 32bit fixedpoint vector of size elements corresponding to the input buffer. 
size  The length of the input buffer. 
num  A pointer on a 32bit fixedpoint vector of num_size elements corresponding to the buffer containing the numerator's coefficients of the filter. 
num_size  The length of the numerator's coefficients of the filter. 
den  A pointer on a 32bit fixedpoint vector of den_size elements corresponding to the buffer containing the denominator's coefficients of the filter. 
den_size  The length of the denominator's coefficients of the filter. 
num_prediv  The predivisor used to scale down the numerator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the numerator's coefficients by 2^num_prediv else leave this field to 0. 
den_prediv  The predivisor used to scale down the denominator's coefficients of the filter in order to avoid overflow values. So when you use this feature, you have to prescale manually the denominator's coefficients by 2^den_prediv else leave this field to 0. 
void dsp32_filt_lms  (  dsp32_t *  x, 
dsp32_t *  w,  
int  size,  
dsp32_t  new_x,  
dsp32_t  d,  
dsp32_t *  y,  
dsp32_t *  e  
) 
32bit fixed point version of the LMS filter.
x  A pointer on a 32bit fixedpoint vector of (size) elements that acts as a circular buffer, filled with the input samples. Its elements have to be initialized to zero and then you just need to reinject this vector each time you call this functions without filling any of its values. 
w  A pointer on a 32bit fixedpoint vector of size elements corresponding to the coefficients of the filter. Just initialize its elements to zero and after several iterations, this buffer will be filled with the actual coefficients of the filter. 
size  The length of the circular buffer (x) and of the coefficient's buffer (w). 
new_x  A 32bit fixedpoint value which contains a new input sample signal. 
d  A 32bit fixedpoint value which contains the current sample of the reference's signal. 
y  A pointer on a 32bit fixedpoint value corresponding to the current sample of the output signal. 
e  A pointer on a 32bit fixedpoint value corresponding to the current sample of the output error signal. 
References DSP32_QB, DSP_LMS_MU, i, and temp.
void dsp32_filt_nlms  (  dsp32_t *  x, 
dsp32_t *  w,  
int  size,  
dsp32_t  new_x,  
dsp32_t  d,  
dsp32_t *  y,  
dsp32_t *  e  
) 
32bit fixed point version of the NLMS filter.
x  A pointer on a 32bit fixedpoint vector of (size) elements that acts as a circular buffer, filled with the input samples. Its elements have to be initialized to zero and then you just need to reinject this vector each time you call this functions without filling any of its values. 
w  A pointer on a 32bit fixedpoint vector of size elements corresponding to the coefficients of the filter. Just initialize its elements to zero and after several iterations, this buffer will be filled with the actual coefficients of the filter. 
size  The length of the circular buffer (x) and of the coefficient's buffer (w). 
new_x  A 32bit fixedpoint value which contains a new input sample signal. 
d  A 32bit fixedpoint value which contains the current sample of the reference's signal. 
y  A pointer on a 32bit fixedpoint value corresponding to the current sample of the output signal. 
e  A pointer on a 32bit fixedpoint value corresponding to the current sample of the output error signal. 
References DSP32_QB, DSP_NLMS_MU, i, and temp.