%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter[Error concealment-aware video encoding]{Error concealment-aware video \\ encoding \VERSION{2}} \label{Chapter:ConcealmentAwareTechniques} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SECTION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \vspace*{\fill} \section{Introduction} In this chapter an error concealment-aware encoding scheme is proposed to improve the quality of video delivered over networks prone to errors and data loss. The method aims to enhance the reconstruction of recovered lost frames by optimising the efficiency of the \ac{ec}. The proposed scheme is based on a scalable coding approach where the best \ac{ec} methods to be used at the decoder are optimally determined at the encoder and signalled through \ac{sei} messages. Such optimal \ac{ec} modes are found by simulating transmission losses followed by a Lagrangian optimisation of the \textit{signalling rate - \ac{ec} distortion} cost. A generalised saliency-weighted distortion is used and the residue between coded frames and their EC substitutes is encoded using a rate-controlled enhancement layer. When data loss occurs the decoder uses the signalling information to improve the reconstruction quality. This chapter is organized as follows. Section~\ref{Section5:Problem} introduces the problem definition and motivation for the method proposed in this chapter. Section~\ref{Section5:ECCandidates} presents an initial evaluation of different \ac{ec} schemes in order to find the relevant ones to be used in the proposed \ac{ec}-aware coding scheme. Section~\ref{Section5:Architecture} provides an overview of the proposed method architecture followed by a detailed description in Section~\ref{Section5:ProposedMethod}. Sections~\ref{Section5:ECSignallingPerformance}~and~\ref{Section5:OverallPerformance} present the performance results and discussion of the proposed \ac{ec} optimisation and signalling. Finally, Section~\ref{Section5:Summary} concludes the chapter. \clearpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SECTION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Problem definition} \label{Section5:Problem} In Chapter~\ref{Chapter:ErrorResilienceReview} different \ac{ec} algorithms that can effectively reconstruct lost video were described, though not all of them exhibit the same accuracy for every lost frame or slice. Moreover, it was also shown that combining different \ac{ec} approaches at the block level for improving the reconstruction accuracy is not straightforward. In the past, hybrid \ac{ec} schemes were proposed to improve the quality of recovered frames by either combining spatial and temporal \ac{ec} algorithms~\cite{HybridConcTB2008} or by optimising the \ac{mve} at the pixel and block levels~\cite{HybridConcealmentTB2008,2DConcHybridMotion2010}. Regarding the \ac{hevc}, existing algorithms also aim to improve the reconstruction accuracy of motion-based recovery approaches by using the information of correctly received neighbouring frames, e.g., block partitions~\cite{HEVCMCBlockAug2013} and prediction residue~\cite{HEVCMCResidueDec2013}. Although such methods are able to reduce the reconstruction artefacts and improve the overall video quality, decoder-based decisions are still not fully accurate, as they are based on limited information to be used as reference in the decision process. Therefore, higher reconstructed quality can be achieved by estimating the best \ac{ec} techniques at the encoding-side, based on the original video signal.. Different approaches were proposed in the past to address the problem of \ac{ec}-aware video coding~\cite{ConcealmentDrivenSliceOrdering2008,ConcealmentAwareME2006,ErrorResilienceModeHEVC2016}. Extra information was also used to aid the \ac{ec} operation at the decoder-side, either by sending redundant information \cite{ResilienceRECAP_ICASSP2009,SaliencyErrorConcealment_TM2013} or by embedding additional coded data into the bitstream \cite{ConcealmentIntraDataHidng2009}. Although these methods facilitate the \ac{ec} performance either through slice reordering or based on \acs{mv}, they always rely on the assumption that a fixed \ac{ec} method is used at the decoder. To advance one step further, this chapter presents an investigation of \ac{ec}-aware video coding and proposes a new scheme to achieve high decoding flexibility in terms of the \ac{ec} approaches, leading to better video quality. This is accomplished by selecting, at the encoder, among several \ac{ec} algorithms with different characteristics, the one that yields the lowest reconstruction distortion at the decoder and also minimises the \ac{rd} cost considering the necessary signalling rate. Thus, the proposed approach differs from similar previous methods \cite{ConcealmentAwareME2006,ErrorResilienceModeHEVC2016} by selecting the best \ac{ec} method without affecting the encoder optimisation. To further improve the quality of recovered frames, an enhancement layer is encoded with the mismatch residue computed as a difference between the transmitted and recovered frames. This is a dynamic optimisation process, which is more efficient than conventional approaches based on redundant pictures \cite{RedudantPicsJan2009,VPxResiliencePCS2016}, which transmit the whole frame as redundancy. In contrast with the previous work presented in Chapter~\ref{Chapter:ErrorResilienceTechniques}, which addressed the error resilience problem by optimising the coding dependencies, the approach described in this chapter considers both, \ac{ec} performance and the coded rate required for signalling the best \ac{ec} mode to the decoder. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SECTION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Error concealment algorithms} \label{Section5:ECCandidates} In order to propose a novel \ac{ec}-aware technique different algorithms were taken into consideration. This section presents a description and evaluation of the most relevant \ac{ec} algorithms used in the proposed method. Firstly, a technical description of each method is provided followed by a performance comparison between them. \subsection{EC algorithms based on motion-compensation} %\subsection{Motion-compensated reconstruction} The most common algorithms to recover missing frames take advantage of the correctly received \acs{mv} from the neighbouring frames. This has been widely used in the past for \ac{h264} standard \cite{H264RefConc2006,BlockBasedMVE2002,BlockBasedMVEOverllaped2011} and also in the \ac{hevc} standard~\cite{HEVCMCBlockAug2013,HEVCMCResidueDec2013,DownhillHEVCCon_ICCE2017}. Let's consider the example of Figure~\ref{FIG5:MotionVectorExtrapolation}, where a missing frame ($f_0$) at time instant $t_0$ is reconstructed based on the information present in the temporally adjacent frames, $f_{-1}$ and $f_{-2}$. One of the common approaches is \ac{mc} where the missing frame is reconstructed through motion compensation directly using the co-located vectors in the closest neighbour frame ($f_{-1}$). The \acs{mv} used for the motion compensation ($v_0$) are obtained by copying the \acs{mv} $v_{-1}$ from the same spatial position in $f_{-1}$, as illustrated in the figure by the \ac{mv} $v^{1}_{0}$ which is obtained by copying $v^{1}_{-1}$. An alternative approach is based on the reconstruction of the missing frame by using motion compensation through extrapolation of the received \acs{mv}, of frame $f_{-1}$ at time instant $t_{-1}$, according to the following procedure: \begin{enumerate} \item the \acs{mv} ($v_{-1}$) of the neighbouring frame ($f_{-1}$) are extrapolated to compute the set of \acs{mv} ($v_{0}$) for the missing frame as follows: \begin{equation} % v^\zeta_0 = \frac{ t_0 - t_{C} }{ t_{-1} - t_{R} } \times v^\zeta_{-1},\ \zeta=s,r v_0 = \frac{ t_0 - t_{-1} }{ t_{-1} - t_{R} } \times v_{-1}, \end{equation} where $t_{R}$ is the time instant of the reference frame pointed by the original \acs{mv} $v_{-1}$, which in the example of Figure~\ref{FIG5:MotionVectorExtrapolation} corresponds to $t_{-2}$. \item the \ac{mv} associated to the block $b_{-1}(x,y)$ at spatial position $(x,y)$ in $f_{-1}$ may be used to recover the block $b^{'}_{{0}}(x^{'},y^{'})$ in $f_0$, at position $(x^{'},y^{'})$ obtained from $v_0$ components as follows: \begin{align} x^{'} &= x - v_{0x}, \\ y^{'} &= y - v_{0y}. \end{align} \end{enumerate} This method, referred to as \glsfirst{mve}, is illustrated in Figure~\ref{FIG5:MotionVectorExtrapolation}, where the \ac{mv} $v^{2}_{0}$ results from the extrapolation of $v^{2}_{-1}$. One should note that these methods may not result in a complete motion field for the entire frame, resulting in an incomplete reconstruction. For the regions without \acs{mv} the average of the three top-left neighbouring \acs{mv} are used to complete the motion field. %\todo{Grid-aligment! Incomplete!} \begin{figure}[tb] \centering \input{./042_ConcealmentAwareEncoding/Figures/MotionVectorExtrapolation.tikz} \caption{Representation of the video frame with associated original and extrapolated motion vectors represented using full and dashed arrows, respectively.} \label{FIG5:MotionVectorExtrapolation} \end{figure} Finally, as a base for comparison, the default \ac{ec} in the reference \ac{hevc} implementation the \ac{fc} algorithm is also evaluated. This method consists in replacing the lost frame with a copy of the previously decoded one, which can also be described as a motion compensated reconstruction using only zero \acs{mv}. \subsection{Algorithms based on motion estimation} In this sub-section a different method to estimate a motion-field is described. This can be used to reconstruct the missing motion information of a lost frame. Then, the recovered motion-field is used in combination with the \ac{mve} method to recover the lost frame. Typically, optical flow estimation algorithms are used to estimate a 2-D motion field, comprising one \ac{mv} $v=(v_x, v_y)$, for each pixel, which minimises the following energy function: \begin{equation} E(x,y) = \sum_{x} \sum_{y} \bigg| f_{0}\big(x,y\big) - f_{-1}\big( x + v_x(x,y), y+v_y(x,y) \big) \bigg|. \end{equation} Besides a full search algorithm, where a block-based approach is used to search for the best \acs{mv} that minimise the sum of absolute errors, three other approaches were tested to evaluate their effectiveness in \ac{ec} algorithms. These three methods are as follows: \begin{enumerate} \item a method based on the duality between total pixel difference and regularisation term~\cite{DualFlow2016}; \item a method which approximates the neighbourhood of each pixel by quadratic polynomials on both frames~\cite{PolyFlow2003}; \item a method based on a combination of feature matching and total pixel difference~\cite{DeepFlow2013}. %\todo{check here!} \end{enumerate} \subsubsection{Motion estimation based on a regularisation term (\textit{DualFlow})} In this method the motion field is estimated based on the minimization of the total difference of pixel values measured using the L-1 norm \cite{DualFlow2007,DualFlow2016}, taking into account a regularisation term obtained from the Horn and Schunck smoothness condition~\cite{HornSchunckOpticalFlow1981}. This condition forces the estimated field to be regular across neighbouring pixels by penalising deviations in a quadratic sense. Using this method, for each pixel $\mathbf{p}$, the motion field $v(\mathbf{p})$ is obtained by minimising the following energy function, \begin{equation}\label{EQ5:DualFlow} E(v) = \sum_{\mathbf{p} \in \Omega} \Big( \big| f_{-1}(\mathbf{p}) - f_{-2}( \mathbf{p} + v(\mathbf{p}))\big| + \big|\nabla v(\mathbf{p})\big| \Big)%d\mathbf{p},\ \mathbf{p} \in \Omega \end{equation} where $f_{-1}$ and $f_{-2}$ are the two previous frames at time instants $t_{-1}$ and $t_{-2}$, as represented in Figure~\ref{FIG5:MotionVectorExtrapolation}. In~(\ref{EQ5:DualFlow}), $\Omega$ defines the sets of pixels of those frames, and $|\nabla v(\mathbf{p})|$ is a regularisation term that penalises high variations of the optical flow which effectively disallow discontinuities. This is based on the assumption that neighbouring regions belong to the same object, thus such regions should have similar motion. \subsubsection{Motion estimation based on polynomial expansion (\textit{PolyFlow})} In this method the motion field is estimated based on a polynomial expansion of each pixel neighbourhood~\cite{PolyFlow2003}. In this method only quadratic polynomials are considered, expressed as: \begin{equation}\label{EQ5:PolyFlow} f(\mathbf{p}) \sim \mathbf{p}\mathbf{A}_1\mathbf{p}^T+\mathbf{b}_1\mathbf{p}^T+C_1 \end{equation} where $\mathbf{p} = [x\ y]$, $\mathbf{A_1}$ is a symmetric matrix, $\mathbf{b_1}$ is a row vector and $C_1$ is a scalar. The coefficients are estimated using weighted least squares fit to the signal values in the neighbourhood. \HIGHLIGHT{ The use of quadratic polynomials was chosen primarily due to their low computational complexity and acceptable estimation accuracy. Nevertheless, as stated in \cite{farneback2002polynomial} the extension to higher degrees is straightforward.} Since the result of a polynomial expansion is such that each neighbourhood is approximated by a polynomial, it is necessary to analyse what happens if a polynomial undergoes an ideal translation. Let's consider the signal $f_1(\mathbf{p})$ represented by~(\ref{EQ5:PolyFlow}) and a signal $f_2$ which corresponds to a displacement of $f_1$, given by $\mathbf{d}=[v_x \ v_y]$. This can be expressed by the following: \begin{align} f_2(\mathbf{p}) &= f_1(\mathbf{p}-\mathbf{d}) \nonumber \\ &= (\mathbf{p}-\mathbf{d})\mathbf{A}_1(\mathbf{p}-\mathbf{d})^T+\mathbf{b}_1(\mathbf{p}-\mathbf{d})^T+C_1 \\ &= \mathbf{p}\mathbf{A}_1\mathbf{p}^T - 2\mathbf{d}\mathbf{A}_1\mathbf{p}^T+ \mathbf{d}\mathbf{A}_1\mathbf{d}^T+ \mathbf{b}_1\mathbf{p}^T-\mathbf{b}_1\mathbf{d}^T + C_1 \nonumber \\ &= \mathbf{p}\mathbf{A}_1\mathbf{p}^T + (\mathbf{b}_1-2\mathbf{d}\mathbf{A}_1)\mathbf{p}^T + \mathbf{d}\mathbf{A}_1\mathbf{d}^T - \mathbf{b}_1\mathbf{d}^T + C_1\\ &= \mathbf{p}A_2\mathbf{p}^T+\mathbf{b}_2\mathbf{p}^T+C_2, \nonumber \end{align} then, by equating the coefficients of the quadratic polynomials results in the following relations: \begin{align} \mathbf{A}_2 &= \mathbf{A}_1 \nonumber \\ \mathbf{b}_2 &= \mathbf{b}_1 - 2 \mathbf{d} \mathbf{A}_1, \\ C_2 &= \mathbf{d}\mathbf{A}_1\mathbf{d}^T + \mathbf{b}_1\mathbf{d}^T + C_1. \nonumber \end{align} This allows to find the displacement $\mathbf{d}$ for any signal dimensions by solving the above equations. Detailed implementations of the polynomial expansion and respecting solving can be found in~\cite{NormalizedDiffConvolution1993,farneback2002polynomial}. \subsubsection{Large displacement optical flow with deep matching (\textit{DeepFlow})} In this method the motion field is estimated based on extension of the total pixel difference methods using descriptor (feature) matching. This allows the optical flow estimation to accurately find large displacements, because it is not fully bound by any constrains, such as the Horn \& Such presented in~(\ref{EQ5:DualFlow})\cite{LargeDisplacementOptFlow_TPAMI2011}. Moreover, the correspondences between descriptions are used to apply a coarse-to-fine wrapping, which avoids local minimum values. The combination of both approaches increases the matching accuracy. This approach was also exploited in \cite{DeepFlow2013} with the following extensions: (i) use of description matching in the minimisation problem; (ii) introduction of a normalisation parameter to decrease the impact of regions with high spatial changes; (iii) use of different weights for each layer optimisation. Figure~\ref{FIG5:DeepFlowDiagram} shows the blocks that are included in the description matching process. The matching algorithm is built upon a multi-stage architecture using six layers with different patch sizes, interleaving convolutions and max-pooling, which is similar to deep convolutional networks \cite{GradientBasedConvNN_ProcIEEE1998}. As shown in Figure~\ref{FIG5:DeepFlowDiagram}, multi-size response levels are generated from the reference and target images using convolutions with different patch sizes. This method uses a bottom-up approach, i.e., starting at a fine level and moving towards the coarser levels (larger patches), which are built as an aggregation of responses of smaller patches. This results in a multi-size response pyramid. Subsequently, a local maximum is extracted from each level to achieve a more accurate motion field (quasi-dense correspondence). Then, an initial motion field is extracted, referred to as $v'$ . The final optical flow is obtained by minimising an energy function, which can be described by the following equation: \begin{equation} E(v) = \sum_{\mathbf{p} \in \Omega} \Big( E_D(\mathbf{p}) + \alpha E_S(\mathbf{p}) + \beta E_M(\mathbf{p}) \Big), \end{equation} where $E_D$ is the data term, $E_S$ is a smoothing term and $E_M$ is the matching term. The data term is obtained from the difference between matching pixels in both video frames. The smoothness term is a robust penalisation of the gradient of the flow, similarly to~(\ref{EQ5:DualFlow}), i.e., $E_S(\mathbf{p})=|\nabla v(\mathbf{p})|$. Finally, the matching term ($E_M$) is used to encourage the flow estimation to be similar to the precomputed motion field~($v'$). \begin{figure}[t] \centering \includegraphics[width=.95\columnwidth]{./042_ConcealmentAwareEncoding/Figures/DeepFlowBlockDiagram} \caption{Block diagram of the deep matching algorithm \cite{DeepFlow2013}.} \label{FIG5:DeepFlowDiagram} \FIGSVSPACE \end{figure} \subsection{Experimental evaluation} This section presents a simulation study of the different \ac{ec} schemes previously described. This evaluation aims at finding the suitable methods to be used for efficient reconstruction of the missing frames in case of data loss. The two \ac{ec} methods based on the correctly received \acs{mv} are tested, i.e., \ac{mc} and \ac{mve}, while the \ac{fc} method is used as reference for comparison. Moreover, the four different approaches to estimating the motion field for the missing frame are compared: (i) full search based on the minimisation of the sum of absolute errors (\FULLSEARCH), (ii) optical flow based on the duality between total difference and regularisation term (\DUALFLOW), (iii) optical flow based on polynomial approximations (\POLYFLOW) and (iv) optical flow based on deep matching (\DEEPFLOW). Table~\ref{TAB5:ECPerformaceComparison} shows the average quality (\ac{psnr}) obtained for the different methods under investigation. The absolute value of \ac{psnr} is shown for the \FC method, while the differential values are shown for the remaining methods. The results shown in the table reveal that methods \MC and \MVE are both able to overcome \FC, achieving average quality gains of up to 1.41 dB and 1.46 dB, respectively. Moreover, by extrapolating the \acs{mv} from the correctly receiving frame to the lost one (\MVE), it is also possible to outperform motion-copy (\MC). This can be explained by the objects' trajectories of objects which are preserved in the \MVE method (assuming constant translational motion), in contrast with the \MC method, which assumes that neighbouring objects have parallel motion which may result in inaccurate estimations. \begin{table}[tb] \centering \caption{Average decoded video quality (\ac{psnr} in dB) for seven error concealment algorithms under 10\% of random packet loss.} \label{TAB5:ECPerformaceComparison} \TABLESVSPACE \input{./042_ConcealmentAwareEncoding/Results/PerformanceConcealmentMethods.tex} \end{table} According to the results of Table~\ref{TAB5:ECPerformaceComparison} (columns 5 to 8) the \ac{ec} methods based on motion estimation achieve an overall superior performance when compared with methods which rely on correctly received \acs{mv} (i.e., \MC and \MVE). Results for \FULLSEARCH method reveal that only minimising the sum of absolute errors between two consecutive frames might not always be directly related with objects' motions, which results in inaccurate motion field to be used in the reconstruction of lost frames. Finally, results from Table~\ref{TAB5:ECPerformaceComparison} reveal that the \DEEPFLOW algorithm leads to the most accurate motion field, in comparison with the other methods. It is able to achieve an average quality gain of 1.79 dB, and up to 3.39 dB for Book Arrival sequence, where \POLYFLOW only achieves 3.05 dB. Since \POLYFLOW combines different techniques also used by other algorithms in study, e.g., total difference of pixel values also used by \DUALFLOW, it is expected to achieve accurate estimations and consequently higher \ac{ec} reconstruction quality. Moreover, using feature matching in combination with smoothing conditions, the \DEEPFLOW algorithm is able to correctly estimate large displacements, which results in improved performance for video signals with higher motion, e.g., Tennis sequence. \subsection*{Remarks} Summarising, the analysis of the previous results indicates that all \ac{ec} methods are able to cope with lost frames and manage to recover the missing data with reasonable quality. Nevertheless, it is noticeable that lost frames recovered with an estimated motion field result in higher average quality, especially when using the \DEEPFLOW method. However, since the other methods are also able to achieve acceptable video quality, they shall not be neglected, as they provide alternative approaches for lost frame recovery with a lower computational complexity (i.e., they not require motion estimation). Thus, in order to achieve higher reconstruction quality, different approaches shall be considered, aiming at balancing the overall complexity with the quality of the reconstructed frames. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SECTION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Architecture for the EC-aware video encoding} \label{Section5:Architecture} This section presents the general architecture proposed for \ac{ec}-aware video encoding, describing its main functional blocks, and providing an introduction for the subsequent detailed descriptions. Figure~\ref{FIG5:BlockDiagram} illustrates the architecture of the proposed \ac{ec}-aware encoding scheme. After the video encoder, it includes data loss simulation at the \ac{nal} for every slice. Subsequently, \ac{ec} is applied to the simulated losses in order to find the best methods that should be used to reconstruct the lost slices in case of errors and packet loss. Saliency-weighted \ac{ec} mode decision is used to select the optimal \ac{ec} mode from the best trade-off between \ac{ec} distortion, using the original input video~($f$) as reference, and the number of bits required for signalling. Then, the optimal \ac{ec} mode is sent to the decoder along with the mismatch residue computed as a difference between the transmitted and recovered frames. Finally, the scalable extension of the \ac{hevc} standard is used to encode this residue information. For the \ac{ec} mode decision optimization the missing slices are reconstructed, as they would be in the decoder, i.e., they are recovered at the encoder by simulating the decoder \ac{ec}, but using several \ac{ec} methods, based on motion estimation and extrapolation techniques, to select the best one at the encoder-side. In this process, each \ac{ctu} is partitioned to form a quadtree structure of \ac{ecu} that are used to test the different \ac{ec} candidate modes. Then, the best trade-off between \ac{ecu} partition and signalling is found through \ac{rd} optimisation. In order to achieve an efficient use of the signalling overhead, a saliency-weighted procedure is embedded in the \ac{rd} optimisation based on a spatio-temporal saliency, where more signalling bits are allocated to regions with higher saliency values. Finally, the signalling information is transmitted to the decoder by using the \ac{sei} \ac{nal} units~\cite{HEVCHighLevelReferenceDez2012}. Since, in general, the optimal \ac{ec} mode is still not able to perfectly reconstruct all the missing regions, extra residual information is multiplexed in the stream encoded as a scalable \ac{el}. This residual information contains the difference between the compressed ($\hat f_t$) and the \ac{ec} frames ($\tilde f$). \begin{figure}[tb] \centering %\includegraphics[width=.9\columnwidth]{./042_ConcealmentAwareEncoding/Figures/BlockDiagram} \input{042_ConcealmentAwareEncoding/Figures/BlockDiagram.tikz} \caption{Architecture of the error concealment-aware encoding scheme.} \label{FIG5:BlockDiagram} \FIGSVSPACE \end{figure} The transmitted information is used to assist the \ac{ec} operation at the decoder to recover erroneous frames with high accuracy, by using the best \ac{ec} mode and also residual information to reduce error propagation. The remaining of this section describes in detail the building blocks of the proposed encoding architecture, i.e., the \ac{ec} candidate modes, the saliency-weighted optimal \ac{ec} mode decision, signalling and enhancement layer coding. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% SECTION %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Saliency-weighted \ac{ec} mode decision} %\section{Error concealment mode decision} \label{Section5:ProposedMethod} In this section the proposed saliency-weighted \ac{ec} mode decision algorithm is described. Firstly, the list of \ac{ec} candidates is provided based on the previously described methods. Then, the \ac{rd} optimisation is performed using a saliency region in each frame, in order to decrease the overall bitrate without compromising the reconstruction quality. The signalling coding strategy is also described. Finally, coding the \ac{ec} residue, introduced as auxiliary information to improve the reconstruction quality, is described. \subsection{\ac{ec} candidates} A set of four \ac{ec} candidate modes (M1...M4) is used in the optimisation process that selects one of them as the best match for each particular \ac{ecu}. Each \ac{ec} mode corresponds to a different \ac{ec} method, as shown in Figure~\ref{FIG5:concealmentcandidates}, namely: \begin{itemize} \item M1, M2: These two methods are based on extrapolation of an estimated motion field; \item M3: This method is based on \ac{mv} extrapolation of previously received \acs{mv}; \item M4: This method uses the co-located motion information from the closest neighbour; \end{itemize} \begin{figure}[tb] \centering %\includegraphics[width=0.7\columnwidth]{./042_ConcealmentAwareEncoding/Figures/ConcealmentCandidates} \input{./042_ConcealmentAwareEncoding/Figures/ConcealmentCandidates.tikz} \caption{\ac{ec} candidates used for optimization.} \label{FIG5:concealmentcandidates} \FIGSVSPACE \end{figure} The first two methods, M1 and M2 rely on an estimated motion field, using the method \DEEPFLOW \cite{DeepFlow2013}, to recover the lost frame. Such motion field is extrapolated at the pixel level, i.e., one \ac{mv} is assigned to each pixel, and \ac{pu} level, i.e., one \ac{mv} is assigned to the entire unit. This results in two different reconstructions of the missing frame, where the former may increase the accuracy of the pixel extrapolation, but the latter has the advantage of keeping the block structure and generate a smoother reconstruction. The method M3 is based on a conventional \ac{mve}, and finally M4 reconstructs the missing frames using the \ac{mc} algorithm. \subsection{Optimal \ac{ec} mode selection} As previously described in sub-section~\ref{Section5:ECCandidates}, the proposed method allows to choose between four \ac{ec} candidates, which result in different recovered frames for each lost frame (simulated). The lost frame is partitioned into quadtree structures, each one forming a set of variable size \acs{ecu}. Then, the process of finding the optimal \ac{ec} method for each \ac{ecu} is formulated as a rate-distortion cost minimisation. To solve such problem, a Lagrangian optimisation is used to achieve the best trade-off between reconstruction quality and signalling overhead. Furthermore, image saliency driven by visual attention modelling is used in the optimisation process to weight the cost of the overhead information of each \ac{ecu}, according to the visual relevance of its content. The optimal \ac{ec} mode $m_{l,i}^*$, for the $i_{th}$ \ac{ecu} of size defined by the quadtree partitioning level $l$, is obtained by minimising the following Lagrangian cost: \begin{equation}\label{EQ6:OptimalDepth} \small \newcommand{\argmin}{\operatornamewithlimits{arg\ min}} % (m^*,l^*) = \argmin_{m,l} \left\{ D(m,l) + \left(1+\frac{t_0-t_I}{T_{I}}\right) \lambda R(m,l) \right\}, % l^* = \argmin_{l=1..3} \left\{ D(l) + \lambda \left(1-\frac{t_I-t_c}{T_{\ac{ird}}}\right) R(l) \right\}, m_{l,i}^* = \argmin\limits_{\footnotesize \substack{l\in\left\{0...3\right\} \\ i\in\left\{1...4^l\right\}}}\left\{ D(m_{l,i}) + \left(1+\frac{t_C-t_I}{T_{I}}\right) \lambda R(m_{l,i}) \right\}, \end{equation} where $R(m_{l,i})$ represents the number of overhead bits required to encode the \ac{ec} mode, and $D(m_{l,i})$ is the sum of absolute error of the \ac{ecu}. In~(\ref{EQ6:OptimalDepth}), besides the parameter $\lambda$, which is used to trade-off distortion and overhead rate in the minimisation process, there is also a weighting factor to control the cost of $R(m_{l,i})$, according to the duration of the error propagation. As in the method proposed in the Chapter~\ref{Chapter:ErrorResilienceTechniques}, this method uses the ratio between the temporal distance from the current frame ($t_C$) to the previous refresh frame ($t_I$) and the period of refreshing frames ($T_{I}$). %This weight varies between $\left[0;1 \right]$, achieving the lowest value for intra-coded frames and the maximum for the frame located immediately before an intra-coded one. This behaviour follows the fact that when a lost frame is closer to the next intra-coded frame, the error propagation is lower. Thus, it is not worthwhile to spend too many overhead bits to reduce it. This is accomplished by increasing the cost of such bits according to the temporal distance between the missing frame and the next I frame. Moreover, a dynamic value for $\lambda$ is also used to adjust the amount of overhead within the frame, according to the visual relevance of each image region, defined by a saliency map (see Section~\ref{Section6:SaliencyDetection}). The algorithm previously described results in \acs{ecu} with variable size, which is defined by the depth of the quad-tree structure, i.e., level $l$. The partition size is jointly optimised along with the best \ac{ec} candidate method using~(\ref{EQ6:OptimalDepth}). Alternatively, a fixed \ac{ecu} size can also be used by defining a fixed depth for all quad-tree structures, i.e., constant $l$ for the entire frame. This can be achieved by using~(\ref{EQ6:OptimalDepth}) to solely optimise the \ac{ec} methods for each \ac{ecu}. Although this reduces the overall complexity of the proposed method, it leads to a non-optimal solution which may require additional overhead. In Section~\ref{Section5:ECSignallingPerformance} a comparison between a dynamic and fixed approach is provided. \subsection{Saliency detection} \label{Section6:SaliencyDetection} The saliency maps are computed based on the well-known Itti's attention model \cite{SaliencyItti1998} that applies a hierarchical decomposition, based on a set of spatial features, which are combined with a center-surround weighting to obtain the saliency map. Since the Itti's model only produces saliency maps for still images, in this work it is further combined with a temporal feature. This is obtained by estimating the optical flow between two consecutive frames, based on the algorithm presented in \cite{HornSchunckOpticalFlow1981}. The final saliency map is achieved by combining the spatial and temporal components, $S_{s}$ and $S_{t}$ respectively, as follows, \begin{equation}\label{eq:saliency} S = \rho S_{t} + (1-\rho) S_{s} \end{equation} The parameter $\rho$ is used to give higher relevance to the temporal component, since motion is correlated with error propagation, producing longer artefacts and consequently higher impact on visual attention. In this work the temporal component was given a weight slightly higher than 50\%, i.e. $\rho=0.6$. On the one hand, higher values of saliency (i.e. regions with higher visual relevance) should result in lower values of $\lambda$, which tend to increase the overhead rate value on those regions, thus reducing the \ac{ec} distortion at the decoder, in case of loss. On the other hand, higher values of $\lambda$ should reduce the overhead, allowing higher \ac{ec} distortion at the decoder. In order to achieve the aforementioned goal, the following definition for $\lambda$ is used: \begin{equation}\label{eq:lambdasaliency} % \lambda = \lambda_{0} - \frac{S_{\ac{ctu}} - \mean S}{\Delta S}, \Delta S > 0, % \lambda = \lambda_{0} + \frac{\Delta S}{S_{\ac{ctu}} - \mean S}, % \lambda = \lambda_{0} e^{\frac{\mean S - S_{\ac{ctu}}}{\Delta S}}, \Delta S > 0, \lambda=\begin{cases} \lambda_{0} e^{\frac{\mean S - s}{\Delta S}}, & \text{if $\Delta S > 0$},\\ \lambda_{0}, & if \Delta S=0 \text{ (no saliency used)}, \end{cases} \end{equation} where $s$ is the saliency value of the current \ac{ctu}, $\mean S$ is the average saliency value and $\Delta S$ is the difference between the maximum and minimum. One should note that this method does not depend on the existence of a saliency map. If the saliency map is constant or non-existent, a fixed value of $\lambda$ is used (i.e., $\lambda_0$) defined at the encoder, which means that no distinction is made across image regions. \subsection{Signalling the optimal EC modes} % \begin{figure}[tb] % \begin{algorithmic} % \Procedure{encodectuecm}{$level$} % \If{$level