Quantization Techniques in JM/KTA

源地址:http://www.h265.net/2009/06/quantization-techniques-in-jmkta-part-1.html

1. Overview

Currently most image and video coding systems and standards, such as MPEG-1/2 and H264/AVC, use transform-based techniques followed by quantization and entropy coding. The key idea is that transforms de-correlate the signal and compact the energy of a block into a few coefficients, which still represent the signal rather accurately after quantization and de-quantization. Nevertheless, this quantization/de-quantization process needs to be carefully designed in order to have the best possible subjective and objective quality.

In the encoder of H.264/AVC reference software, the scalar dead-zone quantization is adopted. In order to improve further the performance, other two adaptive quantization techniques are also introduced, which are both based on how to adjust the size of dead-zone and control the rounding behavior. In this tutorial, we will first introduce the principle of H.264/AVC normal quantization scheme, then discuss the adaptive rounding method which select adaptively rounding offset using an equal expected-value property. Finally, a more complex rate-distortion optimized quantization will be discussed.

2. Principle of H.264/AVC Normal Quantization Scheme

2.1. Scalar dead-zone quantization

In this section the principle of H.264/AVC normal quantization scheme is described in a generalized form.

A scalar quantizer for input signal W can be decomposed into a function Z=C[W] called a classification rule that selects an integer-valued class identifier called the quantization index at the encoder, and a reconstruction rule that produces a real-valued output W’=R[Z] at the decoder. Video encoder applies entropy coding to the quantization indices and communicates to the decoder. Although H.264/AVC JM reference software implements some classification functions, only reconstruction function is standardized.

In the quantization step of the encoder, the transform coefficients of the prediction error are quantized. This quantization is used to reduce the precision of the coefficients. Furthermore, the quantizer is designed to map insignificant coefficient values to zero whilst retaining a reduced number of significant, non-zero coefficients. The output of a quantizer is typically a ‘sparse’ array of quantized coefficients, mainly containing zeros.

This uniform quantization can be expressed with equation (1), which describes the quantization step and with equation (2), which describes the inverse quantization step.

                                                                                 (1)

In this equation, the input signal W is mapped to a so called quantization level Z. Therefore, the quantization step-size ∆ and the rounding control parameter f is used. The function floor() rounds to the nearest integer towards minus infinity and sign() returns the sign of the input signal. Figure 1 shows the dead-zone plus uniform threshold quantization, where ∆ is the interval size except dead-zone, 2(∆-f) is the interval size of dead-zone, and f is the rounding offset.

Figure 1. Dead-zone with uniform threshold quantization

The mapping of the quantization level Z to the signal W’ is described in the inverse quantization step that is given by

                                                                                                         (2)

Note that in (2), the parameter f is not considered. In the following the influence of the rounding control parameter f is analyzed.

2.1 Influence of rounding control parameter f

By modifying f, the rounding behaviour can be controlled. For example, in Figure 2, a rounding control off=∆/2, leads to values W’ of the inverse quantized (reconstructed) signal that are located in the centre of a quantization interval, and the range ∆/2<W<=3∆/2 is quantized to W’=∆ .

Figure 2. Dead-zone quantization with f=∆/2

If f is changed, the reconstructed values W’ are no longer located in the centre of the corresponding quantization interval. For example, in Figure 3, a quantizer for a rounding control parameter f=∆/4 is chosen.

Figure 3. Dead-zone quantization with f=∆/4

The parameter f=∆/4 has two effects:

  1. Compared to f=∆/2, the quantization interval around zero is increased, and the range -3/4∆<W<3/4∆ is quantized to W’=0.
  2. The values of the quantized signal for W’!=0 are no longer located in the center of a quantization interval. The range 3/4∆<W<=7/4∆ is quantized to W’=∆, etc.

Observed from the above examples, we can find that rounding offset f controls two aspects:

  1. Size of dead-zone, 2(∆-f)
    Decrease f, dead-zone increases
  2. Location of the reconstruction point relative to the quantization interval:
    - Decrease f, all the intervals would be shifted away from zero

2.2 How to calculate the rounding offset f?

To minimize mean-squared quantization error, W’ should be the centroid (conditional mean) in the interval with respect to the probability distribution function (p.d.f.) of W, i.e., W’ = m = E[ W | a ≤ W ≤ a + Δ], or

                                                              (3)

