Skip to main content

FecCodec

Trait FecCodec 

Source
pub trait FecCodec: Default + 'static {
    const N: usize;
    const K: usize;

    // Required methods
    fn encode(&self, info: &[u8], codeword: &mut [u8]);
    fn decode_soft(&self, llr: &[f32], opts: &FecOpts<'_>) -> Option<FecResult>;
}
Expand description

Forward-error-correction codec: maps K information bits ↔ N codeword bits.

Implementors MUST be Default-constructible so generic pipeline code can obtain an instance via P::Fec::default() without plumbing state. Stateless codecs (matrices in const / static) are the common case.

Required Associated Constants§

Source

const N: usize

Codeword length.

Source

const K: usize

Information-bit length.

Required Methods§

Source

fn encode(&self, info: &[u8], codeword: &mut [u8])

Systematic encode: info.len() == K, codeword.len() == N. The first K bits of codeword must equal info (systematic form).

Source

fn decode_soft(&self, llr: &[f32], opts: &FecOpts<'_>) -> Option<FecResult>

Soft-decision decode from log-likelihood ratios.

llr.len() == N. On success returns the K information bits plus decoder statistics. On failure returns None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl FecCodec for ConvFano232

Source§

const N: usize = 206

Source§

const K: usize = 72

Source§

impl FecCodec for ConvFano

Source§

const N: usize = 162

Source§

const K: usize = 50

Source§

impl FecCodec for Ldpc240_101

Source§

const N: usize = LDPC_N

Source§

const K: usize = LDPC_K

Source§

impl FecCodec for Ldpc174_91

Source§

const N: usize = LDPC_N

Source§

const K: usize = LDPC_K

Source§

impl FecCodec for Rs63_12

Source§

impl FecCodec for Q65Fec