Graphics Reference
In-Depth Information
a
b
2D forward
transform
U
level
De-quant
[]
[]
1D column
forward
transform
1D column
forward
transform
C
×
×
D
D
×
×
×
2
2
2
(
(
(
6
6
6
+
+
+
M
M
M
2
2
2
)
)
)
6
6
6
2
2
2
Qstep
Qstep
=
=
2
2
(
(
6
6
+
+
M
M
2
2
)
)
(D
C)
C)
×
×
S
S
×
×
S
S
IQ
IQ
X
(=coeff
Q
)
1D column
inverse
transform
1D row
forward
transform
1D row
forward
transform
[]
[]
×
×
T
T
D
D
[]
[]
1D column
inverse
transform
C
T
T
×
×
(
(
(
6
6
6
+
+
+
M
M
M
2
2
2
)
)
)
D
D
×
×
×
2
2
2
=
2
2
(
(
6
6
+
+
M
M
2
2
)
)
×
×
S
S
(D
C)
C)
2
2
×
×
S
S
coeff
coeff
IT
IT
1
1
14
14
1D row
inverse
transform
1D row
inverse
transform
2
2
[]
D
[]
D
×
×
Qstep
Qstep
×
×
S
S
×
×
S
S
IT
IT
2
2
2D inverse
transform
Quant
level
Fig. 6.3
Additional scale factors
S
T
1
,
S
T
2
,
S
IT
1
,
S
IT
2
,
S
Q
,
S
IQ
required to implement HEVC integer
transform and quantization. (
a
) Forward transform and quantization, (
b
) inverse transform and
quantization. The 2D forward and inverse transform are implemented as separable 1D column
and row transforms.
C
is the orthonormal DCT matrix.
D
is the scaled approximation of the DCT
matrix.
M
D
log
2
(
N
)where
N
is the transform size. Reproduced with permission from [
6
]. © IEEE
2013
6.2.5
Intermediate Scaling
Since the HEVC matrices are scaled by 2
(6 C
M
/2)
compared to an orthonormal
DCT transform, and in order to preserve the norm of the residual block through
the forward and inverse two-dimensional transforms, additional scale factors—
S
T
1
,
S
T
2
,
S
IT
1
,
S
IT
2
—need to be applied as shown in Fig.
6.3
. Note that Fig.
6.3
is
basically a fixed point implementation of the transform and quantization in Fig.
6.1
.
While the HEVC standard specifies the scale factors of the inverse transform (i.e.
S
IT
1
,
S
IT
2
), the HEVC reference software also specifies corresponding scale factors
for the forward transform (i.e.
S
T
1
,
S
T
2
). The scale factors were chosen with the
following constraints:
1. All scale factors shall be a power of two to allow the scaling to be implemented
as a right shift.
2. Assuming full range of the input residual block (e.g. a DC block with all samples
having maximum amplitude), the bit depth after each transform stage shall be
equal to 16 bits (including the sign bit). This was considered a reasonable trade-
off between accuracy and implementation costs.