pub struct Puncturer { /* private fields */ }Expand description
A periodic puncturing pattern over the $n$ outputs of a code (see the module).
Implementations§
Source§impl Puncturer
impl Puncturer
Sourcepub fn new(pattern: &[&[u8]]) -> Result<Puncturer>
pub fn new(pattern: &[&[u8]]) -> Result<Puncturer>
The puncturer of a pattern given by rows: pattern[i][p] is 1 when the output
i is kept at the steps of phase p.
§Errors
comnum_core::Error::Config for no row, rows of different or zero length, an entry
other than 0 or 1, or a pattern that keeps nothing.
Sourcepub fn identity(n_out: usize) -> Result<Puncturer>
pub fn identity(n_out: usize) -> Result<Puncturer>
The pattern that keeps every bit of a rate-$1/n$ code.
§Errors
comnum_core::Error::Config for $n = 0$.
Sourcepub fn ieee80211_2_3() -> Puncturer
pub fn ieee80211_2_3() -> Puncturer
Rate 2/3 of IEEE 802.11-2020, Sec. 17.3.5.6, Figure 17-9: A 1 1, B 1 0.
Sourcepub fn ieee80211_3_4() -> Puncturer
pub fn ieee80211_3_4() -> Puncturer
Rate 3/4 of IEEE 802.11-2020, Sec. 17.3.5.6, Figure 17-9: A 1 1 0, B 1 0 1.
Sourcepub fn ieee80211_5_6() -> Puncturer
pub fn ieee80211_5_6() -> Puncturer
Rate 5/6 of IEEE 802.11-2020, Sec. 19.3.11.6, Figure 19-11: A 1 1 0 1 0, B 1 0 1 0 1.
Sourcepub fn dvbs_2_3() -> Puncturer
pub fn dvbs_2_3() -> Puncturer
Rate 2/3 of ETSI EN 300 421 V1.1.2, Table 2: X 1 0, Y 1 1 (rows Y, X: see the module),
the pattern of Puncturer::ieee80211_2_3 (an alias, under the name of the
standard).
Sourcepub fn dvbs_3_4() -> Puncturer
pub fn dvbs_3_4() -> Puncturer
Rate 3/4 of ETSI EN 300 421 V1.1.2, Table 2: X 1 0 1, Y 1 1 0 (rows Y, X), the pattern
of Puncturer::ieee80211_3_4 (an alias).
Sourcepub fn dvbs_5_6() -> Puncturer
pub fn dvbs_5_6() -> Puncturer
Rate 5/6 of ETSI EN 300 421 V1.1.2, Table 2: X 1 0 1 0 1, Y 1 1 0 1 0 (rows Y, X), the
pattern of Puncturer::ieee80211_5_6 (an alias).
Sourcepub fn dvbs_7_8() -> Puncturer
pub fn dvbs_7_8() -> Puncturer
Rate 7/8 of ETSI EN 300 421 V1.1.2, Table 2: X 1 0 0 0 1 0 1, Y 1 1 1 1 0 1 0 (rows Y, X).
Sourcepub fn turbo_1_2() -> Puncturer
pub fn turbo_1_2() -> Puncturer
The rate-1/2 turbo code of Berrou, Glavieux & Thitimajshima (1993), Sec. II: the
systematic bits and the parity bits of the two encoders alternately
(systematic 1 1, parity 1: 1 0, parity 2: 0 1), for PuncturedTurbo.
Sourcepub fn from_name(name: &str) -> Result<Puncturer>
pub fn from_name(name: &str) -> Result<Puncturer>
The pattern of a name: ieee80211_2_3, ieee80211_3_4, ieee80211_5_6,
dvbs_2_3, dvbs_3_4, dvbs_5_6, dvbs_7_8 (the convolutional codes) or
turbo_1_2 (the turbo codes), case-insensitive: the constructors of the same
names.
§Errors
comnum_core::Error::Config for another name.
§Examples
use comnum_fec::puncture::Puncturer;
assert_eq!(Puncturer::from_name("dvbs_7_8")?, Puncturer::dvbs_7_8());
assert!(Puncturer::from_name("dvbs_9_10").is_err());Sourcepub fn kept_per_period(&self) -> usize
pub fn kept_per_period(&self) -> usize
The bits kept per period $w$.
Sourcepub fn keeps(&self, step: usize, i: usize) -> bool
pub fn keeps(&self, step: usize, i: usize) -> bool
Whether output i of step step is transmitted.
Sourcepub fn punctured_len(&self, n_coded: usize) -> Result<usize>
pub fn punctured_len(&self, n_coded: usize) -> Result<usize>
The number of transmitted bits of n_coded coded bits.
§Errors
comnum_core::Error::Shape if n_coded is not a multiple of $n$.
Sourcepub fn selection(&self, n_coded: usize) -> Result<BitSelection>
pub fn selection(&self, n_coded: usize) -> Result<BitSelection>
The transmitted bits of n_coded coded bits in step-major order, as a
BitSelection.
§Errors
comnum_core::Error::Shape if n_coded is not a multiple of $n$.
Sourcepub fn puncture(&self, bits: &[u8]) -> Result<Vec<u8>>
pub fn puncture(&self, bits: &[u8]) -> Result<Vec<u8>>
The transmitted bits of coded bits in step-major order (the $n$ outputs of step 0, then of step 1, …).
§Errors
comnum_core::Error::Shape if the number of bits is not a multiple of $n$.
Sourcepub fn depuncture(&self, llr: &[f64], n_coded: usize) -> Result<Vec<f64>>
pub fn depuncture(&self, llr: &[f64], n_coded: usize) -> Result<Vec<f64>>
The LLRs of the n_coded coded bits from the LLRs of the transmitted ones: a
zero at every punctured position.
§Errors
comnum_core::Error::Shape if n_coded is not a multiple of $n$ or llr does
not have Puncturer::punctured_len values.