Game Development Reference
In-Depth Information
(
L
i
,
R
i
)
is coded at last to signal the end of a DCT block. For each
pair, the
Level
precedes the associated
Run
. First, both
Level
and
Run
are unary binarized into
several bins. For the signed integer
Level
, it is presented by sign and unary bits of its
magnitude (
absLe
el
and
Run
, a product context
is applied, which consists of a
primary
context
C
P
(
L
,
R
)
(
v
el
). Second, for each bin of
absLe
v
L
i
−
1
)
and a
secondary
context indicated by
C
S
(
L
)
(
for
Run
.
Primary
context
relies on the past coded
L
i
−
1
, and the corresponding context index is determined by
the variable
Lmax
which denotes the maximal prior coded
absLe
j
)
for
Level
or
C
S
(
R
)
(
j
,
L
)
el
,asthesame
in C2DVLC. To keep the number of contexts used for coefficient coding reasonably
small, the
primary
contexts are quantized into five categories. Under each
primary
context, seven nested
secondary
contexts are defined. They are classified according to
the bin indices for
Level
or both the value of currently coded
absLe
v
v
el
and bin indices
for
Run
. In the following, the bin index of
absLe
el
or
Run
is denoted as variable
j
.
The
secondary
context index is first initialized with the value of zero at the beginning
of
v
(
Level
,
Run
)
pair coding. Besides, for the first bin of
absLe
v
el
, another so-called
accompanying context
C
A
(
L
)
(
el
in coded order is designed for context weighting. It is quantized by the variable
Re
Re
v
er se P
)
which utilizes the position of
absLe
v
el
is sent to regular binary arithmetic coder
with the technique of context weighting using
secondary
context and
accompanying
context. All other bins of
absLe
v
er se P
. At last, the first bin of
absLe
v
el
and
Run
are regularly coded according to the
secondary
context index. Besides, the sign of
Level
is coded with bypass coding.
After one
v
(
Level
,
Run
)
instance has been coded, all these contexts are updated.
6.3.3.1 Primary Contexts
To follow the increasing tendency based on
Level
information in the reverse scan
order and utilize the correlation between
Run
and
Level
, a function is defined as
the
primary
context based on the maximum of all previously coded magnitudes of
coefficients in current block for the consideration of computational complexity and
algorithm efficiency. Let
Lmax
denote the maximum magnitude, then the
primary
context for current
(
Level
,
Run
)
pair can be defined as
L
i
−
1
C
P
(
L
,
R
)
(
)
=
Lmax
.
(6.14)
In essence, the variable
Lmax
acts as a context quantizer that maps all histories of the
current block up to the current pair to an integer value.
Lmax
is initialized with the
value of zero at the beginning of a DCT block, and will be updated on the fly during
sequential coding of the
pairs. By conditioning the maximum magni-
tudes of all previously coded coefficients, the entropy coding using the estimated
conditional probability
p
(
Level
,
Run
)
((
L
i
,
R
i
)/
Lmax
)
improves the coding efficiency over just
using
p
.
In image or video coding, the occurrences of large amount of
Lmax
will result
in a problem that the dynamic range of context variable
Lmax
can still be too
large which will increase the time and space complexity. To tackle this problem, a
((
L
i
,
R
i
)/
Lmax
)