pub fn decoder(
code_bits_llr: &[f64],
interleaver: &Interleaver,
code_polynomials: &[usize],
decoding_algo: DecodingAlgo,
) -> Result<Vec<Bit>, Error>Expand description
Returns information bit decisions from PCCC decoder for given code bit LLR values.
§Parameters
-
code_bits_llr: Log-likelihood-ratio (LLR) values for the code bits. -
interleaver: Internal interleaver for the code. -
code_polynomials: Integer representations of the generator polynomials for the code. Must have lengthN >= 2for a PCCC code of rate1/(2*N-1). The first element is taken as the feedback polynomial (this corresponds to the systematic bit), and all subsequent ones as the feedforward polynomials (these correspond to the parity bits from each RSC encoder). For a code of constraint lengthL, the feedback polynomial must be in the range(2^(L-1), 2^L), and each feedforward polynomial must be in the range[1, 2^L)and different from the feedback polynomial. -
decoding_algo: Decoding algorithm to use, and associated number of turbo iterations.
§Returns
info_bits_hat: Decisions on the information bits.
§Errors
Returns an error if the number of code bit LLR values is incompatible with interleaver.length
or if code_polynomials is invalid. The latter condition holds if the number of code
polynomials is less than 2, if the first code polynomial is either 0 or a power of 2, or
if any subsequent code polynomial is either not in the range [1, 2^L) or equals the first
code polynomial; here, L is the positive integer such that the first code polynomial is in
the range (2^(L-1), 2^L).
§Examples
use pccc::{decoder, Bit, DecodingAlgo, Interleaver};
use Bit::{One, Zero};
let code_polynomials = [0o13, 0o15]; // Rate-1/3 PCCC in LTE
let interleaver = Interleaver::new(&[3, 0, 1, 2])?; // 4 information bits
let code_bits_llr = [
-1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0,
1.0, 1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0,
];
let info_bits_hat = decoder(
&code_bits_llr,
&interleaver,
&code_polynomials,
DecodingAlgo::LogMAP(8),
)?; // Log-MAP decoding with 8 turbo iterations
assert_eq!(info_bits_hat, [One, Zero, Zero, One]);