Deterministic size accounting for one logical block’s coding chain, so the
transmitter and receiver agree on every intermediate length (needed to trim
interleaver/fragmentation zero-padding on receive) and on how many OFDM
symbols the coded bits occupy.
A modulation-and-coding scheme: the payload’s constellation plus its inner
and outer FEC. Selected per-frame by FrameMetadata::mcs_index via an
McsTable.
Fixed information-bit block size for the outer BCH code (per shortened
codeword). Chosen so one codeword fits comfortably within GF(2^8)’s length
bound (n = k + parity ≤ 255) for the t values used here.
Computes the BlockPlan for info_bytes under the given coding chain,
reusing constructed code objects from cache (their dimensions are all this
needs, but sharing the cache avoids rebuilding them here and in the
encode/decode passes).
Runs the full encode chain for one logical block (header or payload):
bytes → CRC → [scramble if before] → outer → outer-interleave → inner → inner-interleave → [scramble if after], returning coded bits ready to map.
Encodes info_bits through the inner code, returning coded bits. The info
bit stream is fragmented into K-bit blocks, each encoded into one N-bit
codeword (final block zero-padded). None passes through.
Applies a block interleaver to bits in place-by-value: writes bit i of
each padded block row-major and reads column-major. Returns the interleaved
bits plus the block size used, so the deinterleaver can trim padding.
Encodes message_bytes through the outer code (byte domain), returning the
coded bits (MSB-first). The message bit stream is fragmented into
BCH_INFO_BITS-bit blocks, each encoded into one shortened BCH codeword;
the final block is zero-padded. None outer code passes the bytes through
as bits.
Applies the byte-domain whitener for kind to bytes in place (self-inverse,
so the same call scrambles and descrambles). Handles both the generic
Additive LFSR and DVB-T energy dispersal; a no-op for None. The
after-inner-FEC bit-domain scramble position uses the PnScrambler directly
(DVB-T energy dispersal is byte-domain / before-FEC only).
Builds a bare per-symbol OfdmConfig (no frame fields) for a given
constellation, sharing the base plan/fs/rf/gain. Used to drive OfdmMod
for the header (BPSK) and payload (MCS) symbol streams.