# Dual Threshold Self-Corrected Minimum Sum Algorithm for 5G LDPC Decoders
## 2 Basic Decoding Algorithm of LDPC Codes  
### BP Algorithm  
Among the decoding algorithms of LDPC codes, the BP algorithm has the most outstanding decoding performance, but the complexity is very high. For binary LDPC codes, by converting the probability operation in the algorithm to the log domain, the LLR (log-likelihood ratio) BP algorithm can be obtained. The LLR BP algorithm uses simple addition operations instead of complex multiplication operations, which greatly reduces the complexity of the decoding operations in the BP algorithm. For the convenience of description, the definitions of relevant variable symbols are shown in Table 1.  
The steps of the LLR BP algorithm can be summarized as follows:  
(1) Initialization  
Set the maximum number of iterations (\(I_{max}\)), for every variable node calculate the initial probability likelihood ratio message \(L(P_{i})\cdot(L(P_{i})=log\Big{(}\frac{Prob(i=0)}{Prob(i=1)}\Big{)}\)) that the channel passes to the variable node, set the initial message of the check nodes to 0, and then for each variable node \(i\) and its adjacent check node \(j\in C(i)\), set the initial message that the variable node sends to the check node as:  
\[L^{(0)}\Big{(}q_{ij}\Big{)}=L(P_{i}) \tag{1}\]  
(2) Iterative processing  
Step 1: Check Node Processing (CNP)  
For each check node \(j\) and its adjacent check nodes \(i\in R(j)\), at the \(l\)-th iteration the check node message is calculated as [22]:  
\[L^{(l)}\Big{(}q_{ij}\Big{)}=L(P_{i})+\sum_{j^{\prime}\in C_{i}\setminus j}L^{( l)}\Big{(}r_{j^{\prime}i}\Big{)} \tag{3}\]  
Step 3: Decision  
For every variable node, the decision message is calculated as [22]:  
\[L^{(l)}(q_{ij})=L(P_{i})+\sum_{j\in C_{i}}L^{(l)}\Big{(}r_{j}i\Big{)} \tag{4}\]  
Following this, a hard decision is performed. If \(L^{(l)}(q_{ij})>0\), then \(\dot{c}_{i}=0\), otherwise \(\dot{c}_{i}=1\).  
\begin{table}
\begin{tabular}{c l} \hline \hline
**Symbol** & \multicolumn{1}{c}{**Definition**} \\ \hline \(H\) & The parity check matrix \\ \(i\) & A variable node in \(H\), \(i\in\{1,2,\cdots N\}\) \\ \(j\) & A check node in \(H\), \(j\in\{1,2,\cdots M\}\) \\ \(C(i)\) & A collection of check nodes connected to variable node \(i\) \\ \(R(j)\) & A collection of variable nodes connected to check node \(j\) \\ \(C(i)\setminus j\) & A set of check nodes connected to variable node \(i\) except \(j\) \\ \(R(j)\setminus i\) & A set of variable nodes connected to check node \(j\) except \(i\) \\ \(L(P_{i})\) & Channel initial probability likelihood ratio message \\ \(L(r_{ji})\) & The check node message (extrinsic probability likelihood ratio \\  & message from variable node \(i\) to check node \(j\)) \\ \(L(q_{ij})\) & The variable node message (extrinsic probability likelihood ratio \\  & message from check node \(j\) to variable node \(i\)) \\ \(L(q_{i})\) & All messages collected by variable node \(i\) \\ \(\alpha\) & The correction factor in the NMS algorithm \\ \(\dot{c}\) & Decoding sequence obtained by decoding decision \\ \hline \hline \end{tabular}
\end{table}
Table 1: Definitions of variable symbols.  
(3) Stop  
If \(H\tilde{c}^{T}=0\), or the maximum number of iterations is reached, the iteration ends, otherwise the iteration is continued from step 1.