Method and Apparatus of the Quantization Matrix Computation and Representation for Video Coding

A method and apparatus for video coding are disclosed. According to the present invention, a flag is determined, where the flag indicates whether a scaling matrix is enabled or not enabled for non-separable secondary transform (NSST) coded blocks. When the current block is one NSST coded block and the flag indicates that the scaling matrix is enabled for the NSST blocks, the scaling matrix is determined and applied to the current block. When the current block is one NSST coded block and the flag indicates that the scaling matrix is not enabled for the NSST coded blocks, the scaling matrix is skipped for the current block. According to another method, for a rectangular block, a target scaling matrix is generated directly from a square base scaling matrix in one step without up-sampling-and-down-sampling or down-sampling-and-up-sampling.

FIELD OF THE INVENTION

The present invention relates to transform coefficient coding for video coding. In particular, the present invention discloses quantization matrix derivation and representation.

BACKGROUND AND RELATED ART

Adaptive Intra/Inter video coding has been widely used in various video coding standards, such as MPEG-2, AVC (advanced video coding) and HEVC (High Efficiency Video Coding). In adaptive Intra/Inter video coding, an input signal is predicted by Intra/Inter predictor to generate prediction residues. The residues are often processed by a two-dimensional transform and quantized. The quantized transform coefficients are then coded. The High Efficiency Video Coding (HEVC) standard is developed under the joint video project of the ITU-T Video Coding Experts Group (VCEG) and the ISO/IEC Moving Picture Experts Group (MPEG) standardization organizations, and is especially with partnership known as the Joint Collaborative Team on Video Coding (JCT-VC). In HEVC, one slice is partitioned into multiple coding tree units (CTU). In main profile, the minimum and the maximum sizes of CTU are specified by the syntax elements in the sequence parameter set (SPS). The allowed CTU size can be 8×8, 16×16, 32×32, or 64×64. For each slice, the CTUs within the slice are processed according to a raster scan order.

The CTU is further partitioned into multiple coding units (CU) to adapt to various local characteristics. A CTU can be further partitioned into multiple Coding Units (CUs) through Quad-Tree or Quadtree (QT) partitioning. The QT partition splits a block of size 4N×4N into 4 equal-size 2N×2N sub-blocks. The CTU can be a single CU (i.e., no splitting) or can be split into four smaller units of equal size, which correspond to the nodes of the coding tree. If units are leaf nodes of the coding tree, the units become CUs. Otherwise, the quadtree splitting process can be iterated until the size for a node reaches a minimum allowed CU size as specified in the SPS (Sequence Parameter Set).

According to HEVC, each CU can be partitioned into one or more prediction units (PU). Coupled with the CU, the PU works as a basic representative block for sharing the prediction information. Inside each PU, the same prediction process is applied and the relevant information is transmitted to the decoder on a PU basis. A CU can be split into one, two or four PUs according to the PU splitting type. HEVC defines eight shapes for splitting a CU into PU, including 2N×2N, 2N×N, N×2N, N×N, 2N×nU, 2N×nD, nL×2N and nRx2N partition types. Unlike the CU, the PU may only be split once according to HEVC.

After obtaining the residual block by the prediction process based on PU splitting type, the prediction residues of a CU can be partitioned into transform units (TU) according to another quadtree structure which is analogous to the coding tree for the CU. The TU is a basic representative block having residual or transform coefficients for applying the integer transform and quantization. For each TU, one integer transform having the same size as the TU is applied to obtain residual coefficients. These coefficients are transmitted to the decoder after quantization on a TU basis.

FIG. 1illustrates an exemplary adaptive Inter/Intra video coding system incorporating transform and quantization to process prediction residues. For Inter-prediction, Motion Estimation (ME)/Motion Compensation (MC)112is used to provide prediction data based on video data from other picture or pictures. Switch114selects Intra Prediction110or Inter-prediction data and the selected prediction data is supplied to Adder116to form prediction errors, also called residues. The prediction error is then processed by Transform (T)118followed by Quantization (Q)120. The transformed and quantized residues are then coded by Entropy Encoder122to be included in a video bitstream corresponding to the compressed video data. The bitstream associated with the transform coefficients is then packed with side information such as motion, coding modes, and other information associated with the image area. The side information may also be compressed by entropy coding to reduce required bandwidth. Accordingly, the data associated with the side information are provided to Entropy Encoder122as shown inFIG. 1. When an Inter-prediction mode is used, a reference picture or pictures have to be reconstructed at the encoder end as well. Consequently, the transformed and quantized residues are processed by Inverse Quantization (IQ)124and Inverse Transformation (IT)126to recover the residues. The residues are then added back to prediction data136at Reconstruction (REC)128to reconstruct video data. The reconstructed video data may be stored in Reference Picture Buffer134and used for prediction of other frames.

As shown inFIG. 1, incoming video data undergoes a series of processing in the encoding system. The reconstructed video data from REC128may be subject to various impairments due to a series of processing. Accordingly, Loop filter130is often applied to the reconstructed video data before the reconstructed video data are stored in the Reference Picture Buffer134in order to improve video quality. For example, de-blocking filter (DF) and Sample Adaptive Offset (SAO) have been used in the High Efficiency Video Coding (HEVC) standard. The loop filter may also include ALF (Adaptive Loop Filter). The loop filter information may have to be incorporated in the bitstream so that a decoder can properly recover the required information. Therefore, loop filter information is provided to Entropy Encoder122for incorporation into the bitstream. InFIG. 1, Loop filter130is applied to the reconstructed video before the reconstructed samples are stored in the reference picture buffer134. The system inFIG. 1is intended to illustrate an exemplary structure of a typical video encoder. It may correspond to the High Efficiency Video Coding (HEVC) system or H.264.

