use super::tables;
mod sealed {
pub trait Sealed {}
}
pub trait LdpcParams: sealed::Sealed + Copy + Default + 'static {
const N: usize;
const K: usize;
const M: usize;
const MAX_ROW: usize;
fn mn(bit: usize) -> [u8; 3];
fn nm(check: usize, slot: usize) -> u8;
fn nrw(check: usize) -> u8;
fn gen_parity(row: usize, col: usize) -> u8;
}
#[derive(Copy, Clone, Debug, Default)]
pub struct Ldpc174_91Params;
impl sealed::Sealed for Ldpc174_91Params {}
impl LdpcParams for Ldpc174_91Params {
const N: usize = 174;
const K: usize = 91;
const M: usize = 83;
const MAX_ROW: usize = 7;
#[inline]
fn mn(bit: usize) -> [u8; 3] {
tables::MN[bit]
}
#[inline]
fn nm(check: usize, slot: usize) -> u8 {
tables::NM[check][slot]
}
#[inline]
fn nrw(check: usize) -> u8 {
tables::NRW[check]
}
#[inline]
fn gen_parity(row: usize, col: usize) -> u8 {
super::osd::GEN_PARITY[row][col]
}
}
#[derive(Copy, Clone, Debug, Default)]
pub struct Ldpc240_101Params;
impl sealed::Sealed for Ldpc240_101Params {}
impl LdpcParams for Ldpc240_101Params {
const N: usize = 240;
const K: usize = 101;
const M: usize = 139;
const MAX_ROW: usize = 6;
#[inline]
fn mn(bit: usize) -> [u8; 3] {
crate::fec::ldpc240_101::tables::MN[bit]
}
#[inline]
fn nm(check: usize, slot: usize) -> u8 {
crate::fec::ldpc240_101::tables::NM[check][slot]
}
#[inline]
fn nrw(check: usize) -> u8 {
crate::fec::ldpc240_101::tables::NRW[check]
}
#[inline]
fn gen_parity(row: usize, col: usize) -> u8 {
crate::fec::ldpc240_101::tables::GEN_PARITY[row][col]
}
}
#[derive(Copy, Clone, Debug, Default)]
pub struct Ldpc128_90Params;
impl sealed::Sealed for Ldpc128_90Params {}
impl LdpcParams for Ldpc128_90Params {
const N: usize = 128;
const K: usize = 90;
const M: usize = 38;
const MAX_ROW: usize = 11;
#[inline]
fn mn(bit: usize) -> [u8; 3] {
crate::fec::ldpc_128_90::tables::MN[bit]
}
#[inline]
fn nm(check: usize, slot: usize) -> u8 {
crate::fec::ldpc_128_90::tables::NM[check][slot]
}
#[inline]
fn nrw(check: usize) -> u8 {
crate::fec::ldpc_128_90::tables::NRW[check]
}
#[inline]
fn gen_parity(row: usize, col: usize) -> u8 {
crate::fec::ldpc_128_90::tables::GEN_PARITY[row][col]
}
}