Game Development Reference
In-Depth Information
this method is that under intraprediction modes that have the similar angular direc-
tions, the position of the last CG of the transform coefficients tends to have similar
probability distribution. For example, when the prediction direction is predominantly
horizontal, the residual contains mostly vertical frequency components, and due to
the property of the DCT transform, nonzero transform coefficients tend to be located
close to the left of the transform block and so is the position of the last nonzero
coefficient. Similarly, with prediction direction being predominantly vertical, the
residual contains mostly horizontal frequency components, and accordingly nonzero
coefficients after transform (and also the last nonzero coefficient) tend to be located
close to the top of the transform block. Therefore, when integrating the intrapredic-
tion mode information into the context model design, it is demonstrated to be able to
provide nontrivial performance gains. In the AVS2 intracoding, there are 30 direc-
tional luminance prediction modes and 5 chrominance prediction modes as shown in
The 33 luminance prediction modes are first grouped into three classes based on their
predominant prediction directions, which are Vertical (red lines), Horizontal (black
To avoid the context dilution, the following equation is used to derive the context
index for coding the
LastCGPos
:
⊧
⊨
(
map
(
IntraLumaMode
) >
2
)
∗
3
for luma
for chroma
,
C
LastCGPos
=
+
min
(
binIdx
,
2
)
(6.21)
⊩
min
(
binIdx
,
2
)
wherein the map function returns value 0, 1, and 2 for the predominant prediction
mode equal to Vertical, Horizontal and DC-Diagonal modes, respectively. Therefore,
there are only 6 and 3 context models for luma and chroma components, respectively.
LastCG0flag
is a binary flag and is coded using 2 context, one for luma and another
for chroma. All bins of
LastCGX
or
LastCGY
are coded using two contexts, one for
luma, and another one for chroma. Luma and chroma components are treated in the
same way however with different context model sets.
Based on some statistics, it is shown that one CG may have all zero coefficients.
To utilize such information, one flag
subCbf
is coded for each CG except for the last
CG to indicate whether the corresponding CG has nonzero coefficients or not. The
context model is based on the CG position in the reverse scan order. A total number
of 3 contexts are used (2 for luma and 1 for chroma).
6.3.4.3 Second Level Coding
The second level coding indicates the coding of coefficients within one CG. Figure
6.7
depicts the coding flow for one CG. Basically, it follows the principle of the CBAC
design in AVS1. However, when one CG contains nonzero coefficients (i.e., the
subCbf
of the CG is equal to 1 or it is the last CG), the position of the last nonzero
coefficient in the scan order in the CG is coded instead of coding the EOB flag