FIG. 2illustrates a system block diagram of a corresponding video decoder for the encoder system inFIG. 1. Since the encoder also contains a local decoder for reconstructing the video data, some decoder components are already used in the encoder except for the entropy decoder210. Furthermore, only motion compensation220is required for the decoder side. The switch146selects Intra-prediction or Inter-prediction and the selected prediction data are supplied to reconstruction (REC)128to be combined with recovered residues. Besides performing entropy decoding on compressed residues, entropy decoding210is also responsible for entropy decoding of side information and provides the side information to respective blocks. For example, Intra mode information is provided to Intra-prediction110, Inter mode information is provided to motion compensation220, loop filter information is provided to loop filter130and residues are provided to inverse quantization124. The residues are processed by IQ124, IT126and subsequent reconstruction process to reconstruct the video data. Again, reconstructed video data from REC128undergo a series of processing including IQ124and IT126as shown inFIG. 2and are subject to coding artefacts. The reconstructed video data are further processed by Loop filter130.

The quantization matrix (QM) has been used in various video coding standards. For example, the quantization matrix is used for the quantization120inFIG. 1and the inverse quantization124inFIG. 2. Block-based hybrid video coding schemes which imply transform coding of the residual signal can use frequency dependent scaling to control the distribution of the quantization distortion across different frequencies in a transform unit (TU). In order to achieve perceptually uniform quantization across spatial frequencies, a quantization matrix can be designed to weight each frequency channel associated with the transform coefficient according to the perceived sensitivity over its related frequency range. Accordingly, low frequency coefficients in the transform block will be quantized with a finer quantization step size compared to high frequency coefficients. The corresponding quantization matrix can be employed to inversely weight de-quantized transform coefficients at the decoder.

Quantization matrix has been successfully utilized in video coding standards, such as H.264/AVC and H.265/HEVC (High Efficiency Video Coding), which allows to improve the subjective quality of video content. Due to their effectiveness, quantization matrices have been widely used in numerous video coding products.

The HEVC specification includes four integer inverse transform matrices of sizes 4×4, 8×8, 16×16, and 32×32. These transform matrices are integer approximations of the DCT-2 matrix of the same size, aiming at the preservation of the DCT (discrete cosine transform) coefficient structure. An additional 4×4 DST (discrete sine transform) matrix is specified which is applied to the residual of Intra predicted 4×4 blocks. For distinction from the DST, the four DCTs are referred to as the HEVC core transforms.

BRIEF SUMMARY OF THE INVENTION

A method and apparatus for video coding are disclosed. According to the present invention, input data related to a current block in a current picture, where the input data correspond to a transform block of the current block at a video encoder side and the input data correspond to a decoded-quantized transform block of the current block at a video decoder side. A flag is then determined, where the flag indicates whether a scaling matrix is enabled or not enabled for non-separable secondary transform coded blocks. When the current block is one non-separable secondary transform coded block and the flag indicates that the scaling matrix is enabled for the non-separable secondary transform coded blocks, the scaling matrix is determined and the scaling matrix is applied to the current block. When the current block is one non-separable secondary transform coded block and the flag indicates that the scaling matrix is not enabled for the non-separable secondary transform coded blocks, the scaling matrix is skipped for the current block.

The flag can be signaled at the video encoder side or parsed at the video decoder side. When the current block is one non-separable secondary transform coded block and the flag indicates that the scaling matrix is enabled for the non-separable secondary transform coded blocks, only K entries in the scaling matrix are signaled at the video encoder side or parsed at the video decoder side if only K coefficients of the current block are modified by non-separable secondary transform and K is a positive integer.

In another embodiment, when the current block is one non-separable secondary transform coded block and the flag indicates that the scaling matrix is enabled for the non-separable secondary transform coded blocks, only all flat scaling matrices can be used.

According to another method, for a rectangular block with block width unequal to the block height, a target scaling matrix is derived directly from a square base scaling matrix in one step without up-sampling-and-down-sampling or down-sampling-and-up-sampling. The current block is then scaled according to the target scaling matrix.

In one embodiment, when a smaller side of the current block having S rows (or columns) is smaller than W and a larger side of the current block having L columns (or rows) is larger than the W, each of S/W rows (or columns) of the square base scaling matrix is extended using sample duplication to generate one extended row (or column) having L samples, and wherein the W corresponds to width of the square base scaling matrix.

In another embodiment, when zero-out process is applied to high frequency components of the current block, the target scaling matrix with zero-out is generated directly from the square base scaling matrix in one step without said up-sampling-and-down-sampling or said down-sampling-and-up-sampling. For example, when a smaller side of the current block having S rows/columns is smaller than width of the square base scaling, a larger side of the current block having L columns/rows is larger than the width of the square base scaling and the zero-outs process is applied to the high frequency components of the current block at location P along the larger side with P<L, a portion of each of S rows/columns of the square base scaling matrix is extended using sample duplication to generate one extended row having P samples and appending remaining samples with zeros.

DETAILED DESCRIPTION OF THE INVENTION

The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims. In this invention, a new quantization matrices representation method for video coding in VVC as follows.

