# Video Error-Resilience Research Based on Error-Resilient Screen Content
## 3 Proposed Method
### Analysis of Distortion  
In this subsection, the distortion situation is discussed to evaluate the performance of the error-resilience coding scheme proposed in this paper. The lower the distortion, the higher the error-resilience capacity. In the video transmission process, the overall end-to-end distortion \(D_{\text{total}}\) mainly comes from three parts, namely coding distortion, error concealment distortion, and potential error diffusion distortion from the reference block. \(D_{\text{total}}\)could be described as:  
\[D_{\text{total}}=E\left\{\left(f_{i}-\tilde{f_{i}}\right)^{2}\right\}=(1-p) \cdot D_{Q}+(1-p)\cdot D_{r}+p\cdot(D_{\alpha c}+D_{\alpha c,r}) \tag{1}\]  
where \(D_{Q}\) denotes the quantization distortion; \(D_{r}\) represents the distortion of potential error diffusion caused by the reference frame; \(D_{\alpha c}\) denotes the distortion between the content of the error concealed video macroblock and the correct video macroblock; \(D_{\alpha c}\) depends on the current coding parameter anderror concealment; \(D_{\alpha_{c},r}\) represents the potential distortion caused by hiding the wrong macroblock. In addition, \(f_{i}\) signifies the original video frame, \(\tilde{f_{i}}\) denotes the video frame with redundancy encoding, \(E\{\cdot\}\) denotes the expectation operator and \(p\) denotes the probability of independent packet losses for image frames. Note that errors may occur due to different color ranges in the process of image color conversion, and the error diffusion algorithm [24] reduces the visual errors caused by transmitting the errors to the surrounding pixels. The distortion \(D_{pri}\) when the redundant frame is not currently embedded can be written as:  
\[D_{pri}=(1-p)\cdot D_{r}+p\cdot(D_{\alpha c}+D_{\alpha c\_,r}) \tag{2}\]  
When the redundant frame is embedded, the distortion could be formulated as [21]:  
\[D_{pri_{int}}=(1-p)\cdot D_{r}+p\cdot(1-p)\cdot\left(D_{diff}+D_{rad\_r}\right) +p\cdot(D_{\alpha c}+D_{\alpha c\_,r}) \tag{3}\]  
where \(D_{diff}\) denotes the distortion caused by the difference between the main frame and the redundant frame, and \(D_{rad\_r}\) signifies the distortion generated by the potential error diffusion of the redundant frame. If packet loss happens for the current frame with probability p, the redundant frame will be used. As a result, the redundancy of the current frame is not lost. Then the remaining frames are normal with probability \(p\cdot(1-p)\). The proposed redundant coding algorithm assumes that when the slice of the primary frame is lost, the decoding operation of the redundant frame on the decoding side replaces the content of the lost frame. As a result, the use of redundant frames and redundant slices reduces error propagation and improves video reliability. Rate-distortion performance can be seen from the change rate of distortion (for a given source distribution and distortion metric, the minimum expected distortion that can be achieved at a specific bit rate) and the change of code rate:  
\[\Delta D=p\cdot(1-p)\cdot\left[\sum_{k}D_{diff}(k)-\sum_{k}D_{\alpha}\left(k \right)\right] \tag{4}\]  
\[\Delta R=R_{cur}-R_{pri}=R_{red} \tag{5}\]  
where \(R_{cur}\) denotes the bit consumption common to the current primary frame and the redundant frame in the case of embedded redundancy, \(R_{pri}\) represents the bit consumption of the current frame. \(\Delta R\), the amount of change in the code rate is also the code rate of the redundant frame. \(k\) signifies the order number of the pixels belonging to the rectangular ROI part. When a redundant frame is used, the probability that the redundant frame and the main frame are simultaneously lost is \(p^{2}\), it is obvious that the change rate of the distortion change and the code rate are both related to the packet loss rate \(p\). When the packet loss rate \(p\) is small, a single redundant frame can be used to implement error-resilience. When the packet loss rate \(p\) is large, different redundant frame allocation strategies can be adopted according to the type of frame.