Skip to main content

Puncturer

Struct Puncturer 

Source
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

Source

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.

Source

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$.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

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).

Source

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).

Source

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.

Source

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());
Source

pub fn n_out(&self) -> usize

Outputs per step $n$ (the rows of the pattern).

Source

pub fn period(&self) -> usize

The period $P$ (the columns of the pattern).

Source

pub fn kept_per_period(&self) -> usize

The bits kept per period $w$.

Source

pub fn keeps(&self, step: usize, i: usize) -> bool

Whether output i of step step is transmitted.

Source

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$.

Source

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$.

Source

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$.

Source

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.

Trait Implementations§

Source§

impl Clone for Puncturer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Puncturer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Puncturer

Source§

impl PartialEq for Puncturer

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Puncturer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.