Files
doc_phd_thesis/021_VideoCoding/VideoCodingReview.tex
T

684 lines
62 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
% Figure folders
\renewcommand{\FigsPath}{./021_VideoCoding/Figures}
% \chapter{\HIGHLIGHT{The \ac{hevc} Standard}}
\chapter{The High Efficiency Video Coding standard \VERSION{3}}
\label{Chapter:HEVCReview}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{\fill}
\section{Introduction}
This chapter presents an overview of the \ac{hevc}~\cite{H265StandardFeb2018} standard, focusing on the most relevant features of the encoding algorithm, considering the scope of the work developed in this thesis.
In short, the \ac{hevc} standard essentially aims to support all existing applications of \ac{h264}~\cite{H264AVCStandard2003}, while extending two keys aspects: increased video resolution with higher compression ratio and also more efficient use of parallel processing architectures.
In order to increase the coding flexibility and higher video resolutions, the \ac{hevc} standard adopts a new block partition structure, as well as, new prediction modes.
In this chapter the new data structures and coding techniques, specifically introduced to increase the coding efficiency, are described.
Particular emphasis is given to those which may have a significant impact on the error robustness characteristics of \ac{hevc} streams.
The chapter is organised as follows.
Section~\ref{Section2:GeneraVideoSystem} introduces the functional blocks of a generic hybrid video coding system and Section~\ref{Section2:Overview} provides an overview of the \ac{hevc} standard.
Then, Section~\ref{Section2:HighLevel} describes the high-level syntax elements, which are used to carry relevant information in coded streams.
Section~\ref{Section2:CodingStructures} describes the data structures used to divide the video frames into smaller partitions and Section~\ref{Section2:PredictionModes} describes particular aspects of the main predictions techniques, namely intra and inter coding.
Finally, a brief description of the transform and quantisation, entropy coding and in-loop filters is provided in Sections~\ref{Section2:TransformQuant},~\ref{Section2:Entropy} and~\ref{Section2:Filters}, respectively.
Section~\ref{Section2:Summary} concludes the chapter.
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Generic hybrid video coding}
\label{Section2:GeneraVideoSystem}
A digital video signal is a temporal succession of images, also referred to as pictures or frames, which usually presents a significant amount of temporal and spatial correlations.
In general, video coding and distribution systems follow through a generic chain of processing and delivery stages, comprising pre-processing, encoding, storage or transmission, decoding and post-processing, as shown in Figure~\ref{Figure2:HybridCodec}.
The pre-processing stage is used to adapt the raw video signal, either analogue or digital, to an appropriate format, such as RGB or YUV~\cite{DataCompression1997}.
Then, the video data is compressed by the respective encoding modules, mostly reducing its redundancy and visual irrelevancy. The encoding process is responsible for representing the raw video in a highly compressed format, while maintaining a good trade-off between video quality and bitrate through high efficient algorithms and coding tools.
In the last stages of the chain, the compressed format is decoded and presented by displaying the signal content after adaptation to the consumer equipment through post-processing, when necessary.
% \begin{figure}[tb]
% \centering
% \input{\FigsPath/GeneralVideoSystem.tikz}
% \caption{Block diagram of a generic video coding system.}
% \label{FIG2:GeneralVideoSystem}
% \end{figure}
Since the early days of video compressing, hybrid video coding has been the basic structure for all video coding standards and recommendations of ITU-T \ac{vceg} and \ac{iso}/\ac{iec} \ac{mpeg}, e.g., from H.261 to \ac{hevc}.
Figure~\ref{Figure2:HybridCodec} also shows the block diagram of a generic hybrid video coding system~\cite{BookLucas2017}.
While the generic algorithmic structure has not been changed, the specific techniques represented by the building blocks have been refined and the applicable coding configuration has become more and more flexible over years, through the use of an increasing variety of coding tools.
This is the reason why the coding scheme is called hybrid, as it combines quiet different prediction modes between pictures with transform and entropy coding~\cite{VideoCodingFundamentals2015}.
\begin{figure}[t]
\centering
\input{\FigsPath/HybridCodingBlockDiagramPrePost.tikz}
\caption{Block diagram of a generic video coding system, including the inner blocks of a hybrid encoding and decoding scheme (T and Q corresponds to the transform and quatisation operations, respectively).}
\label{Figure2:HybridCodec}
\end{figure}
%As aforementioned, the main purpose of video coding is to compress the video by reducing its redundancy.
In general, there are two kinds of redundancy in video signal: spatial and temporal.
On the one hand, the spatial redundancy is exploited through intra frame prediction, where the underlying mechanism is to find the best matching block for the current one, by searching the neighbouring region.
This is possible due to the existence of high correlation among neighbouring pixels within a frame.
As a result, when intra frame prediction is used, a block of pixels is reconstructed from the neighbouring blocks previously processed.
On the other hand, inter frame prediction is designed to exploit the temporal redundancy that exists among consecutive frames, such as those temporally adjacent, e.g., the past frame or the future frame in regard to the current one.
Temporal redundancy is normally referred to as the correlation between two adjacent frames since they usually have quiet similar visual content, such as foreground objects and background.
Thus, the purpose of inter-frame prediction is to search for the best matching block for the current one in a set of reference frames.
After finding the best matching candidate for the current block, either by intra- or inter-frame prediction, only the difference between the original block and the predicted one needs to be encoded.
As shown in Figure~\ref{Figure2:HybridCodec}, these differences (also known as residual signal) are further processed and transformed (T) into coefficients in the frequency domain.
Such a transformation decorrelates the residue signal and concentrates the signal energy in a few coefficients, mostly at low frequencies.
Subsequently, the transformed coefficients are quantised (Q) to reduce the representation accuracy of the signal, and consequently to reduce the number of bits required for coding.
Finally, the quantised transform coefficients together with the prediction information are further compressed by the entropy encoder, forming an output stream suitable for transmission or storage, as shown in Figure~\ref{Figure2:HybridCodec}.
On the other side of the communication chain, the decoding stage performs the inverse operations on the stream to reconstruct the video signal.
In the next section, the aforementioned blocks are described in the context of the \ac{hevc} standard.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Overview the standard features}
\label{Section2:Overview}
Similar to the previous coding standards developed by \ac{jctvc}, in \ac{hevc}~\cite{HEVCOverviewJul2012,HEVCOverviewDez2012,BookHEVC2014} only the
coding syntax and semantics are standardised.
The constrains and functionalities are defined through profiles and levels, while the semantic meaning of syntax elements define the decoding process, such that every decoder conforming to the standard generates the same output when given a conforming stream.
Such delimitation of scope in the standard concede maximum freedom for developers and manufactures to develop proprietary optimisations, allowing to cope with various applications’ requirements (\emph{e.g.}, balancing the compression ratio and the coding complexity).
Figure~\ref{fig:HEVCBlockDiagram} illustrates the block diagram of the \ac{hevc} encoder. It follows the same overall hybrid architecture as its predecessors starting from H.261.
The encoder uses both intra- and inter-picture prediction to exploit spatial and temporal redundancies, respectively.
Subsequently, the prediction residue is transformed by linear spatial transform and the resulting coefficients are then quantised and entropy coded, further reducing the bitstream redundancy.
%The resulting bitstream is combined with control information, which signals the prediction chosen, motion vectors, filtering operations and bitstream headers.
\begin{figure}[tb]
\centering
\includegraphics[width=\columnwidth]{021_VideoCoding/Figures/HEVCBlockDiagram}
%\input{\FigsPath/HEVCBlockDiagram.tikz}
\caption{Block diagram of an HEVC standard encoder.}
\label{fig:HEVCBlockDiagram}
\end{figure}
However, there are some novelties introduced in the \ac{hevc} standard. As depicted in Figure~\ref{fig:HEVCBlockDiagram}, the encoding process follows a block-based approach, therefore each picture is partitioned into larger blocks, referred to as \acs{ctu}, with a maximum size of $64\times64$ pixels.
Subsequently, a dynamic quad-tree partitioning is used to divide the picture into \acs{cu}.
These units are introduced as the basic processing units for prediction, while for the transform and quantisation operations, transform units are used.
In order to generate the prediction residue, the \ac{hevc} may either use one of 34 intra-prediction modes or take advantage of symmetric and asymmetric partitions for motion estimation and inter-prediction.
The motion estimation is performed in the pictures listed in the reference picture set, which was introduced in the \ac{hevc} to increase the robustness to errors and data loss of reference picture management.
To improve the overall quality of the reconstructed pictures and smooth the coding artefacts, \ac{hevc} not only uses a deblocking filter but also a \ac{sao} filter. Finally, the control data, quantised coefficients, prediction modes, motion vectors and filter information are compressed using the \ac{cabac}. The compressed bitstream is then allocated to various \ac{nal} units.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{High-level syntax}
\label{Section2:HighLevel}
This section describes the high-level components of the \ac{hevc} standard that provide support for signalling and stream partitioning, which are relevant elements in the context of robust video communications.
\ac{hevc} inherits several high-level features from \ac{h264}, e.g., the \ac{nal}, parameter sets, the use of \ac{poc} and \ac{sei} messages for auxiliary data.
However, some high-level features defined in \ac{h264} were not included, such as \ac{fmo}, redundant slices, arbitrary slice order, data partitioning and switching slices.
Furthermore, several new high-level features are introduced, such as the \ac{vps}, tiles and wavefront tools for parallel processing, dependent slices, for reduced delay, and a new reference picture management concept.
Moreover, new picture types were introduced to increase the random-access flexibility and temporal sub-layer switching.
\subsection{Network abstraction layer}
Similar to \ac{h264}~\cite{H264AVCStandard2003}, the \ac{hevc} standard defines an adaptation layer to cope with different transport protocols.
The \ac{nal} is used for stream partitioning and synchronization, which is useful to deal with lossy network environments~\cite{H264OverIPJul2003}.
Using this concept the video stream is composed of different \ac{nal} units. The \ac{nal} concept provides the ability to map the \ac{vcl} data that represents coded video slices (or frames) on various transport layers, such as \ac{rtp}, MPEG-2 Systems and MPEG DASH. The~\ac{nal} units are classified into two categories: (i) \ac{vcl} and (ii) non-\ac{vcl}, as they carry coded video or associated data, respectively.
The \ac{hevc} standard defines a two bytes header to describe the content of each \ac{nal} unit, which are transmitted using a fixed coding format length, i.e., without variable length codes.
This allow extra error robustness but increases the bit overhead.
Figure~\ref{Figure2:NalHeader} shows the structure of the \ac{hevc} \ac{nal} unit header. The first bit \textit{F}, referred to as \textit{forbiden\_bit}, is always zero in order to ensure that a start code can be detected across different protocol standards. This is followed by the \ac{nal} type, which identifies its content, enabling the decoder to either use it if required for a particular decoding purpose or discard it. Another syntax element introduced by the \ac{hevc} standard is the \textit{temporal\_id\_plus\_one} (TIDP), which defines the temporal layer where the \ac{nal} unit belongs. This allows implicit temporal scalability (layers ranging from 0 to 6) by immediately discarding the \ac{nal} unit if it belongs to a layer that is higher than the pre-defined one. In the header, six bits are reserved for future extensions, preventing the creation of extra \ac{nal} units for scalable and multiview extensions, as done in \ac{h264}.
\begin{figure}[tb]
\centering
\vspace{5mm}
\newcommand\bithead[1]{\bitbox[]{#1}{\scriptsize #1}}
\newcommand{\colorbitbox}[3]{%
\rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}%
\bitbox{#2}{#3}}
\begin{bytefield}[bitwidth=20pt]{16}
\bitheader{0-15} \\
\colorbitbox{TikZColorFill}{1}{F} & \colorbitbox{gray!60}{6}{NAL Type} & \colorbitbox{TikZColorFill}{6}{Reserved} & \colorbitbox{gray!60}{3}{TIDP}
\end{bytefield}
\caption{\ac{nal} unit header format in HEVC.}
\label{Figure2:NalHeader}
\end{figure}
\subsection{Parameters set}
The encoder uses a set of signalling packets as a robust method to share data with the decoder, referred to as parameter set units. This information was introduced in previous standards to deal with vulnerabilities in the transport of signalling information between the encoder and decoder.
In this approach, such set of parameters is multiplexed in the bitstream and repeated as many times as required by the application, e.g., streaming, storage among others. In \ac{hevc}, this structure is inherited from \ac{h264}\cite{H264OverIPJul2003} with modifications to cope with new coding tools.
The \ac{hevc} includes three sets of parameters, \ac{sps}, \ac{pps} and the newly introduced \ac{vps}\cite{HEVCHighLevelReferenceDez2012}.
% \ac{sps} include sequence related information, that include the decoder operation point, flags to enable or disable certain tools within a given profile. \Gls{pps} include picture related information, that may change for every picture, e.g., \ac{qp} and tilling information.
The new set of parameters \ac{vps} contains information related to the different layers of the video signal, avoiding duplications like in the \ac{h264} and its extensions. \Gls{vps} aims to provide signalling for every layer, guaranteeing an extendible standard, capable of supporting multiple layers.
Moreover, \ac{vps} also carries information for session negotiation (\emph{e.g.} profile, level and tier).
The \ac{sps} contains information related to the whole sequence (\emph{i.e.}, should affect all coded slices) and related to the decoder operation point, as well as flags to control optional tools and scalability.
The \ac{pps} is responsible to carry information that may change for every picture, such as, initial \ac{qp}, flags for picture related tools and tilling information.
\subsection{Picture types}
The \ac{hevc} standard supports several pictures types, as show in Table~\ref{Table2:PictureTypes}, which are classified in the following categories: (i) random-access points, (ii) leading pictures and (iii) temporal sub-layer access pictures~\cite{HEVCHighLevelReferenceDez2012,BookHEVC2014}.
The use of different types of pictures allows the \ac{hevc} stream to be more flexible, support a wider range of applications and achieve robust video communications.
They are important to perform random-access, which is a critical feature for channel switching, seek operations and dynamic streaming services.
Moreover, introducing random-access points into the bitstream increases its error robustness as they provide anchor points for a clean decoding after data loss or synchronisation problems.
\begin{table}[tb]
\centering
\caption{Picture categories in HEVC standard.}\label{Table2:PictureTypes}
\TABLESVSPACE\small
\begin{tabular}{m{1.3cm}|m{5.2cm}|m{6.3cm}}
\toprule
\multicolumn{3}{c}{\textbf{Random-access points pictures}} \\
\midrule
IDR &
Instantaneous decoding refresh &
All leading pictures can be decoded \\
\midrule
CRA &
Clean random access &
Pictures in the display order can be decoded\\
\midrule
BLA &
Broken link access &
Leading pictures cannot be decoded \\
\midrule \midrule
\multicolumn{3}{c}{\textbf{Leading pictures}} \\
\midrule
RADL & \multicolumn{2}{l}{Random access decodable picture}\\
\midrule
RASL & \multicolumn{2}{l}{Random access skipped picture}\\
\midrule\midrule
\multicolumn{3}{c}{\textbf{Temporal sub-layer access pictures}} \\
\midrule
TSA &
Temporal sub-layer access &
Allows switching to a given temporal layer or higher \\
\midrule
STSA &
Step-wise temporal sub-layer access &
Allows switching to a given layer only \\
\bottomrule
\end{tabular}
\end{table}
\subsubsection{Random-Access Point}
The \ac{rap} are pictures used to provide access points in the bitstream with no dependencies, where it is possible to start the decoding process. The standard defines that a conforming bitstream must start with a \ac{rap} picture.
These frames must belong to temporal sub-layer 0 and should be coded using intra coding techniques, i.e., must not use previously coded frames as reference.
One should note that there may be frames compressed with intra prediction only, but not be marked as random-access points.
It is always possible to start decoding from a \ac{rap} frame onwards, and to output any subsequent pictures in the display order, even if all pictures that precede the \ac{rap} in the decoding order are discarded from the bitstream.
The \ac{idr} frame is an intra-coded picture that completely refreshes the decoding process, i.e., cleans the decoder picture buffer preventing predictions to previously coded frames, starting a new conforming video stream. This means that neither the \ac{idr} nor any other subsequent frame in the decoding order have prior dependencies. \ac{idr} frames are allowed to have leading pictures, i.e., frames that follow the \ac{rap} picture in the decoding order but precede it in the display order. However, they must be decodable, thus creating a true random-access point where all subsequent frames in the decoding order can be decoded and displayed.
Introducing \ac{rap} reduces the coding efficiency since no prior reference frames can be used.
In order to reduce this impact, the \ac{hevc} standard introduces a new \ac{rap} picture, referred to as \ac{cra} picture.
These frames do not refresh the decoding process, allowing leading pictures to depend on frames that precede the \ac{cra} picture in the decoding order.
This enables a more efficient prediction structure, while maintaining an access point to begin the decoding process.
However, it results in leading pictures which may not be decodable, which are explained in the next sub-section.
The introduction of \ac{cra} frames in \ac{hevc} was able to improve the coding efficiency by up to 6\% \cite{HEVCCRAPics2011}.
% TODO: Deves saber o porque desta diferença ^
The \ac{hevc} supports bitstream splicing, which means taking a particular bitstream from a \ac{rap} (both \ac{idr} and \ac{cra} frames) and inserting it into another bitstream at a random-access point.
In case of bitstream splicing, starting from an \ac{idr} frame, the leading pictures do not have dependencies from frames prior the \ac{rap}, thus all frames are decodable.
However, whenever this is performed for a bitstream starting from a \ac{cra} frame, the leading associated frames might not be correctly decoded, because some of their reference pictures are not present in the combined bitstream.
To make the splicing operation straightforward, the \ac{nal} units containing the \ac{cra} picture are changed to the type \ac{bla}. Therefore, the decoder is aware that the leading frames should be discarded, namely the \ac{rasl} pictures.
\subsubsection{Leading and trailing pictures}
Leading pictures correspond to frames that follow a particular \ac{rap} frame in the decoding order, but precede it in the display order.
A trailing picture is a frame that follows a particular \ac{rap} frame in both decoding and display order.
%A trailing picture is a frame that follows a particular \ac{rap} frame in both decoding and display order and must not depend on any leading frames nor any trailing frame associated to a previous \ac{rap}.
Figure~\ref{Figure2:LeadingTralingPics} shows examples of leading and trailing pictures. In the figure, frames are illustrated in the display order and the number associated with the frame type (i.e., I, P and B) represents the decoding order. In this example frame $I_1$ corresponds to a \ac{cra} picture.
Leading and trailing pictures are considered to be associated with the closest previous \ac{rap} picture in decoding order, such as frame $I_1$ in Figure~\ref{Figure2:LeadingTralingPics}.
Also, all leading frames of a \ac{rap} frame must precede in decoding order all trailing frames that are associated with the same \ac{rap}. This means that the following order is imposed by the \ac{hevc} standard: 1) \ac{rap} picture, 2) associated leading pictures and 3) associated trailing pictures.
Due to the introduction of more flexible random-access points using \ac{cra} pictures, it is important to mark the leading and trailing pictures, so the decoder can be aware of which frames can be correctly decodable whenever it starts decoding the bitstream.
\begin{figure}[tb]
\centering
\input{\FigsPath/PictureTypes_Leading_Trailing.tikz}
\caption{Leading and trailing pictures associated with the random-access point $I_{1}$ (letters corresponds to the coding type and the numbers to the coding order).}
\label{Figure2:LeadingTralingPics}
\end{figure}
There are two types of leading pictures, as shown in Table~\ref{Table2:PictureTypes}.
The \ac{radl} pictures, which can be correctly decoded, since they only depend on the associated \ac{rap} picture and do not have any prior dependencies to trailing pictures associated with the previous \ac{rap} frame.
On the contrary, the \ac{rasl} pictures may have dependencies to prior trailing pictures.
When a random-access is performed at the associated \ac{rap} frame, these frames cannot be correctly decoded, therefore they have to be skipped.
In the example of Figure~\ref{Figure2:LeadingTralingPics} the leading pictures correspond to \ac{rasl} pictures.
\subsubsection{Temporal sub-layer switching pictures}
A \ac{tsa} picture is a trailing picture that marks a temporal layer switching point.
When decoding a sub-set of temporal layers, if a \ac{tsa} picture is found in the temporal layer just above the maximum temporal layer currently being decoded, it is possible to start decoding any number of additional temporal layers.
For example, frame $P_6$ in Figure~\ref{Figure2:TSAExample} is considered a \ac{tsa} picture since it only depends on a frame belonging to temporal layer 0 for prediction, as well as, any subsequent frame predicted from the \ac{tsa} frame $P_6$.
In this example, if the decoder is only decoding the temporal layer 0, after decoding $P_6$ it can also decode layer 1, or decode all the available three layers.
Although these frames allow higher flexibility in terms of layer switching, they severely constrain the prediction of frames following the \ac{tsa} picture.
\begin{figure}[tb]
\centering
% \includegraphics[width=0.75\columnwidth]{\FigsPath/HEVC/Pictures_TSA}
\input{\FigsPath/PictureTypes_TSA.tikz}
\caption{Temporal layers access pictures example with three layers ($T_0$ to $T_2$).}
\label{Figure2:TSAExample}
\end{figure}
To reduce the constrains in frame prediction due to layer switching, \ac{hevc} introduces the \ac{stsa} picture.
These pictures have similar purpose as the \ac{tsa} frames, but they only guarantee that frames in the same temporal layer as the \ac{stsa} frame are able to be correctly reconstructed.
%This is guaranteed by avoiding any dependencies from frames preceding the \ac{stsa} to be used as reference in its temporal layer.
This is guaranteed by not using frames preceding the \ac{stsa} as reference in its temporal layer.
One example of a \ac{stsa} frame is also shown in Figure~\ref{Figure2:TSAExample} in frame $P_2$.
This frame can be used to switch to layer 1, as it does not have dependencies to any prior frame in the same layer ($P_2$ only depends on $P_0$).
However, it cannot be classified as \ac{tsa} picture because $P_3$ has dependencies to a prior frame in the decoding order ($P_1$).
Summarising, \ac{stsa} frames can be used to switch to a particular layer, as \ac{tsa} frames can be used to switch to any layer.
\subsection{Picture partitioning}
The high-level segmentation of a picture in \ac{hevc} is achieved by using four different approaches associated to different data structures: regular slices, dependent slices, tiles and \ac{wpp}.
Picture partitioning normally serves one or more of the following three purposes:
\begin{description}
\item[Error robustness:] partitioning the picture into smaller self-contained units in
order to increase error robustness, allowing to re-synchronize both the parsing and decoding
processes in case of data losses.
\item[Network adaptation:] adapt to the network constraint of \ac{mtu} size, found for example in \ac{ip} networks.
Such packetisation scheme restricts the maximum number of payload bits within a slice regardless the size of the coded frame. To keep each slice within this limit and minimise the packetisation overhead, a variable number of coding units is used for each slice.
\item[Parallel processing:] partitioning the coded frame into processing data units, which can be encoded in parallel. This is achieved by dividing the coding units such that they can be encoded and decoded independently of each other’s.
\end{description}
\subsubsection{Slices}
The \ac{hevc} standard preserves the slice structure previously defined in the \ac{h264} standard. A slice may comprise either the entire frame or a section of it, and all the associated data (\emph{i.e.}, entropy symbols, prediction and residue information) can be independently decoded. Each slice is transported in a different \ac{nal} unit.
As some dependencies across slice boundaries are disabled, each slice can be independently reconstructed, regardless whether previous slices were lost or incorrectly decoded. Slice partitioning is the only tool that can be used for parallel processing in a virtually identical form as in \ac{h264}.
As each slice is independent from each other, it is straightforward to process multiple slices in parallel, without inter-process communication (except for inter-frame prediction). Although this is a simple approach, it incurs in substantial coding overhead due to the higher number of slice headers, and reduction of causal neighbours for prediction (due to lack of predictions across slice boundaries). Another disadvantage of using slices for parallel processing is that they are also used to meet the \gls{mtu} size constrains. Therefore, it might be impossible to meet both requirements using only one technique.
Another partitioning tool in \ac{hevc} standard is the dependent slices. These types of slices allow the partitioning of a frame at the coding unit boundaries without breaking intra-frame predictions. Moreover, as they have a smaller slice header they are more efficient in terms of signalling overhead than regular slices. Dependent slices are normally used to reduce the end-to-end delay by allowing part of the slice to be transmitted while the rest of its data is still being processed.
\subsubsection{Tiles}
A new data partition has been included in the \ac{hevc} standard, referred to as Tiles\cite{HEVCTilesDec2013}. Tiles enable the partition of a coded frame into a smaller group of \acs{ctu} using horizontal and/or vertical boundaries. Figure~\ref{Figure2:HEVCTiles} shows two examples of slice partitioning using tiles. In both cases the frame is partitioned into three tiles by using two vertical boundaries. By only using boundaries to define tiles, signalling is achieved with a small overhead. These boundaries are defined in the \ac{pps} \ac{nal} units.
\begin{figure}[tb]
\centering
\begin{tabular}{x{.45\columnwidth}x{.45\columnwidth}}
\input{\FigsPath/Tiles_Slices_Example_1.tikz} &
\input{\FigsPath/Tiles_Slices_Example_2.tikz} \\
(a) & (b) \\
\end{tabular}
\caption{Examples of the interaction between tiles and slices.}
\label{Figure2:HEVCTiles}
\end{figure}
Although the \ac{hevc} standard enables the use of both slices and tiles at the same time, some constrains are imposed in order to reduce the implementation complexity.
One of two cases must be used: (i) all \acs{ctu} within a tile belong to the same slice, or (ii) all \acs{ctu} within a slice belong to the same tile. These cases are illustrated in Figure~\ref{Figure2:HEVCTiles} (a) and (b), respectively.
The use of tiles provide several advantages. Specifically, they improve frame partitioning for parallel processing~\cite{WPPTilesParallelHEVC2017} when compared to slices, by reducing the required overhead. Moreover, they also improve the \ac{mtu} size matching and reduce the line buffer memory (by dividing the frame as in Figure~\ref{Figure2:HEVCTiles}). Finally, as tiles allow flexible partitioning, they enable the definition of \acs{roi} for asymmetric video coding.
\subsubsection{Wavefront Parallel Processing}
As mentioned before, the use of either slices or tiles to process each frame using parallel threads requires the use of different entropy coding contexts for each slice/tile, in order to make them independently decodable. As a consequence, the compression efficiency decreases. In order to overcome this issue, the concept of \ac{wpp} was introduced, which enables coding using efficient parallel processing~\cite{HEVCParallelCSVT2016}.
In \ac{wpp}, each slice (or tile) is divided into single rows of \acs{ctu} which can be processed in parallel, but entropy coding and prediction are enabled across \acs{ctu} of different rows, in order to avoid loss in coding efficiency.
To re-use the same context in the whole slice (or tile) each row requires a delay of two \acs{ctu} in order to ensure that all necessary dependencies have already been encoded/decoded. Figure~\ref{Figure2:WPP} illustrates an example of \ac{wpp} using at least five different threads.
Each square corresponds to a \ac{ctu} and the numbers correspond to the time instance when a \ac{ctu} starts being processed. Using this staggered start, which appears like a wavefront, as represented in Figure~\ref{Figure2:WPP}, the parallelisation may use as many threads as the number of \acs{ctu} rows available in the video frame. However, although the number of threads does not affect the coding efficiency, the required inter-process communication substantially increases.
\begin{figure}[tb]
\centering
\input{\FigsPath/WPP.tikz}
\caption{Illustration of the wavefront parallel processing (numbers corresponds to the time instant each \ac{ctu} is processed).}
\label{Figure2:WPP}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Data structures}
\label{Section2:CodingStructures}
Despite the fact that the \ac{hevc} standard follows a traditional hybrid video coding architecture, it introduces significant changes in the data structures when compared to the previous standards (e.g., \ac{h264}).
In \ac{h264} each frame is divided into units so-called \acs{mb}, which are composed by a $16\times16$ block of luma samples and two $8\times8$ blocks of chroma samples, assuming video data in YUV 4:2:0 chroma sub-sampling.
The \ac{mb} is considered the basic processing unit in the \ac{h264}, and the respective coding mode defines whether the corresponding pixels are coded as intra or intra prediction.
Each \ac{mb} could also be partitioned into sub-blocks, which should follow the same prediction mode.
The basic data structures in \ac{hevc} are quite different from \ac{h264}. Each picture is divided into blocks named as \ac{ctu}~\cite{BlockPartHEVC2012}. The maximum \ac{ctu} size is an encoder configuration parameter that is signalled to the decoder, and should be one of the following: $64\times64$, $32\times32$ and $16\times16$ pixels. The use of data structures with larger size in \ac{hevc} was adopted to achieve higher coding efficiency especially in high resolution video. Each \ac{ctu} can be recursively partitioned into four smaller units, referred to as \acs{cu}, until it reaches the minimum unit size, which cannot be smaller than $8\times8$ pixels.
Similar to the maximum \ac{ctu} size, the minimum size is also defined at the encoder.
For instance, in case of homogeneous regions, large \acs{cu} can be used to represent such regions by using a smaller number of symbols than in the case of using several small units.
Figure~\ref{Figure2:HEVCCodingStructure} illustrates an example of a \ac{ctu} partitioning into \acs{cu}.
The partitioning illustrated in the figure leads to the quad-tree structure represented on the left side with the corresponding coding order shown on the right side.
Data structures in \ac{hevc} provide a significant improvement in comparison with previous standards, by eliminating the distinction between \ac{mb} and sub-\ac{mb} and using only the \ac{cu} concept. This allows for the multilevel hierarchical quadtree structure to be specified in a simple and elegant way, with size-independent syntax representation.
\begin{figure}[t]
\centering
\input{\FigsPath/BlockPartitionsWithTree.tikz}
\caption{Representation of a CTU ($64\times64$) and its partitioning into CUs and PUs (left); corresponding quad-tree with coding order (right).}
\label{Figure2:HEVCCodingStructure}
\end{figure}
The \ac{cu} is the basic processing unit in \ac{hevc}.
It is further partitioned into two types of units, specifically \ac{pu} and \ac{tu}, which are data blocks used for prediction and transform operations, respectively.
The decision whether to use intra-frame or inter-frame prediction modes is taken at the \ac{cu} level. However, depending on the partitioning of the \ac{cu} into \acs{pu}, different intra or inter coding modes can be used for each \ac{pu}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Prediction modes}
\label{Section2:PredictionModes}
Prediction techniques play an important role in image and video coding standards, due to their ability to reduce the signal redundancy based on the previously encoded pixels.
These techniques include the directional intra prediction for efficiently reduce spatial redundancy, and inter-frame motion compensation to remove the temporal redundancies.
This section describes the prediction techniques used in the \ac{hevc} standard that comprises different algorithms.
\subsection{Intra-frame prediction}
Intra-frame prediction is used to efficiently reduce the spatial redundancy within video frames.
Intra predicted blocks are obtained using the previously encoded pixels around the current \ac{pu}.
When the intra prediction mode is chosen for a \ac{cu}, the size of the \ac{pu} needs to be the same as the \ac{cu}, except when the smallest \ac{cu} size is selected and further division into four \acs{pu} is allowed.
For example, when the smaller \ac{cu} size is $8\times8$, the encoder may decide to divide it into four \acs{pu} of $4\times4$ pixels, each one having its own intra prediction mode. This is signalled using a binary flag.
The use of small \acs{pu} is useful for regions with many details that require fine-granularity prediction.
In \ac{hevc} there are 35 intra-frame prediction modes: Planar, DC and 33 angular modes, as shown on the left of Figure~\ref{Figure2:IntraModesHEVC}~\cite{IntraCodingHEVC2012,HEVCIntraperformance2012}.
For each \ac{pu}, the encoder chooses among all the available intra prediction modes the best mode to be used by the decoder, based on the previously reconstructed pixels also available for similar prediction at the decoder.
The reconstructed reference pixels used in the prediction process belong to the neighbouring blocks located at left-down, left, top-left, top and top-right positions, as
can be seen in the example shown on the right in Figure~\ref{Figure2:IntraModesHEVC}.
Given a $N \times N$ \ac{pu}, intra prediction requires the top neighbouring row of $2N$ pixels, the left column of $2N$ pixels and the top-left neighbouring pixel.
Due to data unit boundaries (e.g., slice or tile boundaries) and constrained intra prediction (i.e., reference pixels belonging to inter-predicted \acs{pu} are not used in order to remove error propagation from potentially erroneous reconstructed reference frames), neighbouring pixels might not be all available to be used as reference for intra prediction, resulting in an incomplete set of neighbouring reference pixels.
In order to overcome this issue and to allow all possible modes, \ac{hevc} uses reference sample substitution to replace the unavailable reference pixels with the closest available ones, so that all intra prediction modes can be used.
\begin{figure}[tb]
\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{x{.55\columnwidth}x{.45\columnwidth}}
\input{021_VideoCoding/Figures/IntraPredictions.tikz} &
\input{021_VideoCoding/Figures/IntraPredictionsDirectional.tikz} \\
\end{tabular}
}
\caption{Directional intra prediction modes in HEVC (left) and an example of the intra prediction mode 32 for a $4\times4$ block.}
\label{Figure2:IntraModesHEVC}
\end{figure}
\subsubsection{Angular modes}
Directional intra prediction was first introduced in the \ac{h264} standard~\cite{H264OverviewJul2003} to estimate regions with a structured texture or directional edges.
Directional prediction projects the reconstructed samples in the block neighbourhood (see reference pixels in Figure~\ref{Figure2:IntraModesHEVC}) along a specific direction. The \ac{hevc} increases the number of possible directions from 8 (in \ac{h264}) to 33~\cite{IntraCodingHEVC2012}. The direction of each projection is illustrated in the left-side of Figure~\ref{Figure2:IntraModesHEVC} by the directional modes 2 to 34.
%In the figure it is possible to notice that directional modes 2 to 10 only project the pixels from the left neighbouring border in a horizontal direction, modes 10 to 25 use both the left and top neighbouring pixels in a diagonal direction and modes 26 to 34 project the top neighbours in vertical direction.
As shown in Figure~\ref{Figure2:IntraModesHEVC}, the angular modes are designed to provide a dense coverage near the horizontal (i.e., mode 10) and vertical (i.e., mode 26) directions.
Moreover, the angular directions are coarser as it gets closer to the diagonals.
This reflects the observed statistical prevalence of the angles and the prediction efficiency.
To improve the efficiency of angular prediction, when the reference samples need to be projected, a bilinear interpolation is used from the two closest pixels using a $1/32$ accuracy. The dashed arrows on the right of Figure~\ref{Figure2:IntraModesHEVC} correspond to a projection of interpolated pixels.
\subsubsection{Planar and DC}
The Planar and DC modes are particularly efficient in the prediction of smooth regions.
The DC mode uses the average or the neighbouring reference samples to generate a constant prediction for the current \ac{pu} as a whole, i.e., all pixels are predicted from the same value.
The Planar mode predicts the \ac{pu} through a linear interpolation from the four closest neighbouring reference pixels. Figure~\ref{Figure2:IntraModePlanar} shows the reference pixels (i.e., $p_1$, $p'_2$, $p_3$ and $p'_4$) and arrows pointing to the pixel being predicted.
Since the right and bottom neighbourhood is not available (not coded yet), the same pixel $p_2$ is repeated to form a column of reference pixels, marked with an ellipse in Figure~\ref{Figure2:IntraModePlanar}. A similar approach is also used to create the bottom row of reference pixels from the pixel $p_4$ .
%As the Planar mode used linear surface for prediction it prevents the discontinuities at \ac{pu} boundaries.
\begin{figure}[tb]
\centering
\input{021_VideoCoding/Figures/IntraPredictionPlanar.tikz}
\caption{Example of Planar prediction for a $4\times4$ block.}
\label{Figure2:IntraModePlanar}
\end{figure}
\subsubsection{Sample smoothing}
In \ac{hevc} sample smoothing is applied in two distinct cases to improve the overall performance of the prediction accuracy.
Firstly, the reference samples are filtered and secondly the \ac{pu} is filtered after prediction.
%In comparison with previous standard \ac{h264}, where only reference samples were filtered.
In \ac{hevc}, the reference sample smoothing is conditionally applied, based on the \ac{pu} and intra prediction mode. Similar to \ac{h264}, a three-tap smoothing filter (i.e., $\left[1\ 2\ 1\right]/4$) is applied, except for \ac{pu} sizes of $4\times4$. The prediction resulting from Planar mode is also filtered when the \ac{pu} size is greater than $8\times8$, and it is not used for the DC mode.
The second filter in \ac{hevc} is the boundary smoothing. This filter aims at removing the discontinuities along block boundaries due to intra prediction.
This filter is only applied when the block size is smaller than $32\times32$ to the DC, and angular modes 10 and 26 (exactly the horizontal and vertical directions, respectively).
For the DC mode a two-tap filter ($\left[3\ 1\right]/4$), fed by the original predicted value and the adjacent reference sample is applied to both the top row and the left-most column of predicted pixels.
In the case of angular mode 10 (horizontal direction), only the predicted samples of the first column are changed by adding half of the difference between the adjacent reference sample and the top-left reference sample.
A similar filtering is done for angular mode 26 (vertical direction), but only for the first row
of predicted samples.
Only the mentioned boundaries are filtered, as they are the ones most likely to introduce discontinuities.
\subsection{Inter-frame prediction}
The efficiency of video coding algorithms consistently relies on inter-frame prediction techniques to reduce temporal redundancy.
The underlying idea of inter-frame prediction is to estimate the current frame from one or more previously encoded frames used as reference with block-based motion compensation. The most common technique used for motion estimation in \ac{hevc} is the block matching algorithm. In the \ac{hevc} standard an \ac{amvp} is used for efficient motion vector coding, which defines the Merge Mode and differential coding of the motion information.
\subsubsection{Motion estimation and compensation}
Motion estimation consists in searching for a block with the highest similarity with the current block to be predicted (\ac{pu} in \ac{hevc}), using block-matching algorithms over previously encoded frames, i.e. the reference frames.
Typically, reference frames correspond to past or future temporally adjacent frames.
The frame encoding order determines which references are selected and which future frames are available.
The reference block that results in the lowest error is selected as the best block for prediction.
To identify the best matching block to be used for motion compensation, the difference between the target and the reference block positions is encoded as a two-dimensional \ac{mv}.
The \ac{hevc} allows for either one or two \acs{mv} to be used for each \ac{pu}. Video frames of type P are predicted from one single reference (one \ac{mv}), while frame of type B are predicted from two references (two \acs{mv}).
This results in uni-direction or bi-directional coding, respectively.
Furthermore, weighted prediction can also be used, which consists in scaling and offset operations performed on the prediction block to improve efficiency.
The \acs{mv} only refer to frames included in a reference frame list, where each frame is identified by an index. Therefore, to fully describe inter-frame prediction a combination of two parameters is required: \ac{mv} and reference frame index.
Since MPEG-2, motion estimation/compensation has been performed using blocks of variable size.
In \ac{h264} block sizes ranging from $4\times4$ up to $16\times16$ pixels are allowed, while \ac{hevc} extends the possible block sizes up to $64\times64$ pixels, and also to asymmetric rectangular block sizes.
By using larger prediction units less \acs{mv} are required, thus fewer bits are spent in coding motion information.
In order to increase the efficiency of motion estimation fractional \acs{mv} are used, which has been proven to improve motion compensation accuracy.
This is accomplished through interpolation to generate non-integer pixels in the reference frame, resulting in \acs{mv} up to quarter-pixel accuracy for luma samples.
For chroma samples, the \ac{mv} accuracy is determined according to the chroma sampling format, which for 4:2:0 results in eighth-pixel accuracy.
In contrast with the two-stage approach used in \ac{h264}, \ac{hevc} uses a single separable approach for the interpolation process without intermediate rounding operations. This improves the precision and simplifies the architecture of the fractional interpolation.
The partition size as well as the \ac{mv} are selected using a \ac{rd} optimisation which considers both the number of bits required to code the motion information and the video distortion.
The block matching-based motion estimation is one of the most computationally intensive procedures in video encoders.
In general, the optimal solution for motion estimation is provided by the full-search algorithm, which tests all the possible candidate blocks in the search area. However, although the full-search algorithm achieves the optimal performance, it requires the highest computational complexity.
Therefore, sub-optimal algorithms have been proposed over the years to reduce the motion estimation complexity and decrease encoding time~\cite{HEVCME2012,HEVCME2017,HEVCME2014}.
For example, the \ac{hm} software implements a fast algorithm based on Test Zone Search~\cite{HEVCME2012}.
Since motion estimation is a non-normative procedure, encoders may implement any alternative motion search algorithms.
\subsubsection{Reference picture management}
Another improvement in \ac{hevc} is related with the reference picture management scheme. \ac{hevc} introduces the \ac{rpset} concept~\cite{HEVCHighLevelReferenceDez2012}, which defines how previously decoded pictures are managed in the \ac{dpb}.
Decoded frames in the \ac{dpb} are grouped in one of the following categories: (i) \emph{short-term reference}, (ii) \emph{long-term reference} and (iii) \emph{unused for reference}.
Once a frame is marked as \emph{unused for reference} it is no longer used for motion compensation and it will be discarded from the \ac{dpb} after being displayed.
In \ac{h264} a sliding window approach is used to implicitly manage the reference picture list.
This process discards a given frame whenever the \ac{dpb} has stored the maximum number of reference frames (which is defined and controlled by the encoder).
Moreover, \ac{h264} uses an explicitly \ac{mmco} to send commands to the decoder and change the normal reference picture management process.
In the \ac{hevc} standard the status of the \ac{dpb} is encoded for every slice, instead of the implicit managing used in the past.
The most fundamental difference in \ac{rpset} concept compared to \ac{mmco}/sliding window of \ac{h264} is that each particular frame has a complete set of the reference frames that are used or will be used.
Thus, a complete set of all frames that must be kept in the \ac{dpb} is explicitly provided.
This is different from \ac{h264} where only relative changes to the \ac{dpb} are encoded.
With the \ac{rpset} concept, no information from earlier frames in decoding order is needed to maintain the correct status of the \ac{dpb}.
Table~\ref{Table2:ReferencePictureListExample} shows the \ac{rpset} for some frames illustrated in Figure~\ref{Figure2:LeadingTralingPics}.
As expected, for the \ac{cra} frame ($I_1$) no information is sent to the decoder because there is no inter-prediction and the \ac{dpb} should be empty.
For the remaining frames, two types of information are encoded: frame number and a binary flag to indicate whether it is currently used. This is required because any frame not listed in a given \ac{rpset} will be discarded by the decoder and then subsequent frames cannot use them as reference.
\begin{table}[tb]
\centering
\caption{Reference picture set example.}
\label{Table2:ReferencePictureListExample}
\small
\TABLESVSPACE
\begin{tabular}{x{1.5cm}|ccc}
\toprule
Frame & \multicolumn{3}{c}{\ac{rpset} (\{frame, is used\}) } \\
\midrule
$I_1$ & -- & & \\
$P_5$ & \{$I_1$, 1\} & & \\
$B_6$ & \{$I_1$, 1\} & \{$P_5$, 1\} & \\
$B_7$ & \{$I_1$, 1\} & \{$B_6$, 1\} & \{$P_5$, 0\}\\
$B_8$ & \{$B_6$, 1\} & \{$P_5$, 1\} &\\
\bottomrule
\end{tabular}
\end{table}
The \ac{rpset} concept provides a basic level of error robustness to the reference picture management.
In \ac{h264}, whenever a reference frame is lost the decoder can look at the value of the \emph{FrameNum} (incremental value associated with each reference frame) to detect the loss event.
However, as gaps in \emph{FrameNum} are allowed, the decoder might not be able to decide whether the missing frame was intentional or resulted from a transmission loss event.
%Moreover, even if the decoded if able to detect the loss event it might not be able to correctly compute the value the \ac{poc} associated with the concealed frame.
Using the \ac{rpset} concept, the decoder is always able to detect loss events and correctly identify the missing frames.
\subsubsection{Asymmetric block partitions}
When inter prediction mode is selected, a higher range of partitioning schemes is allowed, thus dividing the \ac{cu} into one, two or four \acs{pu}.
The splitting into four \acs{pu} is only allowed when the \ac{cu} size is equal to the minimum.
%Otherwise, the splitting should be carried out at the \ac{cu} level which leads to the same partition tree.
Figure~\ref{Figure2:InterPuPartitions} illustrates the possible \ac{cu} partitioning into \acs{pu}.
%One should note that the partition type applied to the \ac{cu} is also applied to divide the \ac{cb} into \acs{pb}.
Figure~\ref{Figure2:InterPuPartitions}~(a) shows the symmetric partitions.
The $N \times N$ corresponds to the case where the \ac{cu} is not further divided.
The \ac{hevc} standard defines the horizontal and vertical division into two \acs{pu}, corresponding to the $\frac{N}{2}\times N$ and $N \times \frac{N}{2}$ cases, respectively.
Finally, the $\frac{N}{2} \times \frac{N}{2}$ case results in four \acs{pu}.
The partitions shown in Figure~\ref{Figure2:InterPuPartitions}~(b) correspond to the asymmetric partitioning, which is one of the main improvements introduced in \ac{hevc}, as it allows higher flexibility in motion estimation, leading to higher compression efficiency~\cite{HEVCBlock2012}.
These partitions types are only allowed for \acs{cu} with $16\times16$ pixels or larger.
\begin{figure}[tb]
\centering
\begin{tabular}{x{.8\columnwidth}x{.1\columnwidth}}
\input{\FigsPath/PUSymetric.tikz} & (a)\\
\input{\FigsPath/PUAsymetric.tikz} & (b)\\
\end{tabular}
\caption{Partition types of an inter-coded CU into PUs; in (b) the size (and position between parentheses) corresponds to the smaller partition~\cite{HEVCBlock2012}.}
\label{Figure2:InterPuPartitions}
\end{figure}
\subsubsection{Merge mode}
The Merge mode was introduced in \ac{hevc} as a new technique to derive motion information from spatial and temporal neighbouring blocks~\cite{MotionCodingHEVC2013}. This technique extends the concepts of the Direct and Skip modes used in \ac{h264}~\cite{H264OverviewJul2003}, using a more sophisticated approach with two key differences.
Firstly, the Merge Mode allows for more \ac{mv} candidates than the Skip in \ac{h264}.
Thus, an index is used to identify one out of several \ac{mv} candidates.
Secondly, the reference picture index is explicitly identified.
This results in improved flexibility, compared with the predefined values used in \ac{h264}.
The \ac{mv} candidates allowed in the Merge Mode\cite{MotionCodingHEVC2013} are illustrated in Figure~\ref{Figure2:MVCandidates}.
The figure shows the positions of the spatial \ac{mv} candidates ($A_0$, $A_1$, $B_0$, $B_1$, $B_2$).
Moreover, it also uses a temporal \ac{mv} candidate, derived from the co-located position on the temporally adjacent frame, at positions $T_0$ or $T_1$. From the \ac{mv} candidate list the unavailable candidates are not considered, and duplicated candidates (i.e. with the same motion information) are removed.
The Merge Mode uses a $C-1$ spatial \ac{mv} candidates, selected from the aforementioned order, and one \ac{tmvp} to fulfil the total number of $C$ \acs{mv}. The value of $C$ is defined at the slice header and a flag controlling the use of \ac{tmvp} is encoded at the \ac{pps}-level.
For B-slices, additional \ac{mv} candidates are considered by choosing two existing candidates, according to a predefined order for reference picture list 0 and list 1. A total number of twelve combinations are specified in \ac{hevc}, which are listed in~\cite{HEVCOverviewDez2012}. For P-slices, if the number of candidates is less than $C$, then zero \acs{mv} are included to fill the remaining entries.
\begin{figure}[tb]
\centering
\input{\FigsPath/MergeModeHEVC.tikz}
%\input{\FigsPath/HEVC/MergeModeHEVCTwoFrames.tikz}
\caption{Illustration of the MV prediction candidates in the AMVP and Merge Mode mode.}
\label{Figure2:MVCandidates}
\end{figure}
The Merge Mode defines how to encode the \ac{mv} candidate and the residual information.
In \ac{hevc}, the Skip mode, i.e., transmitting only the \ac{mv} without residual information, is treated as a special case of the Merge Mode.
In this case, only a skip flag is enabled and the corresponding merge index is transmitted.
\subsubsection{Motion vector prediction}
The \ac{hevc} also improves the performance of \ac{mv} coding for those cases where the Merge Mode is not used.
A differential encoding approach is always used for efficiently representing the motion information.
It considers the same \ac{mv} candidates of the Merge mode, illustrated in Figure~\ref{Figure2:MVCandidates}, to derive the \ac{mv} predictors from which the differential vector is obtained.
From these \ac{mv} candidates only the first two available candidates are selected, based on the following order:
\begin{enumerate}
\item Left candidate: first available from $A_0$ and $A_1$.
\item Top candidate: first available from $B_0$, $B_1$ and $B_2$.
\item Temporal candidate: first available from $T_0$ and $T_1$.
\end{enumerate}
Therefore, the use of the temporal \ac{mv} candidate is limited to those cases where the spatial neighbours are not able to provide two valid candidates.
For \ac{mv} prediction only a much lower number of candidates is allowed, since the encoder can still send the \ac{mv} difference. Moreover, the encoder performs motion estimation for each candidate, which increases the encoding complexity for every possibility tested.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Transform and quantisation}
\label{Section2:TransformQuant}
Similarly to the previous standards, \ac{hevc} uses a transform followed by quantisation to compress the residual signal.
The residual block is partitioned into multiple square blocks, referred to as \acs{tu}.
\subsubsection{Core transform}
A 2D transform of the residual information is obtained by applying 1D transforms in both the horizontal and vertical directions. The core transform matrices are obtained from the \ac{dct} basis functions to define a integer matrix of $32\times32$ points. Sub-sampled versions of this matrix are used to derive the remaining transform matrix sizes down to $4\times4$.
A special case is applied for coding the residual of $4\times4$ intra-coded block.
In this case an alternative integer transform based on the \ac{dst} is used.
The motivation for \ac{dst} is related to the statistics of the residual signal of these blocks, which tend to present higher residue as the distance to the boundary used for prediction (i.e, top or left boundary) increases.
Simulation studies have shown that \ac{dst} provides up to 1\% of bitrate savings for the compression of $4\times4$ intra predicted blocks, without significantly increasing the computational complexity \cite{DCTDSTComp2013}.
\subsubsection{Quantisation}
The \ac{hevc} follows the same principle as previous standards in terms of quantisation.
After applying the transform operation to the prediction residue, a quantisation is applied to the resulting coefficients using a uniform-reconstruction quantiser scheme based on a \ac{qp}.
The standard supports \ac{qp} values ranging from 0 to 51, where an increase of 6 in the \ac{qp} corresponds to doubling the quantisation step.
This procedure is the main cause for the coding distortion, as it performs a many-to-one mapping, which cannot be reversed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Entropy coding}
\label{Section2:Entropy}
\ac{hevc} only uses the \ac{cabac}, which is an arithmetic coding method that only uses binary symbols, considering different probability models for each symbol~\cite{H264Cabac2003}.
Entropy coding efficiency is closely linked with the context model selected. Therefore, this was carefully designed in the \ac{hevc} standard, extending the functionality previously defined for \ac{h264}.
For example, the \ac{hevc} standard exploits the depth of the partition tree or residual transform tree, in order to derive the context models for several syntax elements.
Regarding the transform coefficient coding, \ac{cabac} uses a scanning method to firstly organise the coefficients and then encodes the position of the last non-zero transform coefficient.
Moreover, a significance map is also encoded along the sign bits and the levels of the transform coefficients.
Three coefficient scanning methods are available: the diagonal up-right, the horizontal and the vertical scan.
The coefficient scanning is implicitly selected and always performed in $4\times4$ sub-blocks, for all transform block sizes.
% Details about the context models selection and the compression of each syntax element of \ac{hevc} can be found in [1].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{In-loop filters}
\label{Section2:Filters}
The \ac{hevc} standard uses two filtering procedures over the reconstructed pixels before writing them into the frame buffer, namely the \ac{dbf} and the \ac{sao} filter.
The main purpose of the deblocking filter is to reduce blocking artefacts caused by the block-based coding tools.
%, operating similarly to the deblocking filter of the \ac{h264} standard.
\ac{dbf} is applied to the samples that are spatially adjacent to the \ac{pu} or \ac{tu} boundaries, considering a $8\times8$ grid.
Such grid-based restriction reduces the computational complexity and facilitates the parallel-processing, which is one of the main goals of \ac{hevc} design.
Three strength levels can be used by the \ac{dbf}, depending on the coded block characteristics.
The \ac{sao} is a non-linear filter, that is adaptively applied to all samples of the image, after the deblocking filter. In its operation, the \ac{sao} filter modifies the samples
by adding an offset value, extracted from lookup tables transmitted by the encoder.
For each \ac{ctu}, the encoder decides whether to apply the \ac{sao} filter or not, and if used, one of the two filter types is applied, namely the band offset or the edge offset.
In the band offset mode, the added offset value depends on the sample amplitude, while the edge offset uses the gradient to classify and derive the offset value.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SECTION %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Summary}
\label{Section2:Summary}
This chapter was devoted to describe the main features of the \ac{hevc} standard with special emphasis on the high-level features, coding structures and newly introduced prediction modes.
At the high-level, \ac{hevc} introduces new \ac{nal} types and also new pictures types.
These allow the implementation of various random-access strategies, more flexibility and higher coding efficiency than its predecessor \ac{h264}.
Another major improvement comes from the inter-frame prediction. On the one hand new high-level reference picture management was introduced, which increases the error robustness, as it explicitly defines the active reference frames and the \ac{dpb} status. On the other hand it introduces the \ac{amvp} and the Merge mode, which efficiently reduce the required bits for coding the motion information.
The newly developed coding tools and prediction modes described in this chapter have resulted in approximately 50\% of bitrate savings for the same subjective quality in comparison with the previous standard.
However, such high coding efficiency implies higher data dependencies, which are more sensible to data loss and increase the error propagation to subsequent coding structures. Therefore, evaluating the impact of transmission errors and error propagation in \ac{hevc} is of most importance to develop efficient techniques to recover from data loss and reduce the error propagation.