Default Quantization Matrices Representation

Quantization matrix is being evaluated for adoption in the emerging new video coding standard, named VVC (Versatile Video Coding) as a next generation video coding standard and a successor to H.265/HEVC. The quantization matrix is also called scaling matrix in this disclosure.

The information related to scaling matrices can be signaled in the sequence parameter set (SPS) and further updated in the picture parameter set (PPS). A frequency dependent scaling can be enabled by using the syntax element such as scaling_list_enabled_flag in SPS. When this flag is enabled, additional flags in SPS and PPS control whether the default quantization matrices or non-default quantization matrices are used.

When frequency dependent scaling is enabled, the quantization matrices of sizes 4×4 and 8×8 have default values as shown inFIG. 3. As shown inFIG. 3, 4×4 matrix310is used for luma and chroma components in the Intra and Inter modes, 8×8 matrix320is used for luma and chroma components in the Intra mode, and 8×8 matrix330is used for luma and chroma components in the Inter mode.

In order to reduce the memory needed to store the quantization matrices, 8×8 matrices are used to generate 16×16 and 32×32 quantization matrices. The default quantization matrices for transform blocks of size 16×16 and 32×32 are obtained from the default 8×8 quantization matrices of the same type by up-sampling using replication. This procedure is shown inFIG. 4: the dot-filled block412in the figure indicate that a quantization matrix entry in the 8×8 quantization matrix410is replicated into a 2×2 region422in the 16×16 quantization matrix420and into a 4×4 region432in the 32×32 quantization matrix430.

Non-default quantization matrices can also be optionally transmitted in the bitstream in sequence parameter sets (SPS) or picture parameter sets (PPS).

Adaptive Multiple Core Transform

The new standard under development, VVC (Versatile Video Codec), is supporting more partition shapes compared to HEVC. A so-called multi-type tree (MTT) partitioning is proposed, where in addition to quad-tree (QT) structure supported in HEVC, binary and ternary splits are added. All supported splits in VVC are shown inFIG. 5, including quad-split510, vertical binary split520, horizontal binary-split530, vertical center-side ternary-split540and horizontal center-side ternary-split550.

In MTT, the tree structure is coded separately for luma and chroma in I slices, and applied simultaneously to both luma and chroma (except for certain minimum sizes constraint for chroma) in P and B slices. This means that in I slice the luma CTB has its MTT-structured block partitioning, and the two chroma CTBs may have another MTT-structured block partitioning. Also, in order to increase coding gain for higher resolution videos, ternary (TT) and binary (BT) splits can be applied to 128×128 luma/64×64 chroma coding tree blocks (CTBs) recursively. In addition, the maximum supported size of the TU is increased to 64×64 luma/32×32 chroma.

Adaptive Multiple Transform (AMT) scheme is used for residual coding for both inter and intra coded blocks in VTM (VVC test model). Multiple selected transforms from the DCT/DST families other than the current transforms in HEVC are applied to the residual blocks. Lately, transform matrices of DST-7, DCT-8 and DST-1 have been introduced. Table 1 shows the basis functions of the selected DST/DCT.

The AMT is applied to the CUs with both width and height smaller than or equal to 64, and whether AMT applies or not is controlled by a CU level flag. When the CU level flag is equal to 0, DCT-2 is applied in the CU to encode the residue. For a luma coding block within the AMT enabled CU, two additional flags are signaled to identify the horizontal and vertical transform to be used. As in HEVC, the residual of a block can be coded with transform skip mode in the VTM. To avoid the redundancy of syntax coding, the transform skip flag is not signaled when the CU level AMT flag is not equal to zero.

For Intra residue coding, due to the different residual statistics of different Intra prediction modes, a mode-dependent transform candidate selection process is used. One embodiment of the three defined transform subsets is shown in Table 2. The transform subset may be selected based on the Intra prediction mode. One embodiment of the selection process based on the Intra mode is shown in Table 3.

With the subset concept, transform subsets are first identified based on Error! Reference source not found.2 using the Intra prediction mode of a CU with the CU-level AMT flag is equal to 1. After that, for each of the horizontal and vertical transforms, one of the two transform candidates in the identified transform subset, can be selected and explicitly signaled with flags.

In case of Inter prediction residual, only one transform set, which consists of DST-7 and DCT-8, can be used for all Inter modes and for both horizontal and vertical transforms.

Furthermore, DCT-8 is known to have the following relationship with DST-7:

The CNVIIIand SNVIIin Equation (1) are inverse transform matrices for DCT-8 and DST-7, and i and j are row and column indices, respectively. In Equation (1), JNis the matrix represented by is along its anti-diagonal line, and the matrix DNalternates between 1 and −1 on its diagonal line. Therefore, DCT8 can be derived from DST7 with sign changes and reordering just before and after the DST7 computation. Hence, DST7 is reused in this implementation for DCT8. The sign changes and shuffling do not add any additional overhead to DST7, so that the computational complexity of DCT8 is identical to that of DST7. This avoids the usage of any additional memory in DCT8 and DST-1.

Since more block sizes and AMT are supported in VVC, a more efficient quantization matrix representation method is required in VTM.

