# Adaptive Rate-Compatible Non-Binary LDPC Coding Scheme for the B5G Mobile System
## 3 Channel Clustering Based on the K-Means++ Algorithm
### Complexity Optimization of the End-to-End Distortion Model Based on the Clustering Algorithm
\begin{array}{ll}d_{ec}(n,i)&=E\bigg{\{}\left(f_{n}^{i}-\widehat{f}_{n-1}^{k} \right)^{2}\bigg{\}}\\ &=E\bigg{\{}\left(f_{n}^{i}-\widehat{f}_{n-1}^{k}+f_{n-1}^{k}-\widehat{f}_{n-1}^ {k}\right)^{2}\bigg{\}}\\ &=E\bigg{\{}\left(f_{n}^{i}-\widehat{f}_{n-1}^{k}\right)^{2}\bigg{\}}+E\bigg{\{} \left(\widehat{f}_{n-1}^{k}-\widehat{f}_{n-1}^{k}\right)^{2}\bigg{\}}\\ &=d_{ec,o}(n,i)+d_{ep}(n-1,k)\end{array}  \tag{9}\]  
As can be seen from the above formula, \(d_{ec}(n,i)\) consists of two items, \(d_{ec,o}(n,i)\) and \(d_{ep}(n-1,k)\), where \(d_{ec,o}(n,i)\) represents the mean square error between the original image and the encoder-side error-coded pixels, called the original error concealment distortion. \(d_{ec,o}(n,i)\) can also be obtained by parameter calculation on the encoder side. It can be seen that \(d_{ep}(n-1,k)\) in Equation (9) and \(d_{ep}(ref,j)\) in Equation (8) represent error propagation distortion. The calculation method of \(d_{ep}(n,i)\) is as shown in:  
\[ \begin{array}{ll}d_{ep}(n,i)&=E\bigg{\{}\left(\widehat{f}_{n}^{i}-\widehat{ f}_{n}^{i}\right)^{2}\bigg{\}}\\ &=(1-p)E\bigg{\{}\left(\widehat{f}_{n}^{i}-\left(\widehat{f}_{ref}^{i}+\hat{n} _{n}^{i}\right)^{2}\right)^{2}\bigg{\}}+pE\bigg{\{}\left(\widehat{f}_{n}^{i}- \widehat{f}_{n-1}^{k}\right)^{2}\bigg{\}}\\ &=(1-p)E\bigg{\{}\left(\widehat{f}_{ref}^{j}-\widehat{f}_{ref}^{j}\right)^{2} \bigg{\}}+pE\bigg{\{}\left(\widehat{f}_{n}^{i}-\widehat{f}_{n-1}^{k}\right)^{ 2}\bigg{\}}+pE\bigg{\{}\left(\widehat{f}_{n-1}^{k}-\widehat{f}_{n-1}^{k} \right)^{2}\bigg{\}}\\ &=(1-p)d_{ep}(ref,j)+pd_{ec,r}(n,i)+pd_{ep}(n-1,k)\end{array}  \tag{10}\]  
It can be seen that \(d_{ep}(n,i)\) consists of three parts, where \(d_{ec,r}(n,i)\) represents the reconstructed image and the error concealment distortion at the encoder end, which is called reconstructed error concealment distortion. The expression \(d_{ec,r}(n,i)\) can be obtained by parameter calculation at the decoder end. Therefore, A is mainly generated by the error propagation distortion of its reference frame and the previous frame. In addition, since the first frame in the video sequence is usually an intra-coded frame, the value \(d_{ep}\) of the first frame can be directly obtained without considering error propagation and the values \(d_{ep}s\) of the remaining frames can be recursively calculated by Equation (10) on a frame-by-frame basis. In the end-to-end distortion model, the end-to-end distortion of the current frame is obtained by referring to the error propagation distortion of the previous frame, and the subsequent frame is updated by the error propagation distortion of the current frame. Therefore, from the above analysis, the end-to-end distortion estimation is related to the selection of source-coding, channel-coding, and reference frames. According to the derivation of the end-to-end distortion estimation method, in the JSCC algorithm based on the rate allocation, in order to select the optimal rate allocation strategy, it is necessary to comprehensively consider the parameters of the source, the channel and the like, so it will be introduced. There is a large number of iterative calculations, so how to choose an effective means to reduce the computational complexity is also a problem worth studying. Since the end-to-end distortion of the video transmission system is related to the source-coding parameters, the channel-coding parameters, and the reference frame, let \(S\) denote the set of all source-coding options, \(C\) denote the set of all channel-coding options, and \(M\) denote the set of all reference frames. The candidate parameters of the source-coding, channel-coding, and reference frame are \(u,r,ref\), respectively. A system description that minimizes distortion at the decoder is shown in:  
\[\min_{u\in S,r\in C,ref\in M}E[d(u,r,ref)] \tag{11}\]  
The traditional JSCC algorithm is based on the principle of minimizing end-to-end distortion as a scheme for selecting a code rate allocation.