Abstract:
A significant data rate reduction effect in video coding is acchieved by quantizing the transformed frequency coefficients or components of a pixel block so that thereafter fewer amplitude levels need to be encoded and part of the quantised amplitude values becomes zero and need not be encoded as quantised amplitude values. Many transform based video coding standards use a default quantization matrix to achieve better subjective video coding/de-coding quality. A quantization matrix assigns smaller scaling values to some frequency components of the block if the related horizontal and/or vertical frequencies are believed to be the less important frequency components with respect to the resulting subjective picture quality. The inventive quantization matrix generation starts from default quantization matrices and derives therefrom a perceptually optimum quantization matrix for a given picture sequence. In a first pass the candidate quantization matrix for a given picture sequence is iteratively constructed by simultaneously increasing scaling values for some coefficient positions and decreasing scaling values for other ones of the coefficient positions. In a second pass the generated quantization matrix is applied for re-encoding the picture sequence.

Description:
FIELD OF THE INVENTION  
       [0001]     The invention relates to a method and to an apparatus for adaptively generating a quantization matrix that can be used for encoding an image or a picture sequence.  
       BACKGROUND OF THE INVENTION  
       [0002]     A significant data rate reduction effect in video coding is acchieved by quantizing the (transformed) frequency coefficients or components of a pixel block so that thereafter fewer amplitude levels need to be encoded and part of the quantised amplitude values becomes zero and need not be encoded as quantised amplitude values. Many transform based video coding standards use a default quantization matrix to achieve better subjective video coding/de-coding quality, e.g. ISO/IEC 13818-2 (MPEG-2 Video). A ‘quantization matrix’ assigns smaller scaling values (i.e. has greater divisor numbers) to some frequency components of the block if the related horizontal and/or vertical frequencies are believed to be the less important frequency components with respect to the resulting subjective picture quality. It is known that the human psycho-visual system is less sensitive to higher horizontal and/or vertical frequencies, in particular to higher diagonal frequencies.  
         [0003]     The MPEG-2, MPEG-4, MPEG-4 AVC/H.264 (ISO/IEC 14496-10) and MPEG-4 AVC/H.264 FRExt (‘Fidelity Range Extensions’, Redmond JVT meeting, 17-23 Jul. 2004) video coding standards all include support for such quantization matrices. For example, ISO/IEC 13818-2 discloses in section 6.3.11. a default ‘quantization matrix’ for intra blocks having differing quantizer divisor numbers the greatest of which is located at the bottom right position in the 8*8 array of divisor numbers, and a default quantization matrix for non-intra blocks having equal quantizer divisor numbers for all positions in the 8*8 array. User-defined quantization matrices can be transmitted by the encoder for application in the decoder, see section 6.2.3.2 in ISO/IEC 13818-2.  
         [0004]     H.264 FRExt re-introduces the quantization matrix for more professional applications. The quantization matrix is enabled to quantize different DCT coefficients by different scaling values, as other video coding standards such as MPEG-2 and MPEG-4 do. 8*8 transform is added into H.264 FRExt, which however is not in the H.264 Main Profile, aiming to professional applications for high definition TV. Subjective quality is also an important issue for HD video coding. In most cases the quantization matrix for the different frequencies is set default or fixed throughout the picture sequence.  
         [0005]     In the following description it is sometimes referred to the below list of prior art: 
    [1] G. Wallace, “The JPEG still picture compression standard”, Communications of ACM. 34(4), 30-44 1991.     [2] T. Wiegand, G. Sullivan, “Draft ITU-T Recommendation and Final Draft International Standard of Joint Video Specification (ITU-T Rec. H.264|ISO/IEC 14496-10 AVC)”, Mar 31, 2003.     [3] K. R. Rao and P. Yip, “Discrete Cosine Transform: Algorithms, Advantages, Applications”, Boston, Mass.: Academic, 1990.     [4] G. Sullivan, T. McMahon, T. Wiegand, A. Luthra, “Draft Test of H.264/AVC Fidelity Range Extensions Amendment”, JVT-K047, ftp://ftp.imtc-files.org/jvt-experts/2004 — 03_Munich/JVT -K047d8.zip.     [5] B. Tao, “On optimal entropy-constrained dead-zone quantization”, IEEE Transactions on Circuits and Systems for Video Technology, Vol. 11, pp. 560-563, April 2001.     [6] F. MUller, “Distribution shape of two-dimensional DCT coefficients of natural images”, Electronics Letters, 29(22):1935-1936, October 1993.     [7] S. R. Smoot and L.A.Rowe, “Laplacian Model for AC DCT Terms in Image and Video Coding”, Ninth Image and Multidimensional Signal Processing workshop, March 1996.     [8] Watson et al., “DCT quantization matrices visually optimised for individual images”, Human Vision, Visual Processing and Digital Display IV, Proceedings of SPIE 1913-1 (1993).     [9] Yingwei Chen; K. Challapali, “Fast computation of perceptually optimal quantization matrices for MPEG-2 intra pictures”, Image Processing, 1998, ICIP 98 Proceedings 1998 International Conference, 4-7 Oct. 1998.     [10] H. Peterson, A. J. Ahumada, A.B.Watson, “An Improved Detection Model for DCT Coefficient Quantization”, Proceedings of the SPIE, 1993, pp. 191-201.     [11] E. Y. Lam, and J. W. Goodman, “A Mathematical Analysis of the DCT Coefficient Distributions for Images”, IEEE Trans. on Image Processing, Vol. 9, No. 10, pp. 1661-1666, 2000.     [12] Cristina Gomila, Alexander Kobilansky, “SEI message for film grain encoding”, JVT-H022, Mar 31, 2003.     [13] Zhihai He and Sanjit K. Mitra, “A Unified Rate-Distortion Analysis Framework for Transform Coding”, IEEE Transactions on Circuits and System for Video Technology, Vol. 11, pp. 1221-1236, December 2001.    
 
         [0019]     Many current image and video coding standards are based on DCT (discrete cosine transform), such as JPEG [1], MPEG-2, MPEG-4 and AVC/H.264. Under some conditions of the first-order Markov process, for natural images the DCT transform is a robust approximation to the ideal Karhunen-Loeve transform KLT, and its advantage with respect to KLT is that it is image content independent. The DCT is used for de-correlating the image signal and for compacting the signal energy at fewer positions within the e.g. 8*8 coefficient block derived from the corresponding pixel block. The DCT is usually followed by quantization and entropy coding. As mentioned above, the quantization process often drops image detail, in order to achieve a high compression ratio. Therefore it is crucial in the quantization process to keep the most important image information (i.e. coefficients) but to drop the less important coefficients. This can be achieved by adapting the values of the quantizer divisor numbers in the quantization matrix. If the output bit rate available for coding a picture or a slice is pre-determined or other coding parameters are fixed, the feature of using adaptive quantization matrices facilitates the flexibility to make choices for the different frequency positions in the block. The aim of selecting a good quantization matrix is better (measurable) coding/decoding quality, especially better subjective quality, which aim is even more attractive in high-bitrate video coding applications. An 8*8 transform is also reintroduced into H.264 FRExt [4]. A lot of research has been carried out in connection with the 8*8 DCT coefficients used in image and video coding [5][6][7], such as the perception optimal quantization matrix design and subjective quality assessment [5][8][9].  
         [0020]     JPEG splits an image into small 8*8 blocks and utilises DCT for each block. In the transform processing MPEG-2 processes an I-frame like JPEG does it [1]. So, when designing a quantization matrix for an MPEG-2 I-frame, it is almost the same as in JPEG. In H.264 FRExt, when an 8*8 transform is used for the Y component, the default quantization matrix for intra-blocks is different from that used in MPEG-2 because only the residual after intra-prediction is encoded, which means that the statistical distribution of these residues is different from that of the DCT coefficients itself. The prediction error may be propagated, and if the quantization matrix changes the best prediction modes may change correspondingly.  
         [0021]     For P-frames and B-frames the encoding of inter blocks is dominating. Without loss of generality, in the following those cases will be referred to as ‘inter block’, instead of ‘P-frame’ or ‘B-frame’. The same problems may happen for inter blocks, such as the different distribution of DCT error propagation. However, for P-frame encoding the error propagation caused by adaptive quantization matrices is not so strong but still causes a problem.  
         [0022]     Watson et al. [8] have proposed a method for designing a perceptually optimum quantization matrix for JPEG which provides subjective quality improvement for low and very low bit rates. However for high-bitrate coding these perceptual optimal methods are not optimum. Watson et al. have carried out exhaustive work on designing an image-dependent quantization matrix based on frequency thresholding [ 8][10]. In Watson&#39;s publications the human sensitivity for different DCT frequency bands is assumed to be different. Based on visual experiments, a so-called ‘detection threshold’ was measured which represents the minimum distortion that can be perceived by a human. Watson&#39;s theory claims that this detection threshold is related to the average luminance of the whole block and to the absolute value of the corresponding frequency components. After the detection thresholds are determined, the perceptual error for each frequency component is defined as quantization error divided by detection threshold. To pool the errors of all DCT frequency components and all blocks in one picture, Watson has used another vision model called ‘β-norm’.    
       SUMMARY OF THE INVENTION  
       [0023]     Although Waston&#39;s method works well for JPEG-like intra picture quantization matrix design, its performance on residual images is not as good as expected, especially for high-bitrate picture encoding.  
         [0024]     For performing high-bitrate video compression it is important to preserve more details for picture areas where due to their detailed or complex picture content the available average bit rate is too constrained, which means that for high frequencies not simply a larger scaling during quantization should be used.  
         [0025]     Watson&#39;s method could be regarded as a weighted pooling of the quantization error. When designing a quantization matrix, known algorithms are based on MSE optimization as disclosed in [5] and [9], which use the traditional MSE (mean square error) together with some perceptionally optimum weighting for each one of the 8*8 frequency positions. The weights may be block picture content adaptive or block independent. Theoretically, if some weights are added to the distortion values of the frequencies, or even if just a quantization matrix is used, the distortion-invariance is ruined. Thus, the known methods just try to define an approximate model.  
         [0026]     According to the invention, calculating the distortion with the help of other measures can yield a better result for the design or selection of adaptive quantization matrices. Furthermore, a measure without utilizing any form of distortion can also be effective for the design of optimum quantization matrices. The HVS (human visual system) can also start with a no-distortion model to train good weights for a new measure.  
         [0027]     So far no known HVS model considers the film grain problem which is in particular relevant for encoding movies in HD or HDTV quality [12]. In such cases the PSNR (peak signal-to-noise ratio), which is a distortion-based objective quality criterion, is not accurate at all for the assessment of the quality of the signal since pleasant noise is added into the pictures. Coding techniques preserving the film grain should achieve good performance although not using any traditional MSE-based measure or HVS model.  
         [0028]     As mentioned above, basically the MSE could be selected as a criterion for determining the distortion of signals and it is widely used because many spaces, such as the Hilbert space, use the L 2  norm as a form for measuring energy. The transforms used in image or video coding so far are orthonormal (i.e. orthogonal and normalised) transforms, for example DCT, Haar wavelet or Hadamard transform. An orthonormal the transform is distance-invariant and therefore energy-invariant. So the distortion of a signal which should be accumulated in the spatial domain can also be accumulated in the transformed or frequency domain. Based on this concept, when designing a quantization matrix, most of the known methods are based on the distortion of each frequency component in the transformed domain with the help of some vision models on human frequency sensitivity.  
         [0029]     Therefore, according to the invention, a different method for image/video quality assessment or bit allocation is required that starts from a non-MSE (distortion) based model and that will yield better subjective results, especially for high-bitrate compression.  
         [0030]     As already mentioned above, the purpose of applying a quantization matrix is to assign in the encoding processing smaller scaling values to frequency components that are believed to be the less important and to assign greater scaling values to more important frequency components. Thus, the most important issue is to evaluate the importance of different frequency components. In the prior art, weighted distortion is used as a measure for such evaluation whereby high frequency components will be given big quantization divisor values and thus a very small bit allocation. However, in JM FRExt reference software the variances of the scalings in default intra 8*8 quantization matrices are smaller than those of the MPEG-2 and MPEG-4 default quantization matrices. A main reason is that the intra prediction method turns the normal DCT coefficients into residual DCT coefficients, and for pictures containing abundant details a quantization matrix having a small variance is better. Therefore in applications for medium or high bit rate, starting from a default quantization matrix, each frequency component should compete with each other to get more bits assigned. The ‘winners’ are those achieving high performance on some measures, which might have no distortion form but will care more for the picture content details.  
         [0031]     In a process of designing a quantization matrix the bit constraint condition should also be considered. A lot of prior art proposes that the distribution of the DCT AC coefficients follows a Laplacian distribution [6][7][11]:  
           p   ⁢           ⁢     (   x   )       =       λ   2     ⁢     ⅇ       -   λ     ⁢        x                ,       
 
 wherein p(x) is the probability of the random variable x and λ is the mean value. For such simple case its standard deviation σ 2  leads to the following formula for mean λ:  
       λ   =         2     σ     .         
 
         [0032]     After the quantization process with a dead-zone [−Δ, Δ], the percentage p of zeros is:  
       ρ   =         ∫     -   Δ     Δ     ⁢       λ   2     ⁢     ⅇ       -   λ     ⁢        x            ⁢           ⁢     ⅆ   x         =     1   -       ⅇ     -   λΔ       .             
 
         [0033]     In ZhiHai&#39;s model [13] the low bound of rate R is:  
           R   ⁢           ⁢     (   ρ   )       =         log   2     ⁡     [       1   +     (     1   -   ρ     )         1   -     (     1   -   ρ     )         ]       =       2   ⁢           ⁢     (     1   -   ρ     )     ⁢           ⁢     log   2     ⁢   e     +     O   ⁢           ⁢     (       [     1   -   ρ     ]     3     )             ,       
 
 wherein p is the percentage of zeros. 
 
         [0034]     Although there is prior art claiming that the distribution is closer to a Gaussian or a Generalised Gaussian one [6], in [13] these cases are considered and the same linear relationship between the bit rate R and the percentage of non-zeros is kept.  
         [0035]     A problem to be solved by the invention is to provide or to generate or to adapt improved quantization matrices that achieve a higher subjective picture quality and preserve more details for picture areas where due to their detailed or complex picture content the available bit rate is too constrained, in particular in high-bitrate video compression.  
         [0036]     As mentioned above, in H.264 FRExt in most cases the quantization matrix for the different frequencies is set default or fixed throughout a picture sequence. However, there are cases where some areas in a GOP are full of detail or high-frequency information. To keep these details so as to improve the subjective quality, several methods are disclosed in the invention that generate adaptive quantization matrices for I frames, P frames and B frames. In H.264 FRExt the quantization matrices are slice-based and each slice has a picture parameter set ID by which different quantization matrices can be selected.  
         [0037]     According to the invention, a fast two-pass or multi-pass frequency-based processing is used to generate one or more adaptive quantization matrices for different video sequences, in particular adaptive quantization matrices for I frames, P frames and B frames. The inventive quantization matrix generation starts from default intra and inter block quantization matrices and derives therefrom perceptually optimum quantization matrices for a given picture sequence. In that first pass the quantization matrices for a given picture sequence are constructed and in a second pass the generated quantization matrices are applied for re-encoding that picture sequence and generating a corresponding bit stream. The residual pictures (following the prediction) are re-ordered into different frequency components after DCT transform. A histogram of the quantised coefficients is extracted for the calculation of the measures or metrics. It-eratively sensitive and insensitive frequencies in the DCT domain are selected using several measures, based on prior art distortion-based measures. But this is based on the distribution of the quantised levels of each frequency component. Measures or metrics such as a change of percentage in the dead-zone or the entropy are used for selecting fairly important frequency components so as to increase or decrease the corresponding values of the quantization matrix. The sum of the entropy for different frequency components can be used as a criterion for measuring the resulting image/video quality.  
         [0038]     The adaptive quantization matrices can be slice-based, i.e. each slice has a picture parameter set ID selecting different quantization matrices.  
         [0039]     In principle, the inventive method is suited for generating a quantization matrix that can be used for encoding an image or a picture sequence, in which encoding blocks of transformed coefficients related to pixel difference blocks or predicted pixel blocks are quantised or additionally inversely quantised using said quantization matrix, in which matrix a specific divisor is assigned to each one of the coefficients positions in a coefficient block, said method including the steps: 
        loading a pre-determined quantization matrix that includes one divisor for a transformed DC coefficient and multiple divisors for transformed AC coefficients as a candidate quantization matrix;     for a given picture or picture sequence, or for a slice in a given picture or picture sequence, iteratively: 
            a) increasing in said candidate quantization matrix one or more of said AC coefficient divisors, while decreasing in said candidate quantization matrix one or more other ones of said AC coefficient divisors,     b) measuring for the changed divisors of the resulting up-dated candidate quantization matrix whether or not—when applying the updated candidate quantization matrix in said encoding—the resulting picture encoding/decoding quality is improved, and if true, allowing for the following iteration loop further increase or decrease, respectively, of said changed divisors, and if not true, trying other ones of said divisors for an increase and for a decrease and/or reversing the increase and decrease for said changed divisors;     c) checking for each one of said changed divisors whether or not it has been increased as well as decreased in the iteration loops and if true, assigning a predetermined marking value to such divisor, and calculating from said divisor marking values a matrix status value;    
            if the number of iterations exceeds a first threshold value or the matrix status value exceeds a second threshold value, outputting the latest candidate quantization matrix as said quantization matrix.        
 
         [0046]     In principle the inventive apparatus is suited for generating a quantization matrix that can be used for encoding an image or a picture sequence, in which encoding blocks of transformed coefficients related to pixel difference blocks or predicted pixel blocks are quantised or additionally inversely quantised using said quantization matrix, in which matrix a specific divisor is assigned to each one of the coefficients positions in a coefficient block, said apparatus including means being adapted for: 
        loading a pre-determined quantization matrix that includes one divisor for a transformed DC coefficient and multiple divisors for transformed AC coefficients as a candidate quantization matrix;     for a given picture or picture sequence, or for a slice in a given picture or picture sequence, iteratively: 
            a) increasing in said candidate quantization matrix one or more of said AC coefficient divisors, while decreasing in said candidate quantization matrix one or more other ones of said AC coefficient divisors,     b) measuring for the changed divisors of the resulting up-dated candidate quantization matrix whether or not—when applying the updated candidate quantization matrix in said encoding—the resulting picture encoding/decoding quality is improved, and if true, allowing for the following iteration loop further increase or decrease, respectively, of said changed divisors, and if not true, trying other ones of said divisors for an increase and for a decrease and/or reversing the increase and decrease for said changed divisors;     c) checking for each one of said changed divisors whether or not it has been increased as well as decreased in the iteration loops and if true, assigning a predetermined marking value to such divisor, and calculating from said divisor marking values a matrix status value;    
            if the number of iterations exceeds a first threshold value or the matrix status value exceeds a second threshold value, outputting the latest candidate quantization matrix as said quantization matrix.       
 
     
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0053]     Exemplary embodiments of the invention are described with reference to the accompanying drawings, which show in:  
         [0054]      FIG. 1  Distributions of the DCT coefficients of intra-frame blocks in the HDTV sequence Kung_fu;  
         [0055]      FIG. 2  Distributions of the DCT coefficients of inter-frame blocks in that sequence;  
         [0056]      FIG. 3  Flow chart of the quantization matrix generation process;  
         [0057]      FIG. 4  Block diagram of an inventive encoder.  
     
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS  
       [0058]     Several methods for adaptive computation of the quantization matrices both for intra blocks and for inter blocks are described below. These methods can be used in all DCT-based image or video coding standards, such as JPEG, MPEG-2 and MPEG-4 H.264 FRExt, and provide flexibility for the quantization process to improve subjective or objective quality or even to adjust the bit rates.  
         [0059]     For HD video coding, the 8*8 size transform performs better than the 4*4 size transform. Therefore, if not otherwise stated, in the following discription the 4*4 transform is disabled and the quantization matrices are all of size 8*8, for intra and for inter blocks.  
         [0060]      FIG. 1  shows the average distribution of amplitude levels (i.e. the histograms) of the 64 DCT coefficients of all intra-frame 8*8 blocks in the HDTV sequence Kung_fu. Each small image corresponds to a DCT position. The horizontal coordinate is the quantised amplitude value (level), and the vertical coordinate is the number of coefficients in this level after quantization. The small images are arranged by the raster order, i.e. the upper line of histograms represents purely horizontal 8*8 block frequencies in ascending order from left to right whereas the left column of histograms represents purely vertical frequencies in ascending order from top to bottom.  
         [0061]      FIG. 2  shows the corresponding distributions of the DCT coefficients of all inter-frame blocks in that sequence. It is apparent from  FIGS. 1 and 2  that most of the frequency components are not compacted or concentrated in the area (i.e. the upper left edge) near the zero frequence (i.e. the DC) but have wider distributions. On one hand only some of the high frequency components compact nearly to zero occurrence. On the other hand there are special cases where high frequency components have a great variance similar to that of some low frequency components. This means that these high frequency components are important and should not get a reduced weighting like in known quantization matrices. Those frequency components might also be important for the retention of film grain following coding/decoding of the video sequence.  
         [0062]     The following assumption is made: if amplitudes for a given frequency coefficient have a higher variance, a small decrease of the corresponding quantization scaling will not cause a much higher overall quality improvement as compared to the decrease of the quantization scaling for a frequency component having a smaller variance of its amplitudes. Therefore a higher bit allocation can be given for the latter case.  
         [0063]     A further assumption is made that changing several parameters in the quantization matrix will not influence the intra mode decision process and inter motion compenzation and mode decision.  
         [0064]     While an MSE distortion measurement is not used, other measurements such as percentage of non-zero amplitudes and/or entropy of each frequency component can be used to decide which scaling values in the quantization matrix will decrease or increase. Advantageously that means that the coding/decoding image quality can also be evaluated by those measures to some extent.  
         [0065]     In the following the term ‘quantization parameter’ (denoted QP) is used. QP represents a further divisor in the quantization process. That divisor has the same value for each frequency component in the 8*8 block. The quantised transform coefficients coef qij  are calculated from the transform coefficients coef ij  according to the formula
 
 coef   qij   =coef   ij   /QP/QM   ij ,
 
 wherein QM is the quantization matrix and i and j are the horizontal and vertical position indices in the 8*8 block. According to the invention, a small QP of ‘20’ can be used to train the quantization matrix generation during the first pass since high-bitrate compression is the objective. This QP number can be reduced even more for very-high bit rate compression. 
 
         [0066]     According to another embodiment, the possible configuration for the QP during the first pass is to duplicate the final QP in the second pass into the first pass, i.e. to use the destination QP to train the quantization matrices.  
         [0067]     During each adjustment of the quantization matrix, several scaling values in the quantization matrix are decreased while several others are increased so as to keep the resulting bit rate approximately constant. The scaling value for the DC component is kept unchangeable.  
         [0068]     The quantization matrix for intra blocks can be generated by considering I frames only. However, the generation of the quantization matrix for inter blocks is different: the inter blocks of P frames can be used. A block selection process is also useful for inter blocks, according to the motion vector of such blocks.  
         [0069]     But once the block data are received and transformed, the adjustment process for the quantization matrices for intra and inter blocks is the same and only needs to consider the residual.  
         [0070]     Without loss of generality, the process for generating quantization matrix is described in detail for intra blocks only: 
    Step  0  T=0; M_Status[8][8]={0,0, . . . }
        wherein T is a loop counter and M_Status is a status matrix for the elements of matrix M.    
        Step  1  M=M 0 , encode_slice( ), 
        wherein M 0  is the initial quantization matrix and M is an update quantization matrix.    
        Step  2  TM=M, wherein TM is a candidate or test quantization matrix. 
        For each 0≦i,j&lt;8 except (i,j)=(0,0) 
            TM ij =Shrink(M ij )     Metric ij =Function(M,TM ij )    
           
       
 
         [0079]     Step  3  Select the N best positions {p k } and the L worst positions {P m } by Metric ij  for the 63 positions. The ‘best’ and ‘worst’ positions will be evaluated by the measures or metrics as described below. 
        Update M and M_Status     Increment T by ‘1’        Step  4  if (T&gt;threshold1 OR ABS(M_Status)&gt;threshold2) go to Step  6 , else go to Step  5      Step  5  if (need 13  re-encode( )) M 0 =M, go to Step  1 , else go to Step  2      Step  6  M 0 =M, run another encode pass to get the final bit-stream.    
 
         [0085]     A corresponding flow chart of the quantization matrix generation process is depicted in  FIG. 3 , showing steps  0  to  6 .  
         [0086]     Some remarks concerning the above-listed steps:  
         [0087]     a) In step  2 , only the residual image needs to be considered.  
         [0088]     b) In step  2 , the Shrink( ) function is defined as a multiplication of all the scaling values to be changed in the candidate quantization matrix M with a factor of e.g. β=0.88.  
         [0089]     c) In step  3 , the update quantization matrix M uses the corresponding values in the candidate or test quantization matrix TM for the best positions. For the worst positions a multiplication with a corresponding factor of e.g. 1/β is used.  
         [0090]     d) In step  3 , for the update of the status matrix M_Status of matrix M the following strategy can be used: for each frequency component, the number of times the scaling has increased or decreased is calculated. Once both, an increase and a decrease of a factor has happened for the same frequency component the corresponding value in M_Status will be set to a large number and thereby that frequency component will be forbidden to get further adjustment of scaling.  
         [0091]     e) In step  4 , ABS(M_Status) is the sum of the absolutes of all the values in matrix M_Status.  
         [0092]     f) In step  6 , the re-encode process can be carried out until a last encode process but preferably the quantization matrix is recorded before.  
         [0093]     g) For inter-frames, inter-blocks from several frames can be considered together to get a quantization matrix for those inter frames. Video analysis can be used to divide the frames into partitions or slices. Since the scaling values in an inter quantization matrix are generally smaller, preferably the factor β is greater than that used in the intra quantization matrix. Another way is to set β to ‘1’ and to just add or subtract ‘1’ to increase or decrease a scaling value, respectively. However, experiments have shown that the design of the quantization matrix for intra blocks is much more important than that for inter blocks.  
         [0094]     h) Experiments have shown that the final quantization matrix M will not change much even if according to step  5  the frame is re-encoded. Therefore the re-encoding step can always be ignored and instead of step  4  continuing with step  5  it can lead to step  2  directly.  
         [0095]     The Function (denoted F) as used in step  2  is important. F is a measure related to the change that a scaling of the quantization matrix will cause. In the following, without special mentioning, all parameters and measures are calculated for a single frequency component or coefficient position.  
         [0096]     The percentage of the non-zero coefficients for a given frequency component, calculated over all blocks after applying the current test quantization matrix, will change if the scaling shrinks. F is defined as F=(ρ 0 −ρ 1 )/(1−ρ 0 ), wherein ρ i  is the percentage of zeros for one frequency component, subscript ‘0’ corresponds to the old scaling and subscript ‘1’ corresponds to the new scaling. The case where the denominator is zero needs to be specifically handled. The larger F, the more important one frequency component is. So, the best frequency components and worst frequency components can be chosen. A possible selection for the number of the best frequency components to be adjusted once is N=4 and the number of the worst frequency components to be adjusted is L=2. The number of non-zero coefficients or the percentage of the non-zero values is calculated after the quantization. In other words, what matters here is only the amplitude level for each quantised coefficient. For an intra-frame having a size of W*H, following intra prediction, there is a number of  
       No_block   =       W   8     *     H   8           
 
 blocks. Each block has one DC coefficient and 63 AC coefficients after the 8*8 transform. For a given quantization matrix, No_block AC coefficients of the same frequency component AC ij  are quantised and the histogram of the amplitude levels of this frequency component is obtained as His ij . Therefore ρ=His ij (0) as a simple statistic variable just cares for the number of level ‘0’ coefficients after quantization. The number of coefficients that are in the dead-zone (an area in which all the coefficients in it will be quantised to zero) is a very important information of a frequency component and it is quite a difference for a coefficient weather or not it is in the dead-zone. 
 
         [0097]     For the Laplacian case,
 
 F =(ρ 0 −ρ 1 )/(1−ρ 0 )=( e   −λW     0     −e   −λW1 )/( e   −λW0 )=1 −e   −λ(W     1     −W     0     ) ,
 
 where W 0  and W 1  are the minimum values for a coefficient to jump out of the dead-zone before and after one adjustment of scaling. That is (for example): a coefficient denoted by ‘a’ will jump out of the dead-zone and therby get a level of ‘1’ or greater only if a≧W i . 
 
         [0098]     For a more general distribution, it can be assumed that the probability distribution function P(x≧X) of one frequency component is in the range [0,+∞], wherein ‘x’ is a random variable and ‘X’ is a positive real numer.  
         [0099]     Then,  
       F   =           P   ⁢           ⁢     (     x   ≤     W   0       )       -     P   ⁢           ⁢     (     x   ≤     W   1       )           1   -     P   ⁢           ⁢     (     x   ≤     W   0       )           =         P   ⁢           ⁢     (       W   1     &lt;   x   ≤     W   0       )         P   ⁢           ⁢     (       W   0     &lt;   x     )         .           
 
 Here, for simplicity, just the case is discussed where the random variable is distributed in the positive area. Furthermore, if W 1 =W 0 β, is used,  
       F   =         P   ⁢           ⁢     (       β   ⁢           ⁢     W   0       &lt;   x   ≤     W   0       )         P   ⁢           ⁢     (       W   0     &lt;   x     )         .         
 
 So, the measure F depends on the start scaling value W 0  and the amplitude value distribution of the component. If two frequency components start from the same scaling value, more contracted components will have the chance to reduce the division factor, i.e. to shrink the scaling value. 
 
         [0100]     Based on the HVS model, the default quantization matrix provides different scaling values for different components. When compared to the default quantization matrix, the inventive method keeps the rough structure of the default quantization matrix but adjusts some of the components in order to reduce the amplitude value distribution. Preferably, under some similar conditions the dead-zone is shrinked by giving a higher bit allocation to the more contracted frequency components.  
         [0101]     For intra blocks, because of the distribution of the AC coefficient, during the quantization process most of the coefficients are dropped into the dead-zone, which means that all the information for the AC coefficient&#39;s value are lost or greatly eliminated. As mentioned above, the default quantization matrices of the known coding standards often assign large quantization divisors to high frequencies based on the assumption that high frequency coefficients might represent noise or might be less sensitive to the human visual system. For inter blocks, the same strategy can be used to get a better quantization matrix. For some video sequences the resuit is not obvious for inter blocks so far. But even if there is no change of the inter block quantization matrix, because of the better intra block quantization matrix a better subjective quality can be noticed in many following frames.  
         [0102]     In this invention several measures for the sensitivity of a frequency component are defined. For example, the metric or measure should represent the proportion between the number of coefficient values jumping out of the dead-zone and the number of coefficient values that are already out the deadzone.  
         [0103]     The following table shows quantization matrices that can be used for the video sequence kung_fu:  
                                                   INTRA8*8_LUMA   INTER8*8_LUMA                           7, 17, 18, 18, 18, 22, 19, 16,   13, 14, 15, 16, 17, 17, 18, 22,           17, 18, 23, 21, 22, 22, 22, 24,   14, 15, 16, 17, 17, 18, 24, 20,           17, 19, 24, 22, 19, 18, 21, 29,   15, 16, 17, 17, 18, 19, 21, 21,           18, 20, 22, 22, 21, 23, 15, 32,   16, 17, 17, 18, 20, 18, 22, 22,           22, 19, 24, 24, 23, 25, 32, 38,   16, 14, 18, 14, 21, 22, 22, 23,           22, 11, 21, 15, 14, 40, 47, 47,   17, 16, 19, 20, 22, 22, 23, 25,           18, 34, 18, 34, 33, 40, 47, 57,   16, 18, 20, 21, 22, 23, 25, 26,           18, 31, 32, 33, 40, 48, 57, 69   13, 21, 21, 22, 23, 25, 26, 27                      
 
         [0104]     A more general metric or measure is related to the entropy of each frequency component if the histogram of their amplitude levels contains more information than that of the zero-level. For frequency component (i,j) the entropy is  
         H   ij     =       ∑   l     ⁢           ⁢       -       His   ij     ⁡     (   l   )         ⁢           ⁢     log   2     ⁢         His   ij     ⁡     (   l   )       .             
 
         [0105]     So another measure can be defined as F ij =ΔH ij . This measure is very useful for cases where there are very few non-zero levels in the previous scaling, and after the current shrink of the scaling several coefficients jump out of the dead-zone. And in a case where a frequency component has many non-zero levels, the same change of coefficients will not lead to much increase of the corresponding entropy. Following quantization, all DCT values are quantised to amplitude levels 1=0, 1, 2 and higher levels. To give a more efficient representation for the entropy of each frequency component, level 1 in the formula for H ij  is clipped into signed values: 0, −1, 1, −2, 2, −3, 3, and so on. That is, levels with an absolute value greater than ‘3’ are handled as ‘3’ or ‘−3’, respectively. This method is based on the experience that most of the coefficients are in the dead-zone and that there are very few high-amplitude value levels.  
         [0106]     When considering the improvement of the subjective quality, it must be kept in mind that the bit rates of the video sequence encoded with the default quantization matrices and of the video sequence encoded with the inventive quantization matrices are normally not exactly the same. That means that preserving the bit rate is another important issue that influences the assessment of a quantization matrix. Another measure F ij =ΔH ij /ΔR ij  can be considered, wherein ΔR ij  is the rate difference caused by usage of the amended candidate quantization matrix. Most entropy values  
       E   =       ∑     i   ,   j       ⁢           ⁢     H   ij           
 
 are got with the same bit rate. In other words, the bit allocation policy inclines to the frequency components that have more entropy increase. However this measure is extremely time consuming because the real bit rate can be determined only after the encoding process: to get the 63 F ij  values the frame (or even the complete video sequence) needs to be re-encoded at least 63 times. To avoid such lengthy calculations an estimation of ΔR can be used, such as Zhihai&#39;s ρ-domain based model (see [13]). 
 
         [0107]     In  FIG. 4  the video data input signal IE of the encoder contains e.g. 16*16 macroblock data including luminance and chrominance pixel blocks for encoding. In case of video data to be intraframe or intrafield coded (I mode) they pass a subtractor SUB unmodified. Thereafter the e.g. 8*8 pixel blocks of the 16*16 macroblocks are processed in discrete cosine transform means DCT and in quantizing means Q, and are fed via an entropy encoder ECOD to a multiplexer MUX which outputs the encoder video data output signal OE. Entropy encoder ECOD can carry out Huffman coding for the quantised DCT coefficients. In the multiplexer MUX header information and motion vector data MV and possibly encoded audio data are combined with the encoded video data.  
         [0108]     In case of video data to be interframe or interfield coded, predicted macroblock data PMD are subtracted on a block basis from the input signal IE in subtractor SUB, and 8*8 block difference data are fed via transform means DCT and quantizing means Q to the entropy encoder ECOD. The output signal of quantizing means Q is also processed in corresponding inverse quantizing means Q E   −1 , the output signal of which is fed via corresponding inverse discrete cosine transform means DCT E   −1  to the combiner ADDE in the form of reconstructed block or macroblock difference data RMDD. The output signal of ADDE is buffer-stored in a picture store in motion compenzation means FS_MC_E, which carry out motion compenzation for reconstructed macroblock data and output correspondingly predicted macroblock data PMD to the subtracting input of SUB and to the other input of the combiner ADDE. The characteristics of the quantizing means Q and the inverse quantizing means Q E   −1  are controlled e.g. by the occupancy level of an encoder buffer in entropy encoder ECOD. A motion estimator ME receives the input signal IE and provides motion compenzation means FS_MC_E with the necessary motion information and provides multiplexer MUX with motion vector data MV for transmission to, and evaluation in, a corresponding decoder. Q E   −1 , DCT E   −1   1  ADDE and FS_MC_E constitute a simulation of the receiver-end decoder. Quantizing means Q and inverse quantizing means Q E   −1  are connected to a quantization matrix calculator QMC which operates according to the above-described inventive processing.  
         [0109]     The above description relates to luminance blocks. For chrominance components, the quantization matrices are 4*4, however the same adjustment scheme can be carried out to get improved 4*4 quanization matrices based on the default quanization matrices.  
         [0110]     In addition, specific quantization matrices can be generated for different block sizes and/or for field and frame macroblock coding modes.  
         [0111]     The numbers given are adapted correspondingly in case other block sizes are used.  
         [0112]     The invention has several advantages:  
         [0113]     The process of generating the quantization matrices has a low complexity. It is fast. The quantization matrices found can be used for high quality and medium or high bit rate applications because the measures used care more for the detailed frequency components. It has the possibility of retention of film grain.  
         [0114]     The first advantage is achieved because a frame is encoded only once and the focus lies on the residual picture, and because very simple statistics are used for each frequency component. These statistics need not care for any form of distortion.  
         [0115]     The quantization parameter needs to be adjusted only in the rage of [−1,1] to get close bit rate correspondence with the original bit rate.