firfilt_crcf

Variants: firfilt_cccf, firfilt_crcf, firfilt_rrrf

Finite impulse response (FIR) filter

Public Functions

firfilt_crcf firfilt_crcf_create(float * _h, unsigned int _n)
firfilt_crcf firfilt_crcf_create_kaiser(unsigned int _n, float _fc, float _as, float _mu)
firfilt_crcf firfilt_crcf_create_rnyquist(int _type, unsigned int _k, unsigned int _m, float _beta, float _mu)
firfilt_crcf firfilt_crcf_create_firdespm(unsigned int _h_len, float _fc, float _as)
firfilt_crcf firfilt_crcf_create_rect(unsigned int _n)
firfilt_crcf firfilt_crcf_create_dc_blocker(unsigned int _m, float _as)
firfilt_crcf firfilt_crcf_create_notch(unsigned int _m, float _as, float _f0)
firfilt_crcf firfilt_crcf_recreate(firfilt_crcf _q, float * _h, unsigned int _n)
firfilt_crcf firfilt_crcf_copy(firfilt_crcf _q)
int firfilt_crcf_destroy(firfilt_crcf _q)
int firfilt_crcf_reset(firfilt_crcf _q)
int firfilt_crcf_print(firfilt_crcf _q)
int firfilt_crcf_set_scale(firfilt_crcf _q, float _scale)
int firfilt_crcf_get_scale(firfilt_crcf _q, float * _scale)
int firfilt_crcf_push(firfilt_crcf _q, float complex _x)
int firfilt_crcf_write(firfilt_crcf _q, float complex * _x, unsigned int _n)
int firfilt_crcf_execute(firfilt_crcf _q, float complex * _y)
int firfilt_crcf_execute_one(firfilt_crcf _q, float complex _x, float complex * _y)
int firfilt_crcf_execute_block(firfilt_crcf _q, float complex * _x, unsigned int _n, float complex * _y)
unsigned int firfilt_crcf_get_length(firfilt_crcf _q)
const float * firfilt_crcf_get_coefficients(firfilt_crcf _q)
int firfilt_crcf_copy_coefficients(firfilt_crcf _q, float * _h)
int firfilt_crcf_freqresponse(firfilt_crcf _q, float _fc, float complex * _H)
float firfilt_crcf_groupdelay(firfilt_crcf _q, float _fc)

Interfaces

firfilt_crcf firfilt_crcf_create(float * _h, unsigned int _n)

Create a finite impulse response filter (firfilt) object by directly specifying the filter coefficients in an array

  • _h : filter coefficients, shape: (_n, 1)
  • _n : number of filter coefficients, 0 < _n

firfilt_crcf firfilt_crcf_create_kaiser(unsigned int _n, float _fc, float _as, float _mu)

Create object using Kaiser-Bessel windowed sinc method

  • _n : filter length, 0 < _n
  • _fc : filter normalized cut-off frequency, 0 < _fc < 0.5
  • _as : filter stop-band attenuation [dB], 0 < _as
  • _mu : fractional sample offset, -0.5 < _mu < 0.5

firfilt_crcf firfilt_crcf_create_rnyquist(int _type, unsigned int _k, unsigned int _m, float _beta, float _mu)

Create object from square-root Nyquist prototype. The filter length will be \(2 k m + 1 \) samples long with a delay of \( k m + 1 \) samples.

  • _type : filter type (e.g. LIQUID_FIRFILT_RRC)
  • _k : nominal samples per symbol, 1 < _k
  • _m : filter delay [symbols], 0 < _m
  • _beta : rolloff factor, 0 < beta <= 1
  • _mu : fractional sample offset [samples], -0.5 < _mu < 0.5

firfilt_crcf firfilt_crcf_create_firdespm(unsigned int _h_len, float _fc, float _as)

Create object from Parks-McClellan algorithm prototype

  • _h_len : filter length, 0 < _h_len
  • _fc : cutoff frequency, 0 < _fc < 0.5
  • _as : stop-band attenuation [dB], 0 < _as

firfilt_crcf firfilt_crcf_create_rect(unsigned int _n)

