Struct sdr::fir::FIR
[−]
[src]
pub struct FIR<T: SampleType> { /* fields omitted */ }
FIR filter.
Methods
impl<T: SampleType> FIR<T>
[src]
pub fn new(taps: &[T::TapType], decimate: usize, interpolate: usize) -> FIR<T>
[src]
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).
pub fn from_gains(
n_taps: usize,
gains: &[f64],
decimate: usize,
interpolate: usize
) -> FIR<T>
[src]
n_taps: usize,
gains: &[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.
pub fn cic_compensator(
n_taps: usize,
q: usize,
r: usize,
decimate: usize
) -> FIR<T>
[src]
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.
pub fn from_rcf(b: f64, t: usize, w: usize) -> FIR<T>
[src]
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).
pub fn resampler(n_taps: usize, decimate: usize, interpolate: usize) -> FIR<T>
[src]
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).
pub fn lowpass(n_taps: usize, cutoff: f64) -> FIR<T>
[src]
Create a new FIR low pass filter with specified cutoff frequency (in normalised frequency, e.g. in the range 0.0 to 0.5).
pub fn highpass(n_taps: usize, cutoff: f64) -> FIR<T>
[src]
Create a new FIR high pass filter with specified cutoff frequency (in normalised frequency, e.g. in the range 0.0 to 0.5).
pub fn bandpass(n_taps: usize, f_low: f64, f_high: f64) -> FIR<T>
[src]
Create a new FIR band pass filter with specified passband frequencies (in normalised frequency, e.g. in the range 0.0 to 0.5).
pub fn bandstop(n_taps: usize, f_low: f64, f_high: f64) -> FIR<T>
[src]
Create a new FIR band stop filter with specified stopband frequencies (in normalised frequency, e.g. in the range 0.0 to 0.5).
pub fn taps(&self) -> &Vec<T::TapType>
[src]
Return a reference to the filter's taps.
pub fn process(&mut self, x: &[T]) -> Vec<T>
[src]
Process a block of data x, outputting the filtered and possibly decimated data.
Trait Implementations
Auto Trait Implementations
impl<T> Send for FIR<T> where
<T as SampleType>::AccType: Send,
<T as SampleType>::TapType: Send,
<T as SampleType>::AccType: Send,
<T as SampleType>::TapType: Send,
impl<T> Sync for FIR<T> where
<T as SampleType>::AccType: Sync,
<T as SampleType>::TapType: Sync,
<T as SampleType>::AccType: Sync,
<T as SampleType>::TapType: Sync,