Skip to main content

ResidualSource

Trait ResidualSource 

Source
pub trait ResidualSource {
    // Required methods
    fn residual_norms(&self) -> &[f32];
    fn snr_estimate_db(&self) -> f32;
    fn sample_count(&self) -> usize;
}
Expand description

A source of residual norm observations.

Implementors provide access to a contiguous slice of f32 residual norms. This is the zero-copy interface between the platform’s IQ data path and the DSFB engine.

§Example: DMA Buffer Source

struct DmaResidualSource {
    buffer: &'static [f32],  // memory-mapped DMA region
    len: usize,
}

impl ResidualSource for DmaResidualSource {
    fn residual_norms(&self) -> &[f32] {
        &self.buffer[..self.len]
    }
    fn snr_estimate_db(&self) -> f32 { 15.0 }
    fn sample_count(&self) -> usize { self.len }
}

Required Methods§

Source

fn residual_norms(&self) -> &[f32]

Borrow the current residual norm buffer as an immutable slice.

This is the zero-copy tap point. The DSFB engine reads from this slice without copying. The source retains ownership.

Source

fn snr_estimate_db(&self) -> f32

Current SNR estimate in dB. Return f32::NAN if unknown.

Source

fn sample_count(&self) -> usize

Number of valid samples in the current buffer.

Implementors§