Skip to main content

OfdmFrameStreamDemod

Struct OfdmFrameStreamDemod 

Source
pub struct OfdmFrameStreamDemod { /* private fields */ }
Expand description

Streaming OFDM frame receiver: push raw IQ with feed, poll completed frames (or typed errors). Mirrors Ft8StreamDecoder’s accumulate-and-drain shape.

Each feed accumulates samples, searches the buffer for a preamble via ofdm_sync, and — for a candidate with enough buffered samples — corrects CFO (Rotator), estimates the channel from the training symbol (OfdmEqualizer), decodes the frame, and drains its samples from the buffer, looping to drain multiple frames. A frame whose payload has not fully arrived is held until a later feed completes it.

Implementations§

Source§

impl OfdmFrameStreamDemod

Source

pub fn new(cfg: OfdmConfig, mcs_table: McsTable, preamble: OfdmPreamble) -> Self

Creates a streaming receiver with a fresh, private CodecCache; use with_cache to share one with a modulator.

Source

pub fn with_cache( cfg: OfdmConfig, mcs_table: McsTable, preamble: OfdmPreamble, cache: Arc<CodecCache>, ) -> Self

Like new, but reuses the caller-provided cache so a modulator/demodulator pair sharing one Arc<CodecCache> builds each FEC code only once between them.

Source

pub fn with_score_threshold(self, t: f32) -> Self

Overrides the sync-score acceptance threshold (default 0.5).

Source

pub fn with_channel_estimate(self, on: bool) -> Self

Carries the per-bin channel estimate on each frame’s diagnostics. Off by default — it costs an n_fft-sized allocation per frame, which only a caller measuring channel response wants to pay.

Requires the preamble to carry a training symbol; without one there is nothing to estimate from and the field stays None.

Source

pub fn with_error_rates(self, on: bool) -> Self

Measures true bit error rates at the inner decoder’s input and output, reported as channel_ber and inner_ber. Off by default.

Works by re-encoding each successfully decoded frame: a frame that passed its CRC is ground truth, so the re-encode reconstructs what the transmitter sent and the difference from what arrived is a real error rate. No prior knowledge of the payload is required, which is what makes this usable over the air rather than only against a known test vector.

Only frames that decode are measured — an undecodable frame has no ground truth, so a rising error rate that suddenly stops reporting is itself the signal that the link has given up.

Costs one encode per decoded frame.

Source

pub fn len(&self) -> usize

Accumulated (not-yet-consumed) sample count.

Source

pub fn is_empty(&self) -> bool

Source

pub fn view_buf(&self) -> &[C32]

Read-only view of the accumulated IQ buffer.

Source

pub fn clear(&mut self)

Discards all accumulated samples.

Source

pub fn feed(&mut self, iq: &[C32]) -> Vec<Result<RxFrame, RxError>>

Feeds IQ samples and returns any frames (or errors) that completed.

Source

pub fn flush(&mut self) -> Vec<Result<RxFrame, RxError>>

Runs a final decode pass over the residual buffer (e.g. at end of stream). Same semantics as feed with no new samples.

Source

pub fn feed_probed( &mut self, iq: &[C32], probe: &mut OfdmRxProbe, ) -> Vec<Result<RxFrame, RxError>>

feed, additionally filling probe with each frame’s equalized payload symbols and per-coded-bit correction map — the two quantities a constellation / decoder display needs. See OfdmRxProbe.

probe is cleared first, then refilled with everything this call produced; its allocations are retained, so probing a steady stream does not reallocate.

The gate is the choice of method, not a flag. There is no want_probe field, so the unprobed feed gains no runtime branch and no receiver state can disagree with what the caller believes it enabled. A viewer that toggles its pane simply calls the other method.

Costs, per frame: one encode chain (the same one with_error_rates runs — asking for both pays for it once), one further inner encode to re-derive what the decoder decided, and two buffer fills. Frames that fail their payload CRC still contribute their symbols, with an empty correction map; frames whose header fails never reach the payload demapper and contribute nothing.

A dvb_t_scattered link reports no probe frames at all: its demap path collects no symbols here. That is routing rather than absence — a DVB-T receiver has its own equivalent, and this is the wrong object to instrument it with. Use DvbTFrameStreamDemod::feed_probed with a DvbTRxProbe, and read its quality ladder from DvbTRxDiagnostics.

Source

pub fn flush_probed( &mut self, probe: &mut OfdmRxProbe, ) -> Vec<Result<RxFrame, RxError>>

flush with the probe of feed_probed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.