firfilt_rrrf

Variants: firfilt_cccf, firfilt_crcf, firfilt_rrrf

Finite impulse response (FIR) filter

Public Functions

firfilt_rrrf firfilt_rrrf_create(float * _h, unsigned int _n)
firfilt_rrrf firfilt_rrrf_create_kaiser(unsigned int _n, float _fc, float _as, float _mu)
firfilt_rrrf firfilt_rrrf_create_rnyquist(int _type, unsigned int _k, unsigned int _m, float _beta, float _mu)
firfilt_rrrf firfilt_rrrf_create_firdespm(unsigned int _h_len, float _fc, float _as)
firfilt_rrrf firfilt_rrrf_create_rect(unsigned int _n)
firfilt_rrrf firfilt_rrrf_create_dc_blocker(unsigned int _m, float _as)
firfilt_rrrf firfilt_rrrf_create_notch(unsigned int _m, float _as, float _f0)
firfilt_rrrf firfilt_rrrf_recreate(firfilt_rrrf _q, float * _h, unsigned int _n)
firfilt_rrrf firfilt_rrrf_copy(firfilt_rrrf _q)
int firfilt_rrrf_destroy(firfilt_rrrf _q)
int firfilt_rrrf_reset(firfilt_rrrf _q)
int firfilt_rrrf_print(firfilt_rrrf _q)
int firfilt_rrrf_set_scale(firfilt_rrrf _q, float _scale)
int firfilt_rrrf_get_scale(firfilt_rrrf _q, float * _scale)
int firfilt_rrrf_push(firfilt_rrrf _q, float _x)
int firfilt_rrrf_write(firfilt_rrrf _q, float * _x, unsigned int _n)
int firfilt_rrrf_execute(firfilt_rrrf _q, float * _y)
int firfilt_rrrf_execute_one(firfilt_rrrf _q, float _x, float * _y)
int firfilt_rrrf_execute_block(firfilt_rrrf _q, float * _x, unsigned int _n, float * _y)
unsigned int firfilt_rrrf_get_length(firfilt_rrrf _q)
const float * firfilt_rrrf_get_coefficients(firfilt_rrrf _q)
int firfilt_rrrf_copy_coefficients(firfilt_rrrf _q, float * _h)
int firfilt_rrrf_freqresponse(firfilt_rrrf _q, float _fc, float complex * _H)
float firfilt_rrrf_groupdelay(firfilt_rrrf _q, float _fc)

Interfaces

firfilt_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_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_rrrf firfilt_rrrf_recreate(firfilt_rrrf _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_rrrf firfilt_rrrf_copy(firfilt_rrrf _q)

Copy object including all internal objects and state

int firfilt_rrrf_destroy(firfilt_rrrf _q)

Destroy filter object and free all internal memory

int firfilt_rrrf_reset(firfilt_rrrf _q)

Reset filter object's internal buffer

int firfilt_rrrf_print(firfilt_rrrf _q)

Print filter object information to stdout

int firfilt_rrrf_set_scale(firfilt_rrrf _q, float _scale)

Set output scaling for filter

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

int firfilt_rrrf_get_scale(firfilt_rrrf _q, float * _scale)

Get output scaling for filter

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

int firfilt_rrrf_push(firfilt_rrrf _q, float _x)

Push sample into filter object's internal buffer

  • _q : filter object
  • _x : single input sample

int firfilt_rrrf_write(firfilt_rrrf _q, float * _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_rrrf_execute(firfilt_rrrf _q, float * _y)

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

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

int firfilt_rrrf_execute_one(firfilt_rrrf _q, float _x, float * _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_rrrf_execute_block(firfilt_rrrf _q, float * _x, unsigned int _n, float * _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_rrrf_get_length(firfilt_rrrf _q)

Get length of filter object (number of internal coefficients)

const float * firfilt_rrrf_get_coefficients(firfilt_rrrf _q)

Get pointer to coefficients array

int firfilt_rrrf_copy_coefficients(firfilt_rrrf _q, float * _h)

Copy internal coefficients to external buffer

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

int firfilt_rrrf_freqresponse(firfilt_rrrf _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_rrrf_groupdelay(firfilt_rrrf _q, float _fc)

Compute and return group delay of filter object

  • _q : filter object
  • _fc : frequency to evaluate