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§
Required Methods§
sourcefn process_block<'a>(
&mut self,
x: Option<&[Self::Item]>,
y: &'a mut [Self::Item],
) -> &'a mut [Self::Item]
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.
sourcefn block_size(&self) -> (usize, usize)
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.
sourcefn response_length(&self) -> usize
fn response_length(&self) -> usize
Finite impulse response length in numer of output items minus one Get this many to drain all previous memory