Create rectangular filter prototype; that is \( \vec{h} = \{ 1, 1, 1, \ldots 1 \} \)

  • _n : length of filter [samples], 0 < _n <= 1024

firfilt_crcf firfilt_crcf_create_dc_blocker(unsigned int _m, float _as)

Create DC blocking filter from prototype

  • _m : prototype filter semi-length such that filter length is 2*m+1
  • _as : prototype filter stop-band attenuation [dB], 0 < _as

firfilt_crcf firfilt_crcf_create_notch(unsigned int _m, float _as, float _f0)

Create notch filter from prototype

  • _m : prototype filter semi-length such that filter length is 2*m+1
  • _as : prototype filter stop-band attenuation [dB], 0 < _as
  • _f0 : center frequency for notch, _fc in [-0.5, 0.5]

firfilt_crcf firfilt_crcf_recreate(firfilt_crcf _q, float * _h, unsigned int _n)

Re-create filter object of potentially a different length with different coefficients. If the length of the filter does not change, not memory reallocation is invoked.

  • _q : original filter object
  • _h : pointer to filter coefficients, shape: (_n, 1)
  • _n : filter length, 0 < _n

firfilt_crcf firfilt_crcf_copy(firfilt_crcf _q)

Copy object including all internal objects and state

int firfilt_crcf_destroy(firfilt_crcf _q)

Destroy filter object and free all internal memory

int firfilt_crcf_reset(firfilt_crcf _q)

Reset filter object's internal buffer

int firfilt_crcf_print(firfilt_crcf _q)

Print filter object information to stdout

int firfilt_crcf_set_scale(firfilt_crcf _q, float _scale)

Set output scaling for filter

  • _q : filter object
  • _scale : scaling factor to apply to each output sample

int firfilt_crcf_get_scale(firfilt_crcf _q, float * _scale)

Get output scaling for filter

  • _q : filter object
  • _scale : scaling factor applied to each output sample

int firfilt_crcf_push(firfilt_crcf _q, float complex _x)

Push sample into filter object's internal buffer

  • _q : filter object
  • _x : single input sample

int firfilt_crcf_write(firfilt_crcf _q, float complex * _x, unsigned int _n)

Write block of samples into filter object's internal buffer

  • _q : filter object
  • _x : buffer of input samples, shape: (_n, 1)
  • _n : number of input samples

int firfilt_crcf_execute(firfilt_crcf _q, float complex * _y)

Execute vector dot product on the filter's internal buffer and coefficients

  • _q : filter object
  • _y : pointer to single output sample

int firfilt_crcf_execute_one(firfilt_crcf _q, float complex _x, float complex * _y)

Execute filter on one sample, equivalent to push() and execute()

  • _q : filter object
  • _x : single input sample
  • _y : pointer to single output sample

int firfilt_crcf_execute_block(firfilt_crcf _q, float complex * _x, unsigned int _n, float complex * _y)

Execute the filter on a block of input samples; in-place operation is permitted (_x and _y may point to the same place in memory)

  • _q : filter object
  • _x : pointer to input array, shape: (_n, 1)
  • _n : number of input, output samples
  • _y : pointer to output array, shape: (_n, 1)

unsigned int firfilt_crcf_get_length(firfilt_crcf _q)

Get length of filter object (number of internal coefficients)

const float * firfilt_crcf_get_coefficients(firfilt_crcf _q)

Get pointer to coefficients array

int firfilt_crcf_copy_coefficients(firfilt_crcf _q, float * _h)

Copy internal coefficients to external buffer

  • _q : filter object
  • _h : pointer to output coefficients array, shape: (_n, 1)

int firfilt_crcf_freqresponse(firfilt_crcf _q, float _fc, float complex * _H)

Compute complex frequency response of filter object

  • _q : filter object
  • _fc : normalized frequency for evaluation
  • _H : pointer to output complex frequency response

float firfilt_crcf_groupdelay(firfilt_crcf _q, float _fc)

Compute and return group delay of filter object

  • _q : filter object
  • _fc : frequency to evaluate