Game Development Reference
In-Depth Information
of the last nonzero coefficient, if present, tends to be close to the bottom-right corner
of the sub-block and is also highly correlated to the reverse scan order. It is therefore
more efficient to code its reverse scan position within the CG rather than the
(
x
,
y
)
-
coordinates, i.e., the position relative to the bottom-right position of one CG.
In the context model design of the position of the last nonzero coefficient within
one CG, the bin index of binarized bin strings of
LastPosX/LastPosY
and whether it
is located in the last CG are both taken into consideration. Moreover, a region-based
context selectionmethod is adopted to further improve the coding efficiency. For luma
coding, the intraprediction mode is also considered to distinguish different statistics
of the last position (Wang et al.
2013b
,
c
). Here, we give an example of the context
modeling method for LastPosX, as shown in Eq.
6.22
. For coding
LastPosY
,thesame
context modeling method could be applied but to a different set of context models.
min
,
)
+
(
:
)
+
(
bi n I d x
1
LastCG
?10
0
offset forluma
C
Last PosX
=
min
(
bi n I d x
,
1
)
+
(
LastCG
?2
:
0
)
forchroma
RegIdx
.
(6.22)
>
1?0
:
((
RegIdx
>
0
)
∗
4
offset
=
+
(
map
(
IntraLumaMode
) >
2
)
∗
2
+
2
)
Since the last CG position and last coefficient position within one CG has been
coded before coding the
pairs, the position for each coefficient as well
as its neighboring information are now explicitly known at the time of decoding
the corresponding
(
Level
,
Run
)
pair. This information is therefore used to improve
the context models for coding the
(
Level
,
Run
)
(
,
)
pairs. The context model for the
magnitude of
Level
coding is based on the position of the coefficient within the CG
in the reverse scan order, the region index, the number of prior-coded
Level
Run
(
Level
,
Run
)
pairs in the same CG, denoted as pairsInCG, and
defined in Eq.
6.17
in
CBAC for AVS1. As shown in the following formula, 20 context models are used
for coding luma/chroma components, separately.
ˇ
(
Lmax
)
C
Level
=
RIdx
∗
10
+
min
(,
Q
(
pairsInCG
)
+
2
)
+
(
5
∗
Q
(
pairsInCG
)) /
2
min
pairsInCG
+
1
2
2
.
Q
(
pairsInCG
)
=
,
(6.23)
Here,
RIdx
is set to 0 if it is the first CG in scan order (i.e.,
Re
g
Idx
equal to 0 in
Fig.
6.8
) and the position of current
Level
(i.e., Pos in Fig.
6.7
) in the reverse scan
order is larger than 12. Otherwise, it is set to 1.
In terms of the context modeling of bins in the binarization of Run, it is dependent
on the associated
absLevel
, the position of the associated
Level
(i.e., Pos in Fig.
6.7
),
the corresponding region index, the intraluminance prediction mode and
absSum
,
which is a sum of the absolute values of up to 7 previously coded coefficients in
reverse scan order in the same CG. More specifically, the context model for luma
blocks is defined as follows:
C
Run
=
firstCG
?
((
POS
+
binIdx
==
14
)
?0
:
(
1
+
RIdx
))
.
(6.24)
:
((
4
+
RIdx
)
∗
3
)
+
min
(
2
, (
absSum
+
AbsLevel
) /
2
)