nrLDPCDecode

Low-density parity-check (LDPC) decoding

Description

[out,actNumIter,finalParityChecks] = nrLDPCDecode(in,bgn,maxNumIter) returns the LDPC-decoded output matrix out for the input data matrix in, base graph number bgn, and maximum number of decoding iterations maxNumIter. The function also returns the actual number of iterations actNumIter and the final parity checks per codeword finalParityChecks.

The decoder uses the sum-product message-passing algorithm. The data bits must be LDPC-encoded as defined in TS 38.212 Section 5.3.2 [1].

example

[out,actNumIter,finalParityChecks] = nrLDPCDecode(___,Name,Value) specifies optional name-value pair arguments, in addition to the input arguments in the previous syntax.

Examples

collapse all

Create transmit data consisting of two code block segments of length 2560 and 36 filler bits at the end.

C = 2;          
K = 2560;       
F = 36;    
txcbs = ones(K-F,C);
fillers = -1*ones(F,C);
txcbs = [txcbs;fillers];                

Generate LDPC codeword for the transmit data. Use base graph number two.

bgn = 2; 
txcodedcbs = nrLDPCEncode(txcbs,bgn);   

Convert transmit data to soft bits. Fillers in the transmit data do not have log likelihood ratio (LLR) soft bits.

rxcodedcbs = double(1-2*txcodedcbs);    
FillerIndices = find(txcodedcbs(:,1) == -1);
rxcodedcbs(FillerIndices,:) = 0;        

Decode the encoded codeword with a maximum of 25 iterations.

[rxcbs,actualniters] = nrLDPCDecode(rxcodedcbs,bgn,25);  

Replace filler bits with zero in transmit data and compare the results of encoding and decoding.

txcbs(end-F+1:end,:) = 0;    
isequal(rxcbs,txcbs)                
ans = logical
   1

actualniters
actualniters = 1×2

     1     1

Input Arguments

collapse all

Rate recovered soft bits for input code block segments, specified as a matrix. The number of columns in in is equal to the number of scheduled code block segments. The number of rows in in is equal to the length of the codeword, with some systematic bits punctured.

Data Types: double | single

Base graph number, specified as 1 or 2. The value selects one of the two base graphs defined in TS 38.212 Section 5.3.2 [1].

Data Types: double

Maximum number of decoding iterations, specified as a scalar. The decoding is terminated when all parity checks are satisfied, or after maxNumIter number of iterations.

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: [out,actNumIter,finalParityChecks] = nrLDPCDecode(in,bgn,maxNumIter,'DecisionType','hard')

Output format, specified as the comma-separated pair consisting of 'OutputFormat' and one of these values:

  • 'info' — The number of rows in out is equal to the length of the information bits.

  • 'whole' — The number of rows in out is equal to the length of the codeword.

Data Types: char | string

Decision method used for decoding, specified as the comma-separated pair consisting of 'DecisionType' and one of these values:

  • 'hard' — The data type of out is int8.

  • 'soft' — The output out contains log-likelihood ratios of the same data type as in.

Data Types: char | string

LDPC decoding algorithm, specified as the comma-separated pair consisting of 'Algorithm' and one of these values:

  • 'Belief propagation' — Use this option to specify the belief-passing or message-passing algorithm. For more information, see Belief Propagation Decoding.

  • 'Layered belief propagation' — Use this option to specify the layered belief-passing algorithm, which is suitable for quasi-cyclic parity-check matrices (PCMs). For more information, see Layered Belief Propagation Decoding.

  • 'Normalized min-sum' — Use this option to specify the layered belief propagation algorithm with normalized min-sum approximation. For more information, see Normalized Min-Sum Decoding.

  • 'Offset min-sum' — Use this option to specify the layered belief propagation algorithm with offset min-sum approximation. For more information, see Offset Min-Sum Decoding.

Data Types: char | string

Scaling factor for normalized min-sum decoding, specified as the comma-separated pair consisting of 'ScalingFactor' and a real scalar in the range (0, 1].

Dependencies

To enable this name-value pair argument, set the 'Algorithm' name-value pair argument to 'Normalized min-sum'.

Data Types: double

Offset for offset min-sum decoding, specified as the comma-separated pair consisting of 'Offset' and a nonnegative finite real scalar.

Dependencies

To enable this name-value pair argument, set the 'Algorithm' name-value pair argument to 'Offset min-sum'.

Data Types: double

Decoding termination criteria, specified as the comma-separated pair consisting of 'Termination' and one of these values:

  • 'early' — The decoding terminates when all parity checks are satisfied or after maxNumIter number of iterations.

  • 'max' — The decoding terminates after maxNumIter number of iterations.

Data Types: char | string

Output Arguments

collapse all

