Graphics Reference
In-Depth Information
3. Since the HEVC matrices are scaled by 2 (6 C M /2) , cascading of the two-
dimensional forward and inverse transform will results in a scaling of 2 (6 C M /2)
for each of the 1D row forward transform, the 1D column forward transform, the
1D column inverse transform, and the 1D row inverse transform. Consequently to
preserve the norm through the two-dimensional forward and inverse transforms,
the product of all scale factors shall be equal to (1/2 (6 C M /2) ) 4 D 2 24 2 2 M .
The process of selecting the forward transform scale factors is illustrated using
the 4 4 forward transform as an example in Fig. 6.4 . When video has a bit depth
of B bits, the residual will be in the range of [ 2 B C 1, 2 B 1 ] requiring ( B C 1)
bits to represent it. In the following worst case bit-depth analysis we will assume a
residual block with all samples having maximum amplitude equal to 2 B as input to
the first stage of the forward transform. We believe this is a reasonable assumption
since all basis vectors have almost the same norm. Note also that we are using 2 B
instead of 2 B C 1or2 B 1 in the worst case analysis since it is a power of 2. The
scale factor derivation becomes simpler assuming input to be 2 B (which still fits
within ( B C 1) bits) since all the scale factors are a power of 2. For this worst case
input block, the maximum value of an output sample will be 2 B N 64. This
corresponds to the dot product of the first basis vector (of length N with all values
equal to 64) with an input vector consisting of values equal to 2 B . Therefore, with
N D 2 M , for the output to fit within 16 bits (i.e., maximum value of 2 15 ) a scaling
of 1/(2 B 2 M 2 6 2 15 ) is required. Consequently, the scale factor after the first
transform stage is chosen as S T 1 D 2 ( B C M 9) .
The second stage of the forward transform consists of multiplication of the result
of the first transform stage with D 4 . The input into the second stage of the forward
transform is the output from the first stage which is a matrix with all elements in the
first row having a value of 2 15 . All other elements will be zero as shown in Fig. 6.4 .
The output of multiplication with D 4 will be a matrix with only a DC value equal
to 2 15 2 M 2 6 and all remaining values equal to 0. This implies that the scaling
required after the second stage of transform is S T 2 D 2 ( M C 6) in order for the output
to fit within 16 bits.
The first stage of the inverse transform consists of multiplication of the result of
the forward transform with D 4 . In our example, the input into the first stage of the
inverse transform is the output matrix from the forward transform which is a matrix
with only the DC element equal to 2 15 . The output of multiplication with D 4 will
be a matrix with first column elements equal to 2 15 2 6 . Consequently, the scaling
required after the first stage of the inverse transform for the output to fit within 16
bits is S IT 1 D 2 6 .
The second stage of the inverse transform consists of multiplication of the result
of the first stage of the inverse transform with D 4 . The input into the second
stage of the inverse transform is the output matrix from the first stage of inverse
transform which is a matrix with first column elements equal to 2 15 . The output of
multiplication with D 4 will be a matrix with all elements equal to 2 15 2 6 .Sothe
scaling required after the second stage of inverse transform to get the output values
into the original range of [ 2 B ,2 B 1] is S IT 2 D 2 (21 B ) .
Search WWH ::




Custom Search