According to the present invention, the default quantization matrices of size M×N are first defined and stored with a specified coefficient at each position for M×N transform unit, where M and N can be any even number between 2 and 64. In one embodiment, there can be three quantization/scaling matrices: one of size M=N=4 (for residual blocks of size 4×4, both Intra and Inter predictions) and two of size M=N=8 (one for Intra prediction and another one for Inter prediction). As an example, the corresponding matrices (310,320and330) inFIG. 3can be used as the default quantization matrices. In another embodiment, only default matrices for Intra prediction can be defined (e,g, for sizes 4×4 and 8×8), while quantization matrices for Inter prediction can be obtained from the corresponding matrices for Intra prediction.

In another embodiment, the default M×N quantization matrices are defined and stored, which are used to derive the default 2p×2kquantization matrices for 2p×2ktransform units, where p and k can take any value between 1 and 6. For example, k=p=4, k=p=5 or k=p=6, which would give sizes 16×16, 32×32, and 64×64.

After the default quantization matrices are defined and stored, a method (e.g., coefficient mapping and interpolation (named as coefficient mapping and interpolation step) including simple zero order interpolation method that uses repetition and linear interpolation based up-sampling) to generate the default quantization matrix for 2p×2k(e.g. 4×4, 4×8, 8×4,8×8, 4×16, 16×4, 4×32, 32×4, 8×16, 16×8, 16×16, 8×32, 32×8, 16×32, 32×16, 32×32, 16×64, 64×16, 32×64, 64×32, 64×64) transformed block from the default M×N quantization matrices.

The following flowcharts show three possible embodiments for defining matrices with a block size corresponding to 2p×2k. In one embodiment, inFIG. 6for example, for step1(610), at first, several square matrices (e.g. 16×16, 32×32, 64×64) are generated from the default matrices (e.g. 8×8) by applying the coefficient mapping and interpolation step. In step2(620), rectangular matrix is generated from the closest square quantization matrix by subsampling every M½pth and N½kth elements in rows and columns correspondingly. The square matrix of minimum size with width M1 and height N1 is determined step615, which are greater than or equal to both the corresponding width and height of the target rectangular matrix. For example, M1 and N1 can be equal to M. Thus, the closest square quantization matrix is M×M. In other examples, M1 may not be equal to N1, if the minimum size is M among M1 and N1, then closest square matrix is M×M. InFIG. 7, for step1(710), square matrices (e.g. 16×16, 32×32, 64×64) are generated from the default matrices (e.g. 8×8) by applying the coefficient mapping and interpolation step. In step2(720), rectangular matrix is generated from the closest square quantization matrix by applying the coefficient mapping and interpolation step for up-sampling elements in rows or columns by 2p/M and 2k/N times correspondingly. The square matrix of minimum size with width M1 or height N1 is determined step715, which are greater than or equal to the corresponding width or height of the target rectangular matrix. InFIG. 8, for step1(810), the rows or columns of the default matrix (e.g. 8×8) are up-sampled by a factor of 2p/M or 2k/N by applying the coefficient mapping and interpolation step. In step2(820), the columns or rows of the matrix from step1810, are up-sampled by a factor of 2k/N or 2p/M by applying the coefficient mapping and interpolation step.

In yet another embodiment, it is possible to up-sample the M×N matrices in a small interval for low frequency coefficients and up-sample the M×N matrices in a big interval for high frequency coefficients.

An example is shown inFIG. 9. InFIG. 9, for step1(910), the rows or columns of the base scaling matrix (e.g. 8×8) are up-sampled by a factor of t<2p/M for a given M1<M or by a factor of r<2k/N by for a given M2<M, by applying the coefficient mapping and interpolation step. In step2(920), the columns or rows of the matrix from step1910are up-sampled by a factor of r1>2k/N for a given M2>M, or by a factor of t1>2p/M for a given M1>M by applying the coefficient mapping and interpolation step. The values oft and t1 and r and r1 are determined in step915, where these values must be such that up-sampling will still result in a matrix of the size 2p/M×2k/N.

As an example, the 8×8 quantization matrix (base scaling matrix) for IntraLuma, IntraCb, IntraCr can be used for obtaining the 16×16 quantization matrix InterLuma, InterCb, InterCr for 16×16 transform units. For obtaining the first quantization matrix, up-sampling by a factor of 2 is applied in the horizontal and vertical directions. This will result in following 16×16 quantization matrix:

As another example, the 8×8 quantization matrix (base scaling matrix) for IntraLuma, IntraCb, IntraCr can be used for obtaining 8×16 quantization matrix for 8×16 transform blocks. For obtaining the second quantization matrix, up-sampling would be applied only to columns. This will result in following 8×16 quantization matrix:

In one embodiment, a method according to the present invention may use linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to generate the quantization matrix for different transformed blocks obtained by applying AMT from the default M×N quantization matrices.

In another embodiment, a method according to the present invention may use linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to generate the quantization matrix for Intra transform blocks from the default M×N quantization matrices.

In yet another embodiment, a method according to the present invention may use a method to signal the default quantization matrix for different transformed blocks obtained by applying AMT.

Customized Quantization Matrices Representation

In one embodiment, the user defined M×N quantization matrices with a specified coefficient in each position are defined and sent for M×N transform unit with lossless entropy coding. The M and N can be any even number between 2 and 64.

In another embodiment, the user defined smaller size quantization matrices of size M×N (where M and N be any even number between 2 and 64) are defined and sent, which are used to derive the 2p×2kquantization matrices for 2p×2ktransform units, where p and k can take any value between 1 and 6.

