Struct sdr::fir::FIR [] [src]

pub struct FIR<T: SampleType> {
    // some fields omitted
}

FIR filter.

Methods

impl<T: SampleType> FIR<T>
[src]

fn new(taps: &Vec<T::TapType>, decimate: usize, interpolate: usize) -> FIR<T>

Create a new FIR with the given taps and decimation.

Taps should sum to T::gain() or close to it.

Set decimate=1 for no decimation, decimate=2 for /2, etc. Set interpolate=1 for no interpolation, interplate=2 for *2, etc. Note that if the number of taps is not a multiple of the interpolation ratio then they will be zero-padded at the end until they are.

Implements a polyphase FIR to do efficient decimation and interpolation (identical to a standard FIR when interpolate=1).

fn from_gains(n_taps: usize, gains: &Vec<f64>, decimate: usize, interpolate: usize) -> FIR<T>

Create a new FIR from a number of taps, desired frequency response (a 512-long vector from 0 to Nyquist freq) and decimation.

Set decimate=1 for no decimation, decimate=2 for /2, etc. Set interpolate=1 for no interpolation, interplate=2 for *2, etc.

fn cic_compensator(n_taps: usize, q: usize, r: usize, decimate: usize) -> FIR<T>

Create a new FIR that compensates for a CIC filter specified by q and r, optionally also cutting off the frequency response after Fs/(2*decimate) and having the FIR decimate by that factor.

Set decimate=1 for no decimation, decimate=2 for /2, etc.

TODO: Does not quite match results obtained in Python, with slightly worse simulated performance. Investigate.

fn from_rcf(b: f64, t: usize, w: usize) -> FIR<T>

Create a new FIR that implements a specified raised cosine filter, with rolloff factor b, reciprocal symbol rate t in normalised time (i.e. samples per symbol), and half-width w (in bit periods, i.e. how many periods of t to extend either side of centre).

fn resampler(n_taps: usize, decimate: usize, interpolate: usize) -> FIR<T>

Create a new FIR resampler, with frequency response suitable for the resampling ratio. n_taps should ideally be a multiple of interpolate (but will be zero-padded at the end if not).

fn taps(&self) -> &Vec<T::TapType>

Return a reference to the filter's taps.

fn process(&mut self, x: &Vec<T>) -> Vec<T>

Process a block of data x, outputting the filtered and possibly decimated data.