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
impl OfdmFrameStreamDemod
Sourcepub fn new(cfg: OfdmConfig, mcs_table: McsTable, preamble: OfdmPreamble) -> Self
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.
Sourcepub fn with_cache(
cfg: OfdmConfig,
mcs_table: McsTable,
preamble: OfdmPreamble,
cache: Arc<CodecCache>,
) -> Self
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.
Sourcepub fn with_score_threshold(self, t: f32) -> Self
pub fn with_score_threshold(self, t: f32) -> Self
Overrides the sync-score acceptance threshold (default 0.5).
Sourcepub fn with_channel_estimate(self, on: bool) -> Self
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.
Sourcepub fn with_error_rates(self, on: bool) -> Self
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.
pub fn is_empty(&self) -> bool
Sourcepub fn feed(&mut self, iq: &[C32]) -> Vec<Result<RxFrame, RxError>>
pub fn feed(&mut self, iq: &[C32]) -> Vec<Result<RxFrame, RxError>>
Feeds IQ samples and returns any frames (or errors) that completed.
Sourcepub fn flush(&mut self) -> Vec<Result<RxFrame, RxError>>
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.
Sourcepub fn feed_probed(
&mut self,
iq: &[C32],
probe: &mut OfdmRxProbe,
) -> Vec<Result<RxFrame, RxError>>
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.
Sourcepub fn flush_probed(
&mut self,
probe: &mut OfdmRxProbe,
) -> Vec<Result<RxFrame, RxError>>
pub fn flush_probed( &mut self, probe: &mut OfdmRxProbe, ) -> Vec<Result<RxFrame, RxError>>
flush with the probe of feed_probed.