Graphics Reference
In-Depth Information
where
shift
1
D
(
M
5
C
B
)and
offset
IQ
D
1 << (
M
6
C
B
). Note that the quan-
tization matrix weights
w
[
x
][
y
] modulate the quantization step size used for
level
at different positions in the transform block leading to a frequency-dependent
quantization.
The scale factor
S
IQ
of Fig.
6.3
is equal to 2
shift
1
and is obtained as follows:
When
QP
D
4(i.e.,
Qstep
D
1) and there is no frequency dependent scaling (i.e.,
w
[
x
][
y
]
D
16), the combined scaling of the inverse transform and de-quantization in
Fig.
6.3
when multiplied together should result in a product of 1 to maintain the
norm of the residual block through inverse transform and inverse quantization, i.e.,
S
IQ
g
4
16
2
.
15BM
/
D
1
(6.9)
This results in
S
IQ
D
2
(
M
5 C
B
)
leading to
shift
1 being equal to right shift by
(
M
5
C
B
). The scale factor 2
(15
B
M
)
in (
6.9
) is obtained from Table
6.3
.
For the output sample of the forward transform,
coeff
[
x
][
y
], a straightforward
quantization scheme can be implemented as follows:
level
Œx Œy
D
sign .
coeff
Œx Œy/
abs .
coeff
Œx Œy/
f
QP %6
C
offset
Q
>>
>>
shift2
(6.10)
16
w
ŒxŒy
QP
6
where
shift
2
D
29
M
B
,and
f
D
Œf
0
;f
1
;f
2
;f
3
;f
4
;f
5
T
D
Œ26214; 23302; 20560; 18396; 16384; 14564
T
Note that
f
QP
%6
2
14
/
G
QP
%6
.Thevalueof
shift
2 is obtained by imposing
similar constraints on the combined scaling in the forward transform and the
quantizater as in (
6.9
), i.e.,
S
Q
f
4
2
15
B
M
D
1, where
S
Q
D
2
shift
2
.
Finally,
offset
Q
is chosen to achieve the desired rounding.
To summarize, the quantizer multipliers,
f
i
, and dequantizer multipliers,
g
i
,were
chosen to satisfy the following conditions
Ensure
that
g
i
can
be
represented
with
signed
8
bit
data
type
(i.e.,
g
i
< 2
7
,
i
D
0, :::,5)
Ensure an almost equal increase in step size from one
QP
value to the next
(approximately 12 %) (i.e.,
g
i
C 1
/
g
i
2
1/6
,
i
D
0, :::,4 and2
g
0
/
g
5
2
1/6
)
Ensure approximately unity gain through the quantization and de-quantization
processes (i.e.,
f
i
g
i
16
1 << (
shift
1
C
shift
2)
D
2
6
2
14
16,
i
D
0, :::,5)
Provide the desired absolute value of the quantization step size for
QP
D
4(i.e.
Qstep
(4)
D
1, or equivalently,
level
D
coeff
2
(15
B
M
)
for
QP
D
4).
Note that the quantization equation in (
6.10
) is not specified in the HEVC
standard and the encoder has flexibility to implement more sophisticated quanti-
zation schemes such as the rate-distortion optimized quantization (RDOQ) scheme
implemented in the HEVC Test Model [
13
]. The idea behind RDOQ is briefly
described in Chap.
9
.