In another embodiment, a method is disclosed to use coefficient mapping and interpolation including simple zero order interpolation by pixel repetition and linear interpolation based up-sampling to generate the scaling matrix for 2p×2k(p !=k) transformed blocks (e.g. 4×8, 8×4, 4×16, 16×4, 4×32, 32×4, 8×16, 16×8, 8×32, 32×8, 16×32, 32×16, 16×64, 64×16, 32×64, 64×32) from the M×N quantization matrices, without sending any bits.

In this embodiment, for example, at decoder side, a plurality sizes of base scaling matrices are signaled and received. One of the base scaling matrices is selected (at least not larger than the transform blocks).To generate a target scaling matrix for a M×N transform block, first, the above-mentioned up-sampling methods may be applied to the base scaling matrix to generate an M×M matrix. Then, the target scaling matrix is derived from the M×M scaling matrix by sub-sampling the M×M scaling matrix to an M×N or N×M scaling matrix as the target scaling matrix. For example, if a received transform block size is 32×8, then an 8×8 base scaling matrix is selected. Then, by using pixel repetition or linear interpolation, a 32×32 scaling matrix is generated from the 8×8 base scaling matrix. Sub-sampling is then applied to the 32×32 scaling matrix so that a 32×8 scaling matrix is generated. Methods of sub-sampling may vary, for instance, one sub-sampling method may include taking every M/2pth and M/2kth coefficient in columns and rows respectively in the M×M scaling matrix, wherein M equals 2pand N equals 2k. This embodiment corresponds to setting M1 and N1 to M inFIG. 6.

In yet another embodiment, a method is disclosed to use linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to generate the user defined quantization matrix for different transformed blocks obtained by applying AMT from the default M×N quantization matrices, without sending any additional bits.

In yet another embodiment, a method is disclosed to use linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to generate the user defined quantization matrix for Inter transformed blocks obtained from the default M×N quantization matrices for Intra transform blocks, without sending any additional bits.

Methods for Generating Smaller Size M×N Quantization Matrices

Methods to generate smaller size M×N quantization matrices for M×N transform units are disclosed, where M and N can be any even number between 2 and 64) from bigger 2p×2kmatrices, where p and k can take any value between 1 and 6.

In one embodiment, the method always keeps the DC coefficient and subsample the M×N matrices in a fixed interval.

In another embodiment, the method always keeps the DC coefficient and subsample the M×N matrices in a small interval in low frequency coefficients and subsample the M×N matrices in a big interval in high frequency coefficients.

In yet another embodiment, the method always keeps the DC coefficient and the low frequency part of the M×N matrices, which has the same size of the target smaller size matrices.

Methods to Derive Big Size 2p×2kQuantization Matrices

Methods to derive big size 2p×2kquantization matrices are disclosed, where p and k can take any value between 1 and 6. The 2p×2kquantization matrices correspond to smaller size M×N quantization matrices generated by different sub-sampling methods described as above for the smaller size M×N quantization matrices, where M and N can be any even number between 2 and 64.

In one embodiment, the up-sampling method uses fixed interval interpolation and/or repetition. In cases when p!=k, (i.e., non-square transform), the number of interpolated coefficients in horizontal and vertical direction is equal to 2p/M and 2k/N respectively, where (2P and M) and (2kand N) correspond the number of rows and the number of columns in the target and signaled matrices respectively.

In another embodiment, the up-sampling method by uses smaller interval interpolation and/or repetition for low frequency coefficients and uses bigger interval interpolation and/or repetition for high frequency coefficients.

In yet another embodiment, the smaller size M×N matrices (M and N be any even number between 2 and 64) are used as the low frequency part of the big size 2p×2kquantization matrices (p and k be any value between 1 and 6) and the high frequency coefficients are generated based on a fixed pattern. In one embodiment, one can start from the end of low frequency part and increase the coefficient value with a fixed number with the increase of the frequency.

Methods to Derive M×N Quantization Matrices Corresponding to M×N Transform Units

Methods to derive M×N quantization matrices corresponding to M×N transform units are disclosed (M and N be any numbers between 2 and 64) for the cases that matrix for Inter prediction is defined from the corresponding matrix for Intra prediction

In one embodiment, different quantization matrices for Inter prediction transform blocks can be obtained depending on the size of the transform unit. In other words, all matrices for Inter prediction are defined from the corresponding quantization matrices for Intra prediction by applying methods such as linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to the corresponding elements of the matrices for Intra blocks.

In another embodiment, only certain quantization matrices for Inter prediction transform blocks are obtained from the corresponding quantization matrices for Intra prediction by applying methods such as linear combination of corresponding coefficients, matrix multiplication, linear/nonlinear regression, etc. to the corresponding elements of the matrices for Intra blocks. All rectangular matrices for Inter transform blocks may be obtained from the corresponding square quantization matrices for Inter transform blocks, by applying the default quantization matrices representation disclosed above.

Methods to Derive M×N Quantization Matrices Corresponding to M×N Transform Units for AMT

Methods to derive M×N quantization matrices corresponding to M×N transform units (M and N be any even numbers between 2 and 64) for the case when AMT is applied to residual signal (e.g. depending on different prediction modes). In this case, different quantization/scaling matrices may be applied depending on the transform type, such that it will be aligned to the energy compaction after the transform.

In one embodiment, different scaling matrices can be defined depending on the prediction mode (i.e., Inter or Intra prediction) independent of the transform types in AMT applied to the residual block.

