Struct futuredsp::fir::PolyphaseResamplingFirKernel
source · [−]pub struct PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
TA: TapsAccessor<TapType = TT>, { /* private fields */ }
Expand description
A rational resampling polyphase FIR filter. For every input value, this filter
produces interp/decim
output samples. The length of taps
must be divisible by interp
.
For the best performance, interp
and decim
should be relatively prime.
If decim=1
, then the filter is a pure interpolator. If interp=1
, then the filter
is a pure decimator.
The specified FIR filter H(z)
is split into interp
polyphase components
E_0(z), E_1(z), ..., E_(interp-1)(z)
, such that
H(z) = E_0(z^interp) + z^(-1)E_1(z^interp) + ... + z^(-(interp-1))E_(interp-1)(z^interp)
The taps for each polyphase component are given by e_l(n) = h(l*n+l)
for 0 <= l <= interp-1
.
Implementations of this core exist for the following combinations:
f32
samples,f32
taps.Complex<f32>
samples,f32
taps.
Example usage:
use futuredsp::UnaryKernel;
use futuredsp::fir::PolyphaseResamplingFirKernel;
let decim = 2;
let interp = 3;
let taps = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
let fir = PolyphaseResamplingFirKernel::<f32, f32, _, _>::new(interp, decim, taps);
let input = [1.0, 2.0, 3.0];
let mut output = [0.0; 3];
fir.work(&input, &mut output);
Implementations
sourceimpl<InputType, OutputType, TA, TT> PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
TA: TapsAccessor<TapType = TT>,
impl<InputType, OutputType, TA, TT> PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
TA: TapsAccessor<TapType = TT>,
Trait Implementations
sourceimpl<TA: TapsAccessor<TapType = f32>> UnaryKernel<Complex<f32>, Complex<f32>> for PolyphaseResamplingFirKernel<Complex<f32>, Complex<f32>, TA, f32>
impl<TA: TapsAccessor<TapType = f32>> UnaryKernel<Complex<f32>, Complex<f32>> for PolyphaseResamplingFirKernel<Complex<f32>, Complex<f32>, TA, f32>
sourcefn work(
&self,
i: &[Complex<f32>],
o: &mut [Complex<f32>]
) -> (usize, usize, ComputationStatus)
fn work(
&self,
i: &[Complex<f32>],
o: &mut [Complex<f32>]
) -> (usize, usize, ComputationStatus)
Computes the kernel on the given input, outputting into the given
output. For a UnaryKernel
, kernels will not have internal memory - in
particular, this means that a single instantiated kernel does not need
to be reserved for a single stream of data. Read more
sourceimpl<TA: TapsAccessor<TapType = f32>> UnaryKernel<f32, f32> for PolyphaseResamplingFirKernel<f32, f32, TA, f32>
impl<TA: TapsAccessor<TapType = f32>> UnaryKernel<f32, f32> for PolyphaseResamplingFirKernel<f32, f32, TA, f32>
sourcefn work(&self, i: &[f32], o: &mut [f32]) -> (usize, usize, ComputationStatus)
fn work(&self, i: &[f32], o: &mut [f32]) -> (usize, usize, ComputationStatus)
Computes the kernel on the given input, outputting into the given
output. For a UnaryKernel
, kernels will not have internal memory - in
particular, this means that a single instantiated kernel does not need
to be reserved for a single stream of data. Read more
Auto Trait Implementations
impl<InputType, OutputType, TA, TT> RefUnwindSafe for PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
InputType: RefUnwindSafe,
OutputType: RefUnwindSafe,
TA: RefUnwindSafe,
impl<InputType, OutputType, TA, TT> Send for PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
InputType: Send,
OutputType: Send,
impl<InputType, OutputType, TA, TT> Sync for PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
InputType: Sync,
OutputType: Sync,
TA: Sync,
impl<InputType, OutputType, TA, TT> Unpin for PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
InputType: Unpin,
OutputType: Unpin,
TA: Unpin,
impl<InputType, OutputType, TA, TT> UnwindSafe for PolyphaseResamplingFirKernel<InputType, OutputType, TA, TT> where
InputType: UnwindSafe,
OutputType: UnwindSafe,
TA: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more