Trait idsp::hbf::Filter

source ·
pub trait Filter {
    type Item;

    // Required methods
    fn process_block<'a>(
        &mut self,
        x: Option<&[Self::Item]>,
        y: &'a mut [Self::Item],
    ) -> &'a mut [Self::Item];
    fn block_size(&self) -> (usize, usize);
    fn response_length(&self) -> usize;
}
Expand description

Filter input items into output items.

Required Associated Types§

source

type Item

Input/output item type.

Required Methods§

source

fn process_block<'a>( &mut self, x: Option<&[Self::Item]>, y: &'a mut [Self::Item], ) -> &'a mut [Self::Item]

Process a block of items.

Input items can be either in x or in y. In the latter case the filtering operation is done in-place. Output is always written into y. The slice of items written into y is returned. Input and output size relations must match the filter requirements (decimation/interpolation and maximum block size). When using in-place operation, y needs to contain the input items (fewer than y.len() in the case of interpolation) and must be able to contain the output items.

source

fn block_size(&self) -> (usize, usize)

Return the block size granularity and the maximum block size.

For in-place processing, this refers to constraints on y. Otherwise this refers to the larger of x and y (x for decimation and y for interpolation). The granularity is also the rate change in the case of interpolation/decimation filters.

source

fn response_length(&self) -> usize

Finite impulse response length in numer of output items minus one Get this many to drain all previous memory

Implementors§

source§

impl Filter for HbfDecCascade

source§

impl Filter for HbfIntCascade

source§

impl<'a, T: Copy + Zero + Add + Mul<Output = T> + Sum + Half, const M: usize, const N: usize> Filter for HbfDec<'a, T, M, N>

source§

type Item = T

source§

impl<'a, T: Copy + Zero + Add + Mul<Output = T> + Sum, const M: usize, const N: usize> Filter for HbfInt<'a, T, M, N>

source§

type Item = T