where a is one value of the set [∆-f, 2∆-f, 3∆-f,…]and P(W) is the p.d.f of W.

For general distribution, the conditional means m could be at different distance from the lower threshold, for each interval, as conditional p.d.f. is different for different interval. Fortunately, for Laplacian distribution, the conditional means are at the same distance from the lower thresholds, for all intervals. Since DCT coefficients can be modeled by Laplacian distribution, this justifies using the same f for all intervals in H.264/AVC.

The non-uniform probability distribution inside a quantization interval can be approximated by a Laplacian distribution, which is shown in Figure 4.

Figure 4: Probability distribution of transform coefficients W inside a quantization interval.

Suppose that a Laplacian p.d.f. has standard derivation λ, or P(w)= (λ/2)exp(-λ|w|), the optimal f which minimize the distortion can be determined analytically for Laplacian distribution, which decreases with increasing λ (i.e., decreasing standard derivation),

                                                                                          (4)

Due to this distribution, the mean value of W inside a quantization interval is not located in the centre of corresponding interval. In order to reduce the quantization error, this effect is considered by using a rounding control parameter of f<∆/2. Such a rounding control parameter leads to smaller values of the quantized signal W’, which are not located in the centre of a quantization interval.

Figure 5 shows the monotonic property between optimal f and Laplacian standard derivation λ.

Figure 5. The monotonic property between optimal f and Laplacian standard derivation λ

In the reference model of H.264/AVC, the probability distribution varies between Intra and Inter mode, thus different rounding control parameters are used. The rounding control parameter for Intra is f=∆/3 and for Inter it is f=∆/6. Therefore, the values of the quantized signal W’ tend to be smaller than the value of the centre of the corresponding quantization interval. This behaviour is utilized to have a quantization that better fits to a non-uniform probability distribution of the input signal inside a quantization interval.

3. Adaptive Rounding Encoding Technique using an Equal Expected-Value Rule

As discussed above, if the input p.d.f. is Laplacian distributed and if we can estimate λ, then the optimal f can be found analytically. But, usually the estimate of input p.d.f. is not available, then, how to select the rounding offset f?

In order to select rounding offset f adaptively, an adaptive quantization encoding technique using an equal expected-value rule is proposed by Gary Sullivan from Microsoft. The adaptive adjustment of the rounding offset occurs only in the encoding quantization process, which tries to select f without using any priori model knowledge on the input W. The aim is to make that the mean of the absolute value of the input, |W|, is equal to its expected reconstruction value |W’|, i.e.,

                                                                                          (5)

Any values in an interval would be reconstructed to some W’, so the distribution of W’ is a probability mass function (p.m.f.), with the probability mass equal to integral of the input probability distribution function (p.d.f.) over the interval: the change of f leads to the shift of quantization intervals, and thus results in the change of p.m.f. of W’.

Figure 6. Adaptive rounding using an equal expected-value rule

The rounding offset parameter f is updated during encoding as follow:

                                                            (6)

where the positive constant k is determined empirically. This equation means that If |Wi| < |W’i|, then try to decrease f. By decrease f, we increase the dead-zone and the probability mass of zero, and thus the expected value of |W’| would be shifted towards zero. Otherwise, the expected value of |W’| would be shifted away from zero. Here we summarize the algorithm of adaptive rounding:

  • Initially set f0=Δ/3 (for intra) or f0= Δ/6 (for inter)
  • Quantize incoming transform coefficient W0, obtain W’0
  • Obtain f1 ; Use it to quantize W1
  • If |Wi|=|W’i|, no need to update f
  • I(.) is the indicator function, which is equal to 1 when its argument is true, and 0 when its argument is false
  • Discard samples that fall into the dead-zone, since dead-zone reconstruction value of 0 is in general optimal (input p.d.f. is symmetric)
  • Use different f for each of these frequency components, and update separately, since they have different statistics– 16 frequency components for luma 4×4 block of Inter 4×4 modes

    – 16 frequency components for luma 4×4 block in Intra 4×4 modes

    – …

The adaptive quantization encoding technique using an equal expected-value rule is only performed at theencoding quantization process, and is compatible with the standards, and only need modification only at the encoder. Experiential results show that up to 1dB improvement at high PSNR is observed.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章