In another embodiment, separate matrices can be obtained for block sizes smaller than K, where K can take any value from 4 to 32. For all remaining transform block sizes, same quantization matrices are used independent of the transform applied to the residual block.

In yet another embodiment, different scaling matrices are obtained for luma and chroma component, independent of the transform types in AMT applied to the residual block.

In another embodiment, transforms allowed in AMT are DST-1, DST-7, and DCT-8 and different scaling/quantization matrices can be defined for each transform, including DCT-2. The scaling/quantization matrices can be applied after horizontal and vertical transformation step.

In another embodiment, the transforms allowed include DST-1, DST-7, and DCT-8 and different scaling matrices may be computed for all combinations of DCT-2, DST-1, DST-7, and DCT-8 transforms based on the relation between these transforms.

In yet another embodiment, only a few scaling matrices are defined for the basic set of transforms (e.g. DCT-2, DST-1, DST-7, and DCT-8) and scaling matrices for the result of combination of the basis transforms may be defined by linear combination, matrix multiplication, permutation, sign changes, flipping, or any combination of these transformations of the basis scaling matrices.

In another embodiment, scaling matrices may be defined and signaled for a subset of basic transforms, (e.g. DCT-2, or DCT-2 and DST-7) and scaling matrices for the rest of the transforms (e.g. for DST-7, DST-1, and DCT-8, or for DST-1 and DCT-8) may be defined by linear combination, matrix multiplication, permutation, sign changes, flipping, or any combination of these transformations of the basis scaling matrices. In one example, the derivation process is dependent on the relationship between the defined transform type and the target transform type. In another example, the derivation process is dependent on the relationship between the defined transform coefficients and the target transform coefficients.

Any combination of the abovementioned methods of scaling matrices derivation can be used.

Option for Default Quantization Matrices Choices

A scheme is disclosed to provide the option for a user to decide between either default quantization matrices, or user defined quantization matrices, or use residual coding without any quantization applied (e.g., PCM transform/quantization bypass mode)

Zero-Out Process Applied with Scaling Matrices Generation

In one embodiment, an M×N scaling matrix set is used to quantize TUs with size larger than M×N if zero out is applied. In other words, all scaling matrix entries with row numbers larger than P are set to zero and all scaling matrix entries with column numbers larger than Q are set to zero. P and Q can be both smaller than CU width and CU height, only P smaller than CU width, or only Q smaller than CU height. For example, a 32×32 scaling matrix set is used to quantize 64×64 TUs if zero-out is applied to CU row larger than 32 and column larger than 32. In another example, a 32×4 scaling matrix set is used to quantize 64×4 TUs if zero-out is applied to CU column larger than 32. In another embodiment, an M×N scaling matrices set is used to quantize M×N TUs. The values in scaling matrices outside row P and column Q are assigned to zero. P and Q can be both smaller than M and N, only P smaller than M, or only Q smaller than N. For example, a 64×64 TU is quantized with a 64×64 scaling matrix. However, the values in range outside 32×32 are set to zero. In other words, the range outside 32×32 will be zeroed out in the quantization process. In another example, a 64×4 TU is quantized with a 64×4 scaling matrix. However, the values in range outside of the top-left 32×4 are zeroed out in the scaling matrix. In other words, the range outside 32×4 will be zeroed out in the quantization process.

In another embodiment, a method is disclosed to use coefficient up-sampling, coefficient mapping and interpolation (e.g., simple zero order interpolation by pixel repetition and linear interpolation based up-sampling) to generate the quantization matrix for 2p×2kwith p!=k (e.g. 4×8, 8×4, 4×16, 16×4, 4×32, 32×4, 8×16, 16×8, 8×32, 32×8, 16×32, 32×16, 16×64, 64×16, 32×64, 64×32) and 2p×2kwith p=k (e.g. 16×16, 32×32, 64×64) transformed block from the smaller M×N (e.g. 4×4, 8×8) quantization matrices, without sending any bits. A smaller number of smaller M×N quantization matrices need to be decoded when zero out is applied. For example, a 64×64 TU needs 64×64 scaling matrices for quantization. The 64×64 scaling matrices can be generated from 8×8 quantization matrices by up-sampling. When zero out is applied to 64×64 TUs, only 4×4 quantization matrices need to be signaled to generate the 64×64 scaling matrices because the range outside 32×32 in the 64×64 scaling matrices will be always zero.

In another embodiment, a method is disclosed to use coefficient up-sampling, coefficient mapping and interpolation (e.g., simple zero order interpolation by pixel repetition and linear interpolation based up-sampling) to generate the quantization matrix for 2p×2kwith p!=k (e.g. 4×8, 8×4, 4×16, 16×4, 4×32, 32×4, 8×16, 16×8, 8×32, 32×8, 16×32, 32×16, 16×64, 64×16, 32×64, 64×32) and 2p×2kwith p=k (e.g. 16×16, 32×32, 64×64) transformed block from the smaller M×N (e.g. 4×4, 8×8) quantization matrices, without sending any bits. After decoding the smaller M×N quantization matrices, the M×N quantization matrices are up-sampled to P×Q when zero out is applied on row P and column Q. For example, a 64×64 TU needs 64×64 scaling matrices for quantization. According to this embodiment, the 64×64 scaling matrices are generated by up-sampling 8×8 quantization matrices. When zero out is applied on row 32 and column 32 in 64×64 TUs, the 8×8 quantization matrices will be up-sample to 32×32 and the range outside row 32 or column 32 will be always zero.