Decoded LDPC codeword or information bits, returned as a matrix. The number of columns in out is equal to the number of scheduled code block segments. The number of rows in out depends on the name-value pair argument 'OutputFormat'. The data type of out depends on the name-value pair argument 'DecisionType'.

Data Types: single | double | int8

Actual number of iterations, returned as a row vector of positive integers. The length of actNumIter is equal to the number of columns in in. The ith element in actNumIter corresponds to the actual number of iterations executed for the ith column of in.

Data Types: double

Final parity checks, returned as a matrix. The number of rows in finalParityChecks is equal to the number of parity-check bits in an LDPC codeword. The ith column in finalParityChecks corresponds to the final parity checks for the ith codeword.

Data Types: double

Algorithms

collapse all

The nrLDPCDecode function supports these four LDPC decoding algorithms.

Belief Propagation Decoding

The implementation of the belief propagation algorithm is based on the decoding algorithm presented in [2]. For transmitted LDPC-encoded codeword, c, where c=(c0,c1,...,cn1), the input to the LDPC decoder is the log-likelihood ratio (LLR) value L(ci)=log(Pr(ci=0|channel output for ci)Pr(ci=1|channel output for ci)).

In each iteration, the key components of the algorithm are updated based on these equations:

L(rji)=2atanh(iVj\itanh(12L(qij))),

L(qij)=L(ci)+jCi\jL(rji), initialized as L(qij)=L(ci) before the first iteration, and

L(Qi)=L(ci)+jCiL(rji).

At the end of each iteration, L(Qi) is an updated estimate of the LLR value for the transmitted bit ci. The value L(Qi) is the soft-decision output for ci. If L(Qi)<0, the hard-decision output for ci is 1. Otherwise, the output is 0.

Index sets Ci\j and Vj\i are based on the parity-check matrix (PCM). Index sets Ci and Vj correspond to all nonzero elements in column i and row j of the PCM, respectively.

This figure highlights the computation of these index sets in a given PCM for i = 5 and j = 3.

To avoid infinite numbers in the algorithm equations, atanh(1) and atanh(-1) are set to 19.07 and –19.07, respectively. Due to finite precision, MATLAB® returns 1 for tanh(19.07) and –1 for tanh(–19.07).

When the name-value pair argument 'Termination' is set to 'max', the decoding terminates after maxNumIter number of iterations. When 'Termination' is set to 'early', the decoding terminates when all parity checks are satisfied (HcT=0) or after maxNumIter number of iterations.

Layered Belief Propagation Decoding

The implementation of the layered belief propagation algorithm is based on the decoding algorithm presented in [3], Section II.A. The decoding loop iterates over subsets of rows (layers) of the PCM. For each row, m, in a layer and each bit index, j, the implementation updates the key components of the algorithm based on these equations:

(1) L(qmj)=L(qj)Rmj,

(2) Amj=n  N(m)njψ(L(qmn)),

(3) smj=n  N(m)njsign(L(qmn)),

(4) Rmj=smjψ(Amj), and

(5) L(qj)=L(qmj)+Rmj.

For each layer, the decoding equation (5) works on the combined input obtained from the current LLR inputs L(qmj) and the previous layer updates Rmj.

Because only a subset of the nodes is updated in a layer, the layered belief propagation algorithm is faster compared to the belief propagation algorithm. To achieve the same error rate as attained with belief propagation decoding, use half the number of decoding iterations when using the layered belief propagation algorithm.

Normalized Min-Sum Decoding

The implementation of the normalized min-sum decoding algorithm follows the layered belief propagation algorithm with equation (2) replaced by

Amj=minn  N(m)nj(|L(qmn) |α),

where α is in the range (0, 1] and is the scaling factor specified by ScalingFactor. This equation is an adaptation of equation (4) presented in [4].

Offset Min-Sum Decoding

The implementation of the offset min-sum decoding algorithm follows the layered belief propagation algorithm with equation (2) replaced by

Amj =  max(minn  N(m)nj (|L(qmn)| β), 0),

where β ≥ 0 and is the offset specified by Offset. This equation is an adaptation of equation (5) presented in [4].

References

[1] 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[2] Gallager, Robert G. Low-Density Parity-Check Codes, Cambridge, MA, MIT Press, 1963.

[3] Hocevar, D.E. "A reduced complexity decoder architecture via layered decoding of LDPC codes." In IEEE Workshop on Signal Processing Systems, 2004. SIPS 2004. doi: 10.1109/SIPS.2004.1363033

[4] Chen, Jinghu, R.M. Tanner, C. Jones, and Yan Li. "Improved min-sum decoding algorithms for irregular LDPC codes." In Proceedings. International Symposium on Information Theory, 2005. ISIT 2005. doi: 10.1109/ISIT.2005.1523374

Extended Capabilities

Introduced in R2018b