Bit Reduction for Scaling Matrices

To reduce the bits needed for scaling matrices, in one embodiment, a scaling_list_skip flag can be signaled for each size of scaling matrices to indicate whether the scaling matrix has to be signaled or not. In other words, if a scaling_list_skip flag for scaling matrices with size M×M is decoded as TRUE, the scaling matrix with size M×M does not have to be decoded. In this case, the skipped scaling matrix will be generated by the decoded smaller scaling matrix. For example, if the decoding of scaling matrix for 16×16 is skipped, the scaling matrix for 16×16 will be generated from the 8×8 scaling matrix by up-sampling it to the size of 16×16. Up-sampling can be performed by duplication of elements (i.e., repetition), linear interpolation, etc. In another example, if the decoding of scaling matrix for TBs of size 16×16 and 32×32 are both skipped, the scaling matrix for 16×16 and 32×32 can be generated from the scaling matrix of size 8×8. The up-sampling can be performed by applying duplicating elements, linear interpolation, etc. In another embodiment, when a scaling_list_skip flag for scaling matrices of size M×M is decoded as TRUE, the scaling matrix of size M×M does not have to be decoded, and the skipped scaling matrix can be generated from the decoded larger scaling matrix, by applying down-sampling. For another example, if the decoding of scaling matrix for 16×16 and 32×32 are both skipped, the scaling matrix for 16×16 and 32×32 can be generated from the scaling matrix of size 64×64 by applying down-sampling. In another embodiment, a scaling_list_skip_idx can be signaled to indicate the maximum size of scaling matrix needed to be signaled. For example, if scaling_list_skip_idx is equal to 0, the 8×8-based scaling matrices for 2×2 to 64×64 must be signaled. If scaling_list_skip_idx is equal to 2, only 8×8-based scaling matrices for 2×2 to 16×16 need to be signaled. For the skipped scaling matrix, it can reuse the largest coded scaling matrix. For example, if scaling_list_skip_idx is equal to 2, only 8×8 base scaling matrices for 2×2 to 16×16 must be signaled. The 8×8 base scaling matrix for 16×16 will be used for obtaining 32×32 and 64×64 scaling matrices.

Scaling Matrix for Non-Separable Secondary Transform (NSST)

In JEM-4.0 (i.e., the reference software for JVET, Joint Video Exploration Team of ITU-T SG 16 WP 3 and ISO/IEC JTC 1/SC 29/WG 11), non-separable secondary transforms (NSST) are used for 4×4 or 8×8 top-left region of the TU sizes. For NSST, the size of secondary transform is selected depending on the transform size. In addition, the secondary transform is applied only when the number of non-zero coefficients is greater than the threshold.

According to the NSST encoding process, a primary transform is applied to an input block to form a primary transform block. When the NSST with 4×4 kernel is selected for the primary transform block (4×8 or smaller), the top-left 4×4 sub-block of the primary transform block is converted into a 16×1 one-dimensional (1D) coefficient vector. A secondary transform is then selected and applied to the 1D coefficient vector. The secondary transformed coefficient vector is then converted back to a two dimensional (2D) secondary transformed 4×4 block according to a scanning order. This secondary transformed 4×4 block is then used to replace the top-left 4×4 sub-block of the primary transform block to form an NSST modified transform block and subsequent coding process (e.g., quantization and entropy coding) is applied to the NSST modified transform block. When the NSST with 8×8 kernel is selected for the primary transform block (8×8 or larger), the top-left 8×8 sub-block of the primary transform block is converted into a 64×1 one-dimensional (1D) coefficient vector. A secondary transform is then selected and applied to the 1D coefficient vector. The secondary transformed coefficient vector is then converted back to a two dimensional (2D) secondary transformed 8×8 block according to a scanning order. This secondary transformed 8×8 block is then used to replace the top-left 8×8 sub-block of the primary transform block to form an NSST modified transform block.

Scaling matrices can be applied with the secondary transform to further improve the coding efficiency, e.g. non-separable secondary transform (NSST). When the secondary transform is applied to one top-left region with size equal to P×Q, P×Q coefficients or less than P×Q coefficients will be further modified by the secondary transform. In one embodiment, the NSST coefficients can have different scaling coefficients according to the selection of NSST. For example, if K coefficients will be modified by the secondary transform, only K entries in one scaling matrix must be signaled additionally. K can be 8, 16, 32, . . . , or 64. In another embodiment, only K/2 or K/4, or K/N samples in the scaling matrices must be signaled additionally. N can be any positive integer smaller than K.

In another embodiment, the minimum number between K and L samples must be signaled. The value of L can be any pre-defined integer, or can be signaled in tile_header, or tile_group_header. The value of L may also dependent on QP, temporal ID, prediction mode, bit-depth, etc. For example, K can be 1, 4, 16, etc. However, if the number of signaled samples for scaling matrices is smaller than the number of coefficients modified by secondary transform, an up-sampling technology can be applied to generate the corresponding elements in the scaling matrix. For example, if 16×16 secondary transform is applied, and only 8×8 top-left region in the 16×16 region will be further modified. Only the top-left 2×2 region in the 8×8 scaling matrix is signaled additionally for different NSST types. After decoding the 2×2 matrix, it will be up-sampled by duplicating elements or linear interpolation to an 8×8 scaling matrix.

For another example, if 8×8 secondary transform is applied and only 4×4 top-left region in the 8×8 region will be further modified by NSST, a scaling matrix for 4×4 instead of 8×8 is signaled and used for quantization. In another embodiment, if the secondary transform is enabled, quantization with scaling list will be disabled. In another embodiment, if the secondary transform is enabled, only default scaling matrix can be used for quantization. In another embodiment, if a secondary transform is applied, flat quantization matrices can be applied. In one embodiment, if a secondary transform is applied, no quantization matrices need to be signaled.

The concept of deriving a rectangular scaling matrix from the base scaling matrix is to apply up-sampling first to obtain a larger scaling matrix followed by down-sampling process. For a rectangular block, the width of the block is larger than or smaller than the height of the block. The number of rows or columns of the smaller side of the block is referred as S and the number of columns or rows of the larger side of the block is referred as L. The width and height of the larger scaling matrix are larger than or equal to the width and height of the rectangular scaling matrix respectively. However, the larger scaling matrix can be directly generated from one base scaling matrix so that the two-step operations can be combined into one step. For example, if the base scaling matrix is 8×8 and the target scaling matrix is 4×64, then in every column with index equal to 0, 2, 4, and 6, each element is duplicated 8 times, resulting in four 1×64 columns, which are joined to form one 4×64 scaling matrix. In another example, when the zero-out algorithm is applied to the high frequency components, a scaling matrix for the TB with zero-out region can still be generated in one step. For example, when the base scaling matrix is 8×8, the target scaling matrix is 4×64, and the zero-out region is the high frequency components with index larger than 31, then for each column with index equal to 0, 2, 4, and 6, every element with index smaller than 4 is duplicated 8 times, resulting in four 1×32 columns. In one embodiment, 32 zero values are appended to every column, resulting in four 1×64 columns. These columns are joined to form one 4×64 scaling matrix. In another embodiment, a 4×32 scaling matrix is used without appending zero values for high frequency components.

In another embodiment for generating an M×N (e.g., 4×32) rectangular scaling matrix, each of W/S columns of the square base scaling matrix can be extended using sample duplication to generate one extended column having N (e.g., 32) samples, where W is the width of the base scaling matrix (e.g., 8×8). Each of W/S (i.e., 2 since W=8 and S=4) columns can be used to generate M (e.g., 4) columns at the target scaling matrix by sample duplication.

Any of the foregoing proposed methods can be implemented in various hardware, software realizations of encoders and/or decoders, or a combination thereof. For example, an embodiment of the present invention can be one or more circuits integrated into a video compression chip or program code integrated into video compression software to perform the processing described herein. For example, any of the proposed methods can be implemented as a circuit coupled to a quantization module and an inverse quantization module of the encoder, and can be implemented as a circuit coupled to an inverse quantization module of the decoder. In one embodiment, any of the proposed methods can be implemented in a quantization module and an inverse quantization module of an encoder, and can be implemented in an inverse quantization module of a decoder

Video encoders have to follow the foregoing syntax design so as to generate the legal bitstream, and video decoders are able to decode the bitstream correctly only if the parsing process complies with the foregoing syntax design. When the syntax is skipped in the bitstream, encoders and decoders should set the syntax value as an inferred value to guarantee the encoding and decoding results are matched.

FIG. 10illustrates a flowchart of an exemplary coding system using a scaling matrix for non-separable secondary transform coded blocks according to an embodiment of the present invention. The steps shown in the flowchart may be implemented as program codes executable on one or more processors (e.g., one or more CPUs) at the encoder side. The steps shown in the flowchart may also be implemented based hardware such as one or more electronic devices or processors arranged to perform the steps in the flowchart. According to this method, input data related to a current block in a current picture are received in step1010, wherein the input data correspond to a transform block of the current block at a video encoder side and the input data correspond to a decoded-quantized transform block of the current block at a video decoder side. A flag is determined in step1020, wherein the flag indicates whether a scaling matrix is enabled or not enabled for non-separable secondary transform coded blocks. When the current block is one non-separable secondary transform coded block, the flag is check to determine whether the scaling matrix is enabled for the non-separable secondary transform coded blocks in step1030. If the flag indicates that the scaling matrix is enabled for the non-separable secondary transform coded blocks (i.e., the “Yes” path from step1030), steps1040and1050are performed. Otherwise, (i.e., the “No” path from step1030), steps1040and1050are skipped. In step1040, the scaling matrix is determined. In step1050, the scaling matrix is applied to the current block.

FIG. 11illustrates a flowchart of an exemplary coding system using scaling matrix derivation method according to an embodiment of the present invention. According to this method, input data related to a current block in a current picture is received in step1110, wherein the input data correspond to a transform block of the current block at a video encoder side and the input data correspond to a decoded-quantized transform block of the current block at a video decoder side, and the current block is rectangular with width of the current block larger than or smaller than height of the current block. A target scaling matrix is generated directly from a square base scaling matrix in one step without up-sampling-and-down-sampling or down-sampling-and-up-sampling in step1120. The current block is scaled according to the target scaling matrix in step1130.

The flowchart shown is intended to illustrate an example of video coding according to the present invention. A person skilled in the art may modify each step, re-arranges the steps, split a step, or combine steps to practice the present invention without departing from the spirit of the present invention. In the disclosure, specific syntax and semantics have been used to illustrate examples to implement embodiments of the present invention. A skilled person may practice the present invention by substituting the syntax and semantics with equivalent syntax and semantics without departing from the spirit of the present invention.