CN112911312A - Encoding and decoding method, device and equipment - Google Patents

Encoding and decoding method, device and equipment Download PDF

Info

Publication number
CN112911312A
CN112911312A CN201911223606.0A CN201911223606A CN112911312A CN 112911312 A CN112911312 A CN 112911312A CN 201911223606 A CN201911223606 A CN 201911223606A CN 112911312 A CN112911312 A CN 112911312A
Authority
CN
China
Prior art keywords
current block
transformation
coefficient matrix
target
transform
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911223606.0A
Other languages
Chinese (zh)
Other versions
CN112911312B (en
Inventor
曹小强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201911223606.0A priority Critical patent/CN112911312B/en
Priority to CN202111150952.8A priority patent/CN114007080B/en
Publication of CN112911312A publication Critical patent/CN112911312A/en
Application granted granted Critical
Publication of CN112911312B publication Critical patent/CN112911312B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • H04N19/122Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream

Abstract

The application provides a coding method, a decoding method, a device and equipment thereof, wherein the coding method comprises the following steps: obtaining a residual error coefficient matrix corresponding to the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix; if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block; wherein the first preset condition comprises: the current block performs initial transformation on the residual coefficient matrix by adopting a transformation check (DCT 2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block. The coding performance is improved through the application.

Description

Encoding and decoding method, device and equipment
Technical Field
The present application relates to the field of encoding and decoding technologies, and in particular, to an encoding method, an encoding device, a decoding device, and an encoding apparatus.
Background
In order to save space, video images are transmitted after being encoded, and the complete video encoding method may include processes of prediction, transformation, quantization, entropy encoding, filtering, and the like. Predictive coding may include intra-coding and inter-coding. Inter-frame coding uses the correlation of video time domain and uses the pixel of adjacent coded image to predict the pixel of current image so as to remove the redundancy of video time domain. In the intra-frame coding, strong spatial correlation between adjacent blocks is considered, pixels which are reconstructed around are used as reference pixels to predict a current uncoded block, and only the subsequent coding processing is needed to be carried out on a residual value instead of the original value, so that the redundancy on a spatial domain is effectively removed, and the compression efficiency is greatly improved.
In video coding, transform refers to converting an image described in the form of pixels in the spatial domain into an image in the transform domain and representing it in the form of transform coefficients. Most images contain more flat areas and slowly-changing areas, so that the image energy can be distributed in a spatial domain in a dispersed manner in a proper conversion process and converted into relatively concentrated distribution in a conversion domain, thereby removing the frequency domain correlation among signals and effectively compressing a code stream in cooperation with a quantization process.
For the transformation process, a quadratic transformation technique is proposed in the related art. The quadratic transformation technique is as follows: firstly, initial transformation is carried out to obtain a transformation coefficient after the initial transformation. And then, carrying out secondary transformation on the transformation coefficient after the initial transformation to obtain a new transformation coefficient. Then, the new transform coefficients are quantized and entropy encoded. However, in practical applications, if the energy of the transform coefficient after the initial transform is sufficiently concentrated after the initial transform is performed, then when the transform coefficient after the initial transform is subjected to the secondary transform, an over-fitting phenomenon may occur, which may result in a problem of relatively poor encoding performance.
Disclosure of Invention
The application provides a coding method, which is applied to a coding end, and the method comprises the following steps:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block;
wherein the first preset condition comprises: the current block initially transforms the residual coefficient matrix by adopting a transform check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
The application provides a coding method, which is applied to a coding end, and the method comprises the following steps:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation, the current block starts a selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block;
wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a decoding method, which is applied to a decoding end and comprises the following steps:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation and the current block meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation, and determining the target transformation coefficient matrix as an initial transformation coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
The application provides a decoding method, which is applied to a decoding end and comprises the following steps:
acquiring a coded bit stream of a current block;
if the current block supports secondary transformation, the current block enables selectable secondary transformation AST technology, and the current block meets a fourth preset condition, indication information is analyzed from the coded bit stream, and whether inverse secondary transformation is carried out on the current block is determined according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a decoding method, which is applied to a decoding end and comprises the following steps:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation, the current block enables selectable AST (auto-switch) technology, and the current block meets a fourth preset condition, determining target characteristics of the target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a coding device, is applied to the code end, the device includes:
the acquisition module is used for acquiring a residual coefficient matrix corresponding to the current block;
the processing module is used for carrying out initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module, configured to determine that no secondary transform is performed on the current block and determine the initial transform coefficient matrix as a target transform coefficient matrix of the current block if the current block supports secondary transform and the current block meets a first preset condition;
wherein the first preset condition comprises: the current block initially transforms the residual coefficient matrix by adopting a transform check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
The application provides a coding device, is applied to the code end, the device includes:
the acquisition module is used for acquiring a residual coefficient matrix corresponding to the current block;
the processing module is used for carrying out initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module, configured to determine whether to perform secondary transform on the current block according to a rate distortion cost value corresponding to the current block if the current block supports secondary transform, and the current block enables a selectable secondary transform AST technique, and meets a second preset condition; wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a decoding device, is applied to the decoding end, the device includes:
an obtaining module, configured to obtain a coded bit stream of a current block, and parse a target transform coefficient matrix from the coded bit stream;
a determining module, configured to determine that inverse quadratic transform is not performed on the current block and determine the target transform coefficient matrix as an initial transform coefficient matrix of the current block if the current block supports quadratic transform and the current block meets a third preset condition; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
the processing module is used for carrying out initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block; determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
The application provides a decoding device, is applied to the decoding end, the device includes:
an obtaining module, configured to obtain a coded bit stream of a current block;
a determining module, configured to, if a current block supports secondary transform, enable a selectable AST technique for secondary transform, and the current block satisfies a fourth preset condition, parse indication information from the encoded bitstream, and determine whether to perform inverse secondary transform on the current block according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a decoding device, is applied to the decoding end, the device includes:
an obtaining module, configured to obtain a coded bit stream of a current block, and parse a target transform coefficient matrix from the coded bit stream;
a determining module, configured to determine a target feature of a target transform coefficient matrix according to a transform coefficient in the target transform coefficient matrix if a current block supports quadratic transform, the current block enables a selectable AST technique, and the current block satisfies a fourth preset condition; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block; determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a coding end device, including: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine executable instructions to perform the steps of:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block; wherein the first preset condition comprises: the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation, the current block starts a selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block;
wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The application provides a decoding side device, including: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine executable instructions to perform the steps of:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation and the current block meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation, and determining the target transformation coefficient matrix as an initial transformation coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block;
if the current block supports secondary transformation, the current block enables selectable secondary transformation AST technology, and the current block meets a fourth preset condition, indication information is analyzed from the coded bit stream, and whether inverse secondary transformation is carried out on the current block is determined according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation, the current block enables selectable AST (auto-switch) technology, and the current block meets a fourth preset condition, determining target characteristics of the target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Drawings
FIGS. 1A-1C are schematic diagrams of DT partition patterns in one embodiment of the present application;
FIG. 2 is a diagram illustrating intra prediction modes according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a video coding framework in one embodiment of the present application;
FIGS. 4A-4D are flow charts of encoding and decoding methods according to an embodiment of the present application;
FIGS. 5A-5G are flow charts of encoding and decoding methods according to an embodiment of the present application;
FIGS. 6A to 6E are structural diagrams of an encoding/decoding apparatus according to an embodiment of the present application;
fig. 7A is a hardware structure diagram of an encoding end device in an embodiment of the present application;
fig. 7B is a hardware configuration diagram of a decoding-side device according to an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the examples and claims of this application, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items. It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Depending on the context, moreover, the word "if" may be used is interpreted as "at … …," or "when … …," or "in response to a determination.
In order to make those skilled in the art better understand the technical solution of the present application, the following technical terms are briefly described.
Prediction pixel (Prediction Signal): the method is characterized in that residual errors are obtained through the difference between original pixels and predicted pixels according to pixel values derived from pixels which are coded and decoded, and then processes such as residual error transformation, quantization, coefficient coding and the like are carried out.
Intra Prediction (Intra Prediction): refers to a prediction mode for predicting a prediction value of a current block by reconstructed pixel values of a peripheral decoded area. Common ways include copying pixels in the angular direction and deriving the prediction values according to a certain gradient principle. Illustratively, intra prediction removes the spatial correlation of the video/image.
Transform kernel: in video coding, Transform is an essential stage for realizing data compression, and the Transform can make the energy of a signal more concentrated, and a Transform technique based on Discrete Cosine Transform (DCT)/Discrete Sine Transform (DST) has been a mainstream Transform technique for video coding. DCT and DST are further classified into a plurality of transformation kernels according to the difference of basis functions, and three transformation kernels are shown, as shown in table 1.
TABLE 1
Figure BDA0002301533410000051
Figure BDA0002301533410000061
Forward transform (forward transform) and inverse transform (inverse transform): in the video coding process, a forward transform, also called forward transform, and an inverse transform, also called reverse transform, are included. For example, the forward transform is to convert a two-dimensional residual coefficient (also referred to as a residual signal) into a two-dimensional transform coefficient (also referred to as a spectral signal) with more concentrated energy, and the transform coefficient can effectively remove high-frequency components and retain medium-low frequency components through quantization and other processes, thereby playing a role in compression. For example, the forward transform process may be represented by a matrix form of formula (1).
F=B·f·ATFormula (1)
Illustratively, M denotes the width of the residual block (i.e., the block of residual coefficients), N denotes the height of the residual block, F denotes the original residual signal in dimensions N × M, F denotes the frequency domain signal in dimensions N × M (i.e., the frequency domain signal after transformation), a and B denote transformation matrices in dimensions M × M and N × N, and both a and B satisfy orthogonality, such as the transformation kernels shown in table 1.
The inverse transformation is the inverse of the forward transformation, i.e. the frequency domain signal F can be converted into a time domain residual signal F by means of a transformation matrix a and a transformation matrix B. For example, the inverse transformation process may be represented by a matrix form of equation (2).
f=BTF. A formula (2)
Horizontal transformation (Horizental transform) and Vertical transformation (Vertical transform): in the encoding conversion stage, a two-dimensional residual signal is input, and X is set to be A.fTIf F is equal to B.XTFor example, by a matrix form of formula (3).
F=B·f·AT=B·(A·fT)TFormula (3)
In summary, it can be seen that the forward transformation of the two-dimensional signal can be implemented by two times of one-dimensional forward transformations, and after the first forward transformation, an M × N signal X is obtained, and the correlation between the horizontal pixels of the two-dimensional residual signal is removed, so that the first forward transformation is called horizontal transformation, and is called a horizontal transformation matrix. The second forward transform is called vertical transform, and B is called a vertical transform matrix, because the signal F is obtained after the second forward transform, and the correlation between the pixels in the vertical direction of the two-dimensional residual signal is removed.
Transform pair (Transform pair): also called transformation kernels, M is not necessarily equal to N, the dimensions of a and B are not necessarily equal in order to support matrix blocks, and it is also possible to support transformation matrices that a and B are not produced by the same kind of transformation kernels, so that there is a transformation pair { H, V } in the transformation that consists of transformation kernels corresponding to a and B, H being called a horizontal transformation kernel and V being called a vertical transformation kernel.
Rate-Distortion principle (RDO, Rate-Distoretion Optimized): there are two major indicators for evaluating coding efficiency: code rate and PSNR (Peak Signal to Noise Ratio). The smaller the bitstream, the larger the compression rate; the larger the PSNR, the better the reconstructed image quality. In the mode selection, the discriminant formula is essentially a comprehensive evaluation of the two.
Cost values corresponding to the modes are as follows: j (mode) ═ D + λ R. Illustratively, D represents the distorsion, which is usually measured by using an SSE index, wherein SSE is the sum of the mean square of the difference values of the reconstructed block and the source image; λ is the Lagrangian multiplier; r is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residual, etc. When selecting the mode, if the RDO principle is used to make a comparison decision on the coding mode, the best coding performance can be ensured.
Implicit Transform core Selection (IST), Implicit Selection of Transform: for the intra prediction residual block, the conventional DCT2 transform method is usually used, however, for most of the intra prediction residual blocks, DST7 exhibits better energy concentration, and therefore, multi-transform kernel selection based on Coding Unit (CU) -level (level) further improves the coding performance. In the related art, a transform core selection method based on implicit expression, namely, concealing a flag bit (which may be referred to as an IST flag bit) of a transform core is proposed, so as to implicitly indicate a transform core used for transforming a current block.
Illustratively, the encoding end needs to select whether the transform check is adopted (DCT 2) or (DST7, DST7) through RDO, in order to hide the IST flag bit, it is considered that when the encoding end selects the transform check as (DCT 2), the number of the non-zero transform coefficients of the current block is an even number, and if the actual non-zero number is an odd number, the encoding end may set the last non-zero transform coefficient to zero, so that the number of the non-zero transform coefficients of the current block must be an even number. Similarly, when the encoding end selects the transform check as (DST 7), the number of the non-zero transform coefficients of the current block is an odd number, and if the actual non-zero transform check is an even number, the encoding end may set the last non-zero transform coefficient to zero, so that the number of the non-zero transform coefficients of the current block is always an odd number.
From the perspective of hardware implementation, the hardware implementation of the DST7 transformation core requires a large number of multiplications, and the hardware implementation cost is relatively high. Therefore, in order to reduce the complexity of hardware implementation, for a transform block with transform coefficients exceeding a certain range, the DST7 transform kernel may not be used, and the specific method is as follows: sr _ x represents the abscissa of the rightmost non-zero transform coefficient in the current transform coefficient matrix, sr _ y represents the ordinate of the bottommost non-zero transform coefficient in the current transform coefficient matrix, and the regions corresponding to all the non-zero transform coefficients in the current transform coefficient matrix can be determined by sr _ x and sr _ y, and the transform coefficients of the regions beyond the regions are all 0.
Because sr _ x and sr _ y need to be transmitted to the decoding end, the decoding end can directly obtain sr _ x and sr _ y, when sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, the decoding end can directly judge the transformation kernel used by IST as (DCT 2), and the parity of the number of nonzero transformation coefficients does not need to be counted; otherwise, the parity of the number of nonzero transform coefficients of the current block needs to be determined, if the parity is odd, the transform kernel used by the IST is (DST 7), and if the parity is even, the transform kernel used by the IST is (DCT 2), which can be expressed by the following formula:
IstTuFlag=(sr_x>=16||sr_y>=16)?0:(num_nz%21:0)
based on the above analysis, it can be concluded that, finally, the selection method of the IST transformation kernel can be seen in table 2:
TABLE 2
Figure BDA0002301533410000071
Illustratively, the IST may act on a current block satisfying the following condition: the current block is in an intra-frame prediction mode; the dividing mode of the current sub-block is a non-DT mode; the width of the current block is less than 64; the height of the current block is less than 64.
Derivative Tree (DT) partitioning mode: the DT division pattern is a new division pattern, resulting in a new division shape, enabling further performance gains to be achieved. For example, the DT division pattern may include a horizontal derivation pattern and a vertical derivation pattern, and a schematic diagram thereof may be as shown in fig. 1A. For example, DT partition patterns may grow on leaf nodes of quadtrees or binary trees, as shown in fig. 1B, for an I-frame or non-I-frame, the DT partition patterns may result in different PU partitions (2N × hN, 2N × nU, 2N × nD, hN × 2N, nL × 2N, or nR × 2N) of the derived patterns by merging partition boundaries for CUs.
For example, for the intra prediction mode, the current block predicted by the derivation mode can be transform quantized by using 4 non-blocks without introducing a new transform kernel, and the diagram can be shown in fig. 1C.
Illustratively, a current block using the horizontal derivation mode needs to satisfy the following 2 conditions: the height is more than or equal to 16 and less than or equal to 64; the width to height ratio is less than 4. Illustratively, a current block using the vertical derivation mode needs to satisfy the following 2 conditions: the width is more than or equal to 16 and less than or equal to 64; the ratio of height to width is less than 4.
Intra prediction mode of AVS 3: the AVS2 has 33 intra prediction modes in total, and the 33 intra prediction modes include 30 angular modes and 3 special intra modes. To support finer angular prediction, AVS3 proposes to extend the angular prediction modes to 62, plus 3 special intra modes, for a total of 65 modes. Referring to fig. 2, which is a schematic diagram of an intra prediction mode, the mode number of an original angle prediction mode is not changed, and the mode number of an added angle prediction mode is increased from 34 to 65.
The video coding framework comprises the following steps: referring to fig. 3, a video encoding frame may be used to implement the encoding-side processing flow in the embodiment of the present application, a schematic diagram of a video decoding frame is similar to that in fig. 3, and details are not repeated here, and a video decoding frame may be used to implement the decoding-side processing flow in the embodiment of the present application. In the video encoding and decoding frameworks, there may be included, but not limited to: intra prediction, motion estimation/motion compensation, reference picture buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy encoder, etc. At the encoding end, the processing flow of the encoding end can be realized through the cooperation of the modules, and at the decoding end, the processing flow of the decoding end can be realized through the cooperation of the modules.
For example, in a video encoding process, transform refers to converting an image described in the form of pixels in a spatial domain into an image in a transform domain, and representing the image in the form of transform coefficients. Most images contain more flat areas and slowly-changing areas, so that the image energy can be distributed in a spatial domain in a dispersed manner in a proper conversion process and converted into relatively concentrated distribution in a conversion domain, thereby removing the frequency domain correlation among signals and effectively compressing a code stream in cooperation with a quantization process.
For example, entropy coding refers to a method of lossless coding according to the principle of information entropy, and is performed in a last processing module of video compression to convert a series of element symbols used for representing a video sequence into a binary code stream for transmission or storage, where the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, and the like, and the output data of the entropy coding module is the final code stream of the original video compression. Entropy coding can effectively remove the statistical redundancy of the video element symbols, and is one of the important tools for ensuring the compression efficiency of video coding.
And (3) secondary transformation: in the related art, different quadratic transformation matrices are used for 4 × 4 blocks and non-4 × 4 blocks. From the encoding end, transform coefficients are obtained after (DCT 2) transform, then 4 x 4 transform coefficients at the upper left corner are multiplied by a quadratic transform matrix to obtain new transform coefficients, and then quantization and entropy coding are carried out. From the decoding end, after inverse quantization is carried out on the transform coefficient obtained by entropy decoding of the code stream, secondary inverse transform is carried out on the 4 x 4 area at the upper left corner to obtain a new transform coefficient, and then inverse transform is carried out on the whole transform block by using (DCT 2) to obtain a residual coefficient. The specific decoding end inverse transformation process of the secondary transformation is as follows:
case one, if the current transform block is a luma intra prediction residual block, the value of the width or height is greater than 4, and the value of the quadratic transform enable flag (SecondaryTransformEnableFlag) is equal to 1 (the value of the quadratic transform enable flag is equal to 1, indicating that quadratic transform is allowed to be enabled at the sequence level or the frame level), the following is performed on the coefficient matrix:
firstly, a coefficient matrix C of the upper left corner 4 × 4 is obtained from the transform coefficient matrix: c. Cij=coeffijI is 0 to 3 and j is 0 to 3, and in the above formula, c isijIs an element of the matrix C, coeffijAre elements of a matrix of transform coefficients.
Illustratively, if the intra prediction mode has a value of 0 ~ 2, or 13 ~ 32, or 44 ~ 65, and the reference sample outside the current block to the left is "available", then: c. Cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pijIs the element of 4 x 4 matrix P, which is calculated as follows: p ═ CxS4,S4Is a 4 x 4 inverse transformation matrix, Clip3(-32768, 32767, (p)ij+26)>>7) Is shown if cijIs between-32768 and 32767, then cijHas a value of (p)ij+26)>>7 if cijA value of less than-32768, then cijHas a value of-32768, if cijIf the value of (3) is greater than 32767, then cijHas a value of 32767.
Illustratively, if the intra prediction mode has a value of 0 ~ 23, or 34 ~ 57, and the reference samples on the outside and above the current block are "available", then: c. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qijIs an element of a 4 x 4 matrix Q, which is calculated as follows: q ═ S4 T×C,S4 TIs S4Transposed matrix of (1), S4Is a 4 x 4 inverse transform matrix.
The values of the elements of the transform coefficient matrix are then modified according to matrix C: coeffij=cij,i=0~3,j=0~3。
Then, the matrix coeff is initially inverse transformed.
Case two, if the current transform block is a luma intra prediction residual block, the values of width and height are equal to 4, and the value of the quadratic transform enable flag (SecondaryTransformEnableFlag) is equal to 1 (the value of the quadratic transform enable flag is equal to 1, indicating that quadratic transform is allowed to be enabled at the sequence level or the frame level), the following operations are performed on the coefficient matrix:
firstly, the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k is a radical ofij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows: v ═ D4 T×CoeffMatrix,D4 TIs an inverse transformation matrix D4The transpose matrix of (1), CoeffMatrix being a transform coefficient.
Then, performing the following horizontal inverse transformation on the matrix K to obtain a matrix H: h isij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 22-BitDepth, matrix W: w ═ KXD4,D4Is an inverse transform matrix.
For example, for 4 × 4 blocks, the initial inverse transform is not needed after the inverse transform of the second transform is performed.
Referring to the above embodiments, the quadratic transformation technique refers to: firstly, initial transformation is carried out to obtain a transformation coefficient after the initial transformation. And then, carrying out secondary transformation on the transformation coefficient after the initial transformation to obtain a new transformation coefficient. Then, the new transform coefficients are quantized and entropy encoded. In the related art, it is default that all luminance intra prediction residual blocks need to be transformed twice. However, if the energy of the transform coefficient after the initial transform is sufficiently concentrated after the initial transform is performed, then when the transform coefficient after the initial transform is subjected to the secondary transform, an over-fitting phenomenon may occur, which may result in a problem of poor encoding performance, that is, an encoding effect of performing the secondary transform is not ideal.
In view of the above findings, in the embodiment of the present application, after performing initial transformation on a current block to obtain an initial transformation coefficient matrix, it may be determined whether to perform secondary transformation on the current block, and if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation, and some data blocks that do not need to be subjected to secondary transformation are removed to perform a redundancy removal effect, so that the encoding performance may be improved.
In one possible embodiment, for the encoding side, whether to secondarily transform the current block may be determined based on an intra prediction mode of the current block. For example, if the mode number of the intra prediction mode of the current block is located in the first mode number interval (e.g., mode number 34 to mode number 65), it is determined that the current block is not secondarily transformed. For the decoding side, it may be determined whether to secondarily transform the current block based on the intra prediction mode of the current block. For example, if the mode number of the intra prediction mode of the current block is located in the first mode number interval (e.g., mode number 34 to mode number 65), it is determined that the current block is not secondarily transformed.
In another possible implementation, for an encoding side, whether to perform secondary transform on a current block may be determined by using RDO, and indication information (e.g., secTuflag) is explicitly encoded to indicate whether to perform secondary transform on the current block, for example, when a value of secTuflag is a first value, it indicates that the current block is to be subjected to secondary transform, and when the value of secTuflag is a second value, it indicates that the current block is not to be subjected to secondary transform. For a decoding end, after an encoded bit stream is obtained, a secTuflag of a current block can be analyzed from the encoded bit stream, if the value of the secTuflag is a first value, inverse quadratic transformation is determined to be performed on the current block, and if the value of the secTuflag is a second value, the inverse quadratic transformation is not performed on the current block.
In another possible implementation, for the encoding side, it may be determined whether to perform secondary transform on the current block through RDO, and whether to perform secondary transform on the current block is implicitly indicated by a target characteristic (such as parity, etc.) of a target transform coefficient matrix, rather than explicitly indicated by indication information. For a decoding end, after the coded bit stream is obtained, a target transform coefficient matrix is analyzed from the coded bit stream, and a target value of a preset flag of a current block is determined according to target characteristics of the target transform coefficient matrix, that is, the target value of the preset flag of the current block is deduced. And if the target value of the preset zone bit is the first value, determining to perform inverse quadratic transformation on the current block. And if the target value of the preset zone bit is the second value, determining that the current block is not subjected to inverse quadratic transformation.
Of course, the above approaches are just a few examples of determining whether to perform a quadratic transform on the current block, and are not limited thereto.
The encoding method and the decoding method according to the embodiments of the present application will be described in detail below with reference to several specific embodiments.
Example 1: in a possible implementation manner, referring to fig. 4A, a flowchart of an encoding method proposed in an embodiment of the present application is shown, where the encoding method may be applied to an encoding side, and the encoding method may include the following steps:
step 411, obtaining a residual coefficient matrix corresponding to the current block.
Step 412, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
In step 413, if the current block supports the quadratic transform and the current block satisfies the first predetermined condition, it is determined that the quadratic transform is not performed on the current block. For example, the current block supports quadratic transformation, which may mean: the value of the quadratic transform enable flag (e.g., SecondaryTransformEnableFlag) is equal to a preset value (e.g., 1), and the value of the quadratic transform enable flag is equal to the preset value, indicating that the quadratic transform is allowed to be enabled at a sequence level or a frame level, i.e., the quadratic transform is allowed to be enabled for the current block.
And step 414, if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block, and encoding according to the target transformation coefficient matrix to obtain the encoded bit stream of the current block.
In a possible embodiment, the first preset condition may include, but is not limited to: the current block initially transforms the residual coefficient matrix using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and a first mode number interval of the intra prediction includes a mode number of the intra prediction mode of the current block.
Illustratively, the first preset condition, in addition to the step of initially transforming the residual coefficient matrix by the current block using a transform check (DCT 2), the prediction mode of the current block being an intra prediction mode, and the first mode number interval of intra prediction including the mode number of the intra prediction mode of the current block, may further include: the current block is a luminance block.
For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65.
Illustratively, if the current block is initially transformed on the residual coefficient matrix using a transform check (DST 7), it is determined that the current block is not secondarily transformed.
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Example 2: referring to fig. 4B, a flowchart of a decoding method proposed in an embodiment of the present application is shown, where the decoding method corresponds to the encoding method of embodiment 1, and the decoding method may be applied to a decoding end, and the method may include:
in step 421, the encoded bit stream of the current block is obtained, and the target transform coefficient matrix is parsed from the encoded bit stream.
Step 422, if the current block supports quadratic transformation and the current block meets a third preset condition, determining that inverse quadratic transformation is not performed on the current block.
Step 423, if the inverse quadratic transformation is not performed on the current block, determining the target transformation coefficient matrix as the initial transformation coefficient matrix of the current block; and if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix.
Step 424, performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block; and determining a reconstruction value of the current block according to the residual coefficient matrix.
In a possible embodiment, the third preset condition may include, but is not limited to: the current block is initially inverse-transformed using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and a first mode number interval of the intra prediction includes a mode number of the intra prediction mode of the current block.
Illustratively, the third preset condition, in addition to including that the current block is initially inverse-transformed using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and the first mode number section of intra prediction includes a mode number of the intra prediction mode of the current block, may further include: the current block is a luminance block.
For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65.
For example, if the current block is initially inverse-transformed using a transform check (DST 7), it may be determined that the current block is not inverse-twice transformed.
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Example 3: based on the same application concept as that of the foregoing embodiment 1, as shown in fig. 4C, a schematic flow chart of another encoding method proposed in the embodiment of the present application is shown, where the method may be applied to an encoding end, and the method may include the following steps:
and 431, acquiring a residual coefficient matrix corresponding to the current block.
For example, a reference block corresponding to the current block may be determined, and for each pixel point of the current block, a reference point corresponding to the pixel point is determined from the reference block. The difference between the pixel value of the pixel point and the pixel value of the reference point is the residual coefficient corresponding to the pixel point, and the residual coefficients corresponding to all the pixel points of the current block form a residual coefficient matrix corresponding to the current block.
And 432, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
For example, the residual coefficient matrix may be initially transformed by using a transform kernel (DCT 2) to obtain an initial transform coefficient matrix, or may be initially transformed by using a transform kernel (DST 7) to obtain an initial transform coefficient matrix. When the residual coefficient matrix is initially transformed by using a transform kernel (DCT 2), the initial transformation process can be shown in formula (3), where the matrix a is DCT2 (see table 1) and the matrix B is also DCT 2. When the residual coefficient matrix is initially transformed by using the transformation checkup (DST 7), the initial transformation process can be shown in formula (3), where the matrix a is DST7 (see table 1) and the matrix B is also DST 7.
As to whether the residual coefficient matrix is initially transformed using a transform kernel (DCT 2) or a transform kernel (DST 7), the following may be used: sr _ x represents the abscissa of the rightmost non-zero transform coefficient in the residual coefficient matrix, sr _ y represents the ordinate of the bottommost non-zero transform coefficient in the residual coefficient matrix, and sr _ x and sr _ y can determine the regions corresponding to all non-zero transform coefficients in the residual coefficient matrix, and the regions beyond the regions are all 0. If sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, the encoding end performs initial transformation on the residual coefficient matrix by using a transformation check (DCT2 ). Otherwise, the encoding end selects whether to adopt the transformation check (DCT 2) or the transformation check (DST 7) through RDO. For example, if the rate-distortion cost value of the transform checkup (DCT 2) is less than the rate-distortion cost value of the transform checkup (DST 7), the residual coefficient matrix is initially transformed using the transform checkup (DCT2 ); if the rate-distortion cost value of the transform checkup (DCT 2) is greater than the rate-distortion cost value of the transform checkup (DST 7), the residual coefficient matrix is initially transformed using the transform checkup (DST7 ).
And 433, if the current block supports the secondary transformation and the current block meets the first preset condition, determining that the secondary transformation is not performed on the current block. The first preset condition may include, but is not limited to: the current block initially transforms the residual coefficient matrix using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and a first mode number interval of the intra prediction includes a mode number of the intra prediction mode of the current block.
Illustratively, the first preset condition, in addition to the step of initially transforming the residual coefficient matrix by the current block using a transform check (DCT 2), the prediction mode of the current block being an intra prediction mode, and the first mode number interval of intra prediction including the mode number of the intra prediction mode of the current block, may further include: the current block is a luminance block.
For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65.
Illustratively, if the current block is initially transformed on the residual coefficient matrix using a transform check (DST 7), it is determined that the current block is not secondarily transformed.
In summary, if the current block does not support the quadratic transform, the transform technique in the embodiment of the present application is not adopted, and the implementation manner of this process is not limited. If the current block supports quadratic transformation, the following steps may be performed: it is determined whether the current block initially transforms the residual coefficient matrix using a transform check (DCT 2) or a transform check (DST7 ). If the current block is initially transformed by the residual coefficient matrix using a transformation check (DST 7), it is determined that the current block is not secondarily transformed. If the current block uses a transform check (DCT 2) to perform initial transform on the residual coefficient matrix, the transform technique of the embodiment of the present application may not be used when the prediction mode of the current block is not the intra prediction mode and/or the current block is not the luminance block, and the implementation manner in this case is not limited.
If the prediction mode of the current block is the intra prediction mode and the current block is the luminance block, determining whether the mode number of the intra prediction mode of the current block is located in the first mode number interval. If yes, determining not to carry out secondary transformation on the current block; if not, it is determined that the current block is allowed to be secondarily transformed. For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65. For example, if the mode number of the intra prediction mode of the current block is the mode number 39, it indicates that the mode number of the intra prediction mode of the current block is located in the first mode number section, and thus, the current block may not be secondarily transformed. If the mode number of the intra prediction mode of the current block is the mode number 7, it indicates that the mode number of the intra prediction mode of the current block is not located in the first mode number interval, and secondary transformation is allowed to be performed on the current block, but whether secondary transformation is performed or not may be determined in other manners, which is not limited in this embodiment.
In step 434, if the current block is not transformed secondarily, the initial transform coefficient matrix is determined as the target transform coefficient matrix of the current block. And if the current block is subjected to secondary transformation, performing secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix of the current block. Up to this point, the target transform coefficient matrix of the current block may be obtained.
For example, in the secondary transformation process, if the value of the width or height of the initial transformation coefficient matrix is greater than 4, the coefficient matrix at the top left corner 4 × 4 is subjected to secondary transformation. And if the width and height values of the initial transformation coefficient matrix are both 4, performing secondary transformation on the initial transformation coefficient matrix. The specific quadratic transformation manner can be shown in formula (3), and the matrix a and the matrix B are preconfigured quadratic transformation matrices, which is not limited.
Of course, the above is only an example of performing quadratic transformation on the initial transformation coefficient matrix, and the method is not limited thereto.
Step 435, encoding according to the target transform coefficient matrix to obtain the encoded bit stream of the current block.
In summary, if the current block is initially transformed using the (DCT 2) transform kernel, after the initial transformation, it may be determined whether to perform a secondary transformation on the current block according to the intra prediction mode of the current block, and if so, a coefficient matrix at the top left corner 4 × 4 of the initial transformation coefficient matrix is secondarily transformed. If the current block is initially transformed using the (DST 7) transform kernel, it is determined that the current block is not secondarily transformed after the initial transformation. Through the above processing, a transformed target transform coefficient matrix can be obtained, and the target transform coefficient matrix is changed into a coded bit stream through an entropy coding process and is transmitted to a decoding end.
In one possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel. Or, in another possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x or sr _ y is greater than or equal to 16, or the number of all non-zero transform coefficients in the transform coefficient matrix is marked as an even number, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel.
Example 4: based on the same application concept as that of the foregoing embodiment 2, referring to fig. 4D, a schematic flow chart of another decoding method proposed in the embodiment of the present application is shown, where the method may be applied to a decoding end, and the method may include the following steps:
step 441, the encoded bit stream of the current block is obtained, and the target transform coefficient matrix is parsed from the encoded bit stream.
Step 442, if the current block supports the quadratic transform and the current block satisfies a third predetermined condition, it is determined that the inverse quadratic transform is not performed on the current block. Illustratively, the third preset condition may include, but is not limited to: the current block is initially inverse-transformed using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and a first mode number interval of the intra prediction includes a mode number of the intra prediction mode of the current block.
Illustratively, the third preset condition, in addition to including that the current block is initially inverse-transformed using a transform kernel (DCT 2), and the prediction mode of the current block is an intra prediction mode, and the first mode number section of intra prediction includes a mode number of the intra prediction mode of the current block, may further include: the current block is a luminance block.
For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65.
Illustratively, if the current block is initially inverse transformed using a transform check (DST 7), i.e., not using a transform check (DCT 2), it is determined that the current block is not inverse quadratic transformed.
In summary, if the current block does not support the quadratic transform, the transform technique in the embodiment of the present application is not adopted, and the implementation manner of this process is not limited. If the current block supports the quadratic transform, the following steps may be further performed: it is determined whether the current block is initially inverse-transformed using a transform checkup (DCT 2) or initially inverse-transformed using a transform checkup (DST7 ). If the current block is initially inverse transformed using a transform check (DST 7), it may be determined that the current block is not inverse quadratic transformed. If the current block is subjected to the initial inverse transform by using the transform kernel (DCT 2), when the prediction mode of the current block is not the intra prediction mode and/or the current block is not the luminance block, the transform technique of the embodiment of the present application may not be used, and the implementation manner in this case is not limited.
If the prediction mode of the current block is the intra-frame prediction mode and the current block is the brightness block, the decoding end determines whether the mode number of the intra-frame prediction mode of the current block is located in the first mode number interval. If so, the decoding end determines not to perform inverse quadratic transformation on the current block; if not, the decoding end determines to perform inverse quadratic transformation on the current block. For example, the first pattern number interval may include, but is not limited to: mode number 34 to mode number 65. For example, if the mode number of the intra prediction mode of the current block is the mode number 39, it indicates that the mode number of the intra prediction mode of the current block is located in the first mode number interval, and therefore, the decoding end may determine not to perform inverse secondary transform on the current block. If the mode number of the intra prediction mode of the current block is the mode number 7, it indicates that the mode number of the intra prediction mode of the current block is not located in the first mode number interval, and therefore, the decoding end can determine to perform inverse quadratic transform on the current block.
Illustratively, the decoding side determines whether the current block is initially inverse-transformed using a transform check (DCT 2) or initially inverse-transformed using a transform check (DST 7) in the following manner: the decoding end can analyze the sr _ x and sr _ y from the coded bit stream, and when the sr _ x is greater than or equal to 16 or the sr _ y is greater than or equal to 16, the decoding end can directly judge that the current block is subjected to initial inverse transformation by adopting a transformation check (DCT2 ). When sr _ x is smaller than 16 and sr _ y is smaller than 16, the decoding end may further determine the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix. If the parity is odd, it is determined that the current block is initially inverse-transformed using a transform check (DST 7), and if the parity is even, it is determined that the current block is initially inverse-transformed using a transform check (DCT2 ).
Step 443, if the inverse quadratic transform is not performed on the current block, determining the target transform coefficient matrix as the initial transform coefficient matrix. And if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix.
For example, in the inverse quadratic transformation process, if the width or height value of the target transformation coefficient matrix is greater than 4, inverse quadratic transformation is performed on the coefficient matrix at the upper left corner 4 × 4, and if both the width and height values of the target transformation coefficient matrix are 4, inverse quadratic transformation is performed on the target transformation coefficient matrix, which is not limited to this inverse quadratic transformation manner, refer to subsequent embodiment 12, and details are not described here.
Illustratively, inverse quadratic transformation is performed on the target transformation coefficient matrix, which is the inverse process of the quadratic transformation.
And step 444, performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block.
For example, in the initial inverse transformation process, when the residual coefficient matrix is initially transformed by using the transformation checkup (DCT 2) to obtain the initial transformation coefficient matrix, the initial transformation coefficient matrix may be initially inverse transformed by using the transformation checkup (DCT 2) to obtain the residual coefficient matrix corresponding to the current block. When the transformation check (DST 7) is adopted to carry out initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix, the transformation check (DST 7) is adopted to carry out initial inverse transformation on the initial transformation coefficient matrix to obtain the residual coefficient matrix corresponding to the current block.
Illustratively, the initial inverse transform of the initial transform coefficient matrix is an inverse process of the initial transform.
Step 445, determining the reconstructed value of the current block according to the residual coefficient matrix.
For example, a reference block corresponding to the current block may be determined, for each pixel of the current block, a reference point corresponding to the pixel is determined from the reference block, and a residual coefficient value corresponding to the pixel is determined from the residual coefficient matrix. And obtaining a reconstruction value of the pixel point according to the pixel value of the reference point and the residual coefficient value. The reconstructed values corresponding to all the pixel points of the current block can form the reconstructed value of the current block. Of course, the above-described manner is merely an example, and is not limited thereto.
To sum up, the decoding end may obtain the istTuflag according to the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix, and sr _ x and sr _ y. If istTuflag is equal to 0, it means that the current block is initially inverse-transformed using a transform kernel (DCT 2), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using a transform kernel (DST7 ). And when the istTuflag is equal to 0, the prediction mode of the current block is an intra-frame prediction mode, the current block is a brightness block, and the mode number of the intra-frame prediction mode is located in the first mode number interval, determining that the current block is not subjected to inverse quadratic transformation. And when the istTuflag is equal to 0, the prediction mode of the current block is an intra-frame prediction mode, the current block is a brightness block, and the mode number of the intra-frame prediction mode is not located in the first mode number interval, determining to perform inverse quadratic transformation on the current block. If the current block is subjected to inverse quadratic transformation, during inverse transformation, firstly, inverse quadratic transformation is performed on a region 4 x 4 at the upper left corner of the target transformation coefficient matrix, the transformation coefficient at the upper left corner 4 x 4 is updated to obtain an initial transformation coefficient matrix, and then, initial inverse transformation is performed on the initial transformation coefficient matrix. If the current block is not subjected to inverse quadratic transformation, the target transformation coefficient matrix (namely the target transformation coefficient matrix is taken as the initial transformation coefficient matrix) is directly subjected to initial inverse transformation. Then, a residual block is obtained after inverse transformation, and the residual block and the prediction block are added to obtain a reconstructed block.
Example 5: in another possible implementation, referring to fig. 5A, which is a schematic flow chart of an encoding method proposed in this embodiment, the encoding method may be applied to an encoding end, and the encoding method may include the following steps:
step 511, obtaining a residual coefficient matrix corresponding to the current block.
And step 512, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
Step 513, if the current block supports the Secondary Transform, the current block starts an AST (Alternative Secondary Transform) technique, and the current block satisfies a second preset condition, determining whether to perform the Secondary Transform on the current block according to a rate distortion cost value corresponding to the current block.
For example, if the value of the selectable secondary transform enabling flag (e.g., AstEnableFlag) is equal to the preset value (e.g., 1), it indicates that the sequence level or the frame level allows the selectable secondary transform technology to be enabled, i.e., the AST technology is enabled for the current block.
For example, the second preset condition may include, but is not limited to: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
For example, the second preset condition, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include, but is not limited to, a combination of one or more of the following conditions: the current block does not support the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the second mode number interval and the reference samples outside the current block to the left are available. The width size and the height size of the current block meet preset size conditions.
For example, the second preset condition, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include, but is not limited to, a combination of one or more of the following conditions: the current block does not support the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the third mode number interval and the reference samples on the upper outside of the current block are available. The width size and the height size of the current block meet preset size conditions.
For example, the second preset condition, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include, but is not limited to, a combination of one or more of the following conditions: the current block supports the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the second mode number interval, and the reference samples outside the current block to the left are available. The width size and the height size of the current block meet preset size conditions.
For example, the second preset condition, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include, but is not limited to, a combination of one or more of the following conditions: the current block supports the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the third mode number interval, and the reference samples on the upper side outside the current block are available. The width size and the height size of the current block meet preset size conditions.
In the above-described embodiment, the width size of the current block may be equal to or less than n1, and the height size of the current block may be equal to or less than n 2. For example, n1 ═ n2 ═ 32; alternatively, n 1-n 2-64. Of course, the above is merely an example, and no limitation is made thereto.
In the above embodiment, the second pattern number section may include, but is not limited to: mode No. 0 to mode No. 2, mode No. 13 to mode No. 32, and mode No. 44 to mode No. 65. The third pattern number interval may include, but is not limited to: mode number 0 to mode number 23, and mode number 34 to mode number 57. Of course, the above is just an example of the second pattern number section and the third pattern number section.
In a possible embodiment, determining whether to perform secondary transform on the current block according to the rate distortion cost value corresponding to the current block may include, but is not limited to, the following: determining a first rate-distortion cost value when only the initial transformation is carried out on the current block; determining a second rate distortion cost value when the current block is subjected to initial transformation and then secondary transformation; if the second rate distortion cost value is smaller than the first rate distortion cost value, the encoding end can determine to carry out secondary transformation on the current block; if the second rate distortion cost value is greater than the first rate distortion cost value, the encoding end may determine not to perform secondary transformation on the current block.
Exemplarily, after determining whether to perform secondary transformation on the current block, if so, performing secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix; if not, the initial transform coefficient matrix may be determined to be the target transform coefficient matrix. And then, coding is carried out according to the target transformation coefficient matrix to obtain the coded bit stream of the current block.
In a possible embodiment, the encoding according to the target transform coefficient matrix to obtain the encoded bit stream of the current block may include, but is not limited to: if the current block is determined to be secondarily transformed, first indication information may be added to the coded bit stream; for example, the first indication information may be used to indicate that the current block is secondarily transformed. Or, if it is determined that the current block is not secondarily transformed, second indication information may be added to the coded bitstream; for example, the second indication information may indicate that the current block is not secondarily transformed.
In another possible implementation, the encoding according to the target transform coefficient matrix to obtain the encoded bitstream of the current block may include, but is not limited to: determining target characteristics of a target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining whether to adjust a target transformation coefficient matrix according to the target characteristics and the target value of the preset zone bit of the current block; and when the target value of the preset flag bit is a second value, the second value is used for indicating that the second transformation is not carried out on the current block. If the target transformation coefficient matrix is not adjusted, encoding the target transformation coefficient matrix to obtain the encoded bit stream of the current block; and if the target transformation coefficient matrix is adjusted, adjusting the transformation coefficient in the target transformation coefficient matrix so as to enable the target characteristic of the adjusted target transformation coefficient matrix to be matched with the target value of the preset zone bit, and encoding the adjusted target transformation coefficient matrix to obtain the encoded bit stream of the current block.
Illustratively, the target feature includes a target parity, and the determining whether to adjust the target transform coefficient matrix according to the target feature and a target value of a preset flag of the current block may include, but is not limited to: if the target parity is an odd number and the target value of the preset zone bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; or if the target parity is an odd number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transformation coefficient matrix; or if the target parity is an even number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transformation coefficient matrix; or, if the target parity is an even number and the target value of the preset flag bit of the current block is the second value, determining that the target transform coefficient matrix is not adjusted. When the target parity is odd, the target parity is used for indicating the secondary transformation of the current block; and when the target parity is even, indicating that the current block is not secondarily transformed.
Illustratively, the target feature includes a target parity, and the determining whether to adjust the target transform coefficient matrix according to the target feature and a target value of a preset flag of the current block may include, but is not limited to: if the target parity is an even number and the target value of the preset zone bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; or if the target parity is an even number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transformation coefficient matrix; or if the target parity is an odd number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transformation coefficient matrix; or, if the target parity is an odd number and the target value of the preset flag bit of the current block is the second value, determining that the target transform coefficient matrix is not adjusted. When the target parity is even, the target parity is used for indicating the secondary transformation of the current block; and when the target parity is odd, indicating that the current block is not secondarily transformed.
In the above embodiments, the target parity may include, but is not limited to: parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, parity of the number of all even transform coefficients in the target transform coefficient matrix; or, the parity of the sum of the absolute values of all transform coefficients in the target transform coefficient matrix.
For example, the second preset condition, in addition to that the current block is a luma block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include: the current block is initially transformed using a transform kernel (DCT2 ).
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Example 6: referring to fig. 5B, a schematic flowchart of a decoding method provided in an embodiment of the present application is shown, where the decoding method corresponds to the encoding method of embodiment 5, and the decoding method may be applied to a decoding end, and the method may include:
in step 521, the coded bitstream of the current block is obtained.
In step 522, if the current block supports the quadratic transformation, the AST technique is enabled for the current block, and the current block meets a fourth preset condition, the indication information is parsed from the encoded bitstream, and it is determined whether to perform inverse quadratic transformation on the current block according to the indication information.
Exemplary, the fourth preset condition may include, but is not limited to: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
For example, the fourth preset condition may include, but is not limited to, a combination of one or more of the following conditions, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients: the current block does not support the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the second mode number interval and the reference samples outside the current block to the left are available. The width size and the height size of the current block meet preset size conditions.
Alternatively, the current block does not support the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the third mode number interval and the reference samples on the upper outside of the current block are available. The width size and the height size of the current block meet preset size conditions.
Alternatively, the current block supports the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the second mode number interval, and the reference samples outside the current block to the left are available. The width size and the height size of the current block meet preset size conditions.
Alternatively, the current block supports the DT division mode. The mode number of the intra prediction mode adopted by the current block is located in the third mode number interval, and the reference samples on the upper side outside the current block are available. The width size and the height size of the current block meet preset size conditions.
For example, the fourth preset condition, in addition to that the current block is a luma block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include: the current block is initially inverse transformed using a transform kernel (DCT2 ).
Exemplarily, if the indication information is the first indication information, determining to perform inverse quadratic transformation on the current block; the first indication information indicates that the current block is secondarily transformed. Or if the indication information is second indication information, determining that the current block is not subjected to inverse quadratic transformation; the second indication information indicates that the current block is not secondarily transformed.
Illustratively, after determining whether to perform inverse quadratic transformation on the current block according to the indication information, the target transformation coefficient matrix can be analyzed from the coded bit stream; if the current block is subjected to inverse quadratic transformation, the target transformation coefficient matrix can be subjected to inverse quadratic transformation to obtain an initial transformation coefficient matrix; if the current block is not inverse-quadratic transformed, the target transform coefficient matrix may be determined as the initial transform coefficient matrix. And then, carrying out initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block. Then, a reconstructed value of the current block is determined according to the residual coefficient matrix.
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Example 7: referring to fig. 5C, a schematic flowchart of a decoding method provided in an embodiment of the present application is shown, where the decoding method corresponds to the encoding method of embodiment 5, and the decoding method may be applied to a decoding end, and the method may include:
step 531, obtaining the encoded bit stream of the current block, and parsing the target transform coefficient matrix from the encoded bit stream.
Step 532, if the current block supports the secondary transformation, the AST technique is enabled for the current block, and the current block meets a fourth preset condition, determining a target feature of the target transformation coefficient matrix according to the transformation coefficient in the target transformation coefficient matrix.
For an exemplary fourth preset condition, refer to the above embodiment 6, and details are not repeated herein.
Step 533, determining a target value of a preset flag bit of the current block according to the target feature; illustratively, when the target value of the preset flag is the first value, the target value is used to indicate that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag is the second value, the target value is used to indicate that inverse quadratic transformation is not performed on the current block.
And 534, determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit.
In a possible implementation, the target feature may include a target parity, and the determining the target value of the preset flag of the current block according to the target feature may include, but is not limited to: if the target parity is odd, determining the target value of the preset zone bit as a first value; and if the target parity is an even number, determining the target value of the preset zone bit as a second value.
For example, determining whether to perform inverse quadratic transform on the current block according to the target value of the preset flag bit may include, but is not limited to: if the target value of the preset zone bit is the first value, the inverse quadratic transformation of the current block can be determined; if the target value of the preset flag bit is the second value, it may be determined that the inverse quadratic transform is not performed on the current block.
In another possible embodiment, the target characteristic may include a target parity, and the determining the target value of the preset flag of the current block according to the target characteristic may include, but is not limited to: if the target parity is an even number, determining the target value of the preset zone bit as a first value; and if the target parity is an odd number, determining the target value of the preset zone bit as a second value.
For example, determining whether to perform inverse quadratic transform on the current block according to the target value of the preset flag bit may include, but is not limited to: if the target value of the preset zone bit is the first value, the inverse quadratic transformation of the current block can be determined; if the target value of the preset flag bit is the second value, it may be determined that the inverse quadratic transform is not performed on the current block.
In the above embodiments, the target parity may include, but is not limited to: parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, parity of the number of all even transform coefficients in the target transform coefficient matrix; or, the parity of the sum of the absolute values of all transform coefficients in the target transform coefficient matrix.
Exemplarily, after determining whether to perform inverse quadratic transformation on the current block according to a target value of a preset flag bit, if so, performing inverse quadratic transformation on a target transformation coefficient matrix to obtain an initial transformation coefficient matrix; if not, the target transform coefficient matrix may be determined to be the initial transform coefficient matrix. And then, carrying out initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block. Then, a reconstructed value of the current block is determined according to the residual coefficient matrix.
According to the technical scheme, after the current block is subjected to initial transformation to obtain the initial transformation coefficient matrix, whether the current block is subjected to secondary transformation can be determined, if not, the initial transformation coefficient matrix is not subjected to secondary transformation, and if so, the initial transformation coefficient matrix is subjected to secondary transformation. Based on the above processing, the initial transform coefficient matrix may be subjected to secondary transform or not subjected to secondary transform, thereby improving encoding performance.
Example 8: based on the same application concept as that of the foregoing embodiment 5, referring to fig. 5D, a schematic flow chart of another encoding method proposed in the embodiment of the present application is shown, where the method may be applied to an encoding end, and the method may include the following steps:
step 541, obtaining a residual coefficient matrix corresponding to the current block.
And 542, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
For example, steps 541-542 may refer to steps 431-432, which are not described herein again.
And 543, if the current block supports secondary transformation, the AST technology is enabled for the current block, and the current block meets a second preset condition, determining whether to perform secondary transformation on the current block according to a rate distortion cost value corresponding to the current block.
For example, the second preset condition may include, but is not limited to: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients. For example, the fact that the initial transform coefficient matrix of the current block contains non-zero transform coefficients means that: after the initial transform is performed on the residual coefficient matrix to obtain an initial transform coefficient matrix, if all transform coefficients in the initial transform coefficient matrix are zero, it indicates that the initial transform coefficient matrix does not contain non-zero transform coefficients, in this case, the cbf flag of the current block may be a first value (e.g., a value 0), and the transform coefficient of the current block does not need to be encoded. If all the transform coefficients in the initial transform coefficient matrix are not zero (i.e. any one or more transform coefficients are not zero), it indicates that the initial transform coefficient matrix contains non-zero transform coefficients, in this case, the cbf flag of the current block may be set to a second value (e.g. value 1), and the transform coefficient of the current block needs to be encoded.
For example, the second preset condition, in addition to that the current block is a luma block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, may further include: the current block is initially transformed using a transform kernel (DCT2 ). For example, if the current block initially transforms the residual coefficient matrix by using the transform check (DCT 2), it indicates that the transform check (DCT 2) satisfies the second predetermined condition; if the current block adopts the transformation check (DST 7) to carry out initial transformation on the residual coefficient matrix, the transformation check (DST 7) does not satisfy the second preset condition.
Illustratively, the second preset condition may include one or any combination of the following conditions, in addition to that the current block is a luminance block, the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, and the current block is initially transformed by using a transform kernel (DCT2 ): condition 1, the current block does not support the DT partition mode; alternatively, the current block supports the DT division mode. Condition 2, the mode number of the intra prediction mode adopted by the current block is located in the second mode number interval (e.g., mode number 0-mode number 2, mode number 13-mode number 32, mode number 44-mode number 65), and the reference sample outside the current block on the left is available; alternatively, the mode number of the intra prediction mode adopted by the current block is located in the third mode number interval (e.g., mode number 0 to mode number 23, and mode number 34 to mode number 57), and the reference samples on the top outside of the current block are available, i.e., two conditions in condition 2 are satisfied. The condition 3, the width size and the height size of the current block satisfy the preset size conditions, for example, the width size may be equal to or less than n1, and the height size may be equal to or less than n 2. For example, n1 ═ n2 ═ 32; alternatively, n 1-n 2-64. For convenience of description, the second preset condition includes the above 3 conditions as an example, and of course, the implementation manner is similar for other condition combination cases.
In summary, if the current block does not support the secondary transform and/or the current block does not enable the AST technology, the transform technology in the embodiment of the present application is not adopted, and the implementation manner of this process is not limited. If the current block supports the quadratic transform and the current block enables the AST technique, the following steps may be performed: it is determined whether the current block initially transforms the residual coefficient matrix using a transform check (DCT 2) or a transform check (DST7 ).
If the current block is initially transformed using a transform check (DST 7) on the residual coefficient matrix, it may be determined that the current block is not secondarily transformed. If the current block initially transforms the residual coefficient matrix by using a transform check (DCT 2), and the current block satisfies all the conditions of the remaining second preset conditions (for example, the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, the initial transform coefficient matrix of the current block contains a non-zero transform coefficient, the above conditions 1, 2, and 3, and the like), it may also be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block performs initial transformation on the residual coefficient matrix by adopting transformation checking (DCT 2) and does not satisfy any one of the remaining second preset conditions, the current block may be subjected to secondary transformation or not subjected to secondary transformation without adopting the transformation technology of the embodiment of the present application, and the implementation manner of the process is not limited.
In summary, if the current block supports secondary transform and the current block enables AST techniques, and the current block initially transforms the residual coefficient matrix using a transform check (DCT 2), and the current block is a luma block and the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients, and the current block does not support the DT division mode (or the current block supports the DT division mode), and the mode number of the intra prediction mode adopted by the current block is located in the second mode number interval, the reference samples on the left outside the current block are available (or the mode number of the intra prediction mode adopted by the current block is located in the third mode number interval, and the reference samples on the top outside the current block are available), and the width size and the height size of the current block satisfy the preset size condition, whether to perform secondary transformation on the current block can be determined according to the rate distortion cost value corresponding to the current block.
In a possible embodiment, determining whether to perform secondary transform on the current block according to the rate distortion cost value corresponding to the current block may include, but is not limited to, the following: determining a first rate distortion cost value when only the initial transformation is carried out on the current block, wherein the determination mode is not limited, and RDO can be adopted to determine the first rate distortion cost value; for example, after the residual coefficient matrix is subjected to initial transformation to obtain an initial transformation coefficient matrix, a first rate distortion cost value corresponding to the current block is determined based on the initial transformation coefficient matrix. Determining a second rate distortion cost value when the current block is subjected to primary transformation and then secondary transformation, wherein the determination mode is not limited, and the second rate distortion cost value can be determined by adopting RDO (remote data object); for example, the residual coefficient matrix is subjected to initial transformation to obtain an initial transformation coefficient matrix, the initial transformation coefficient matrix is subjected to secondary transformation to obtain a target transformation coefficient matrix, and a second rate distortion cost value corresponding to the current block is determined based on the target transformation coefficient matrix. Then, if the second rate distortion cost value is smaller than the first rate distortion cost value, the encoding end determines to carry out secondary transformation on the current block; and if the second rate distortion cost value is greater than the first rate distortion cost value, the encoding end determines not to carry out secondary transformation on the current block. If the second rate distortion cost value is equal to the first rate distortion cost value, the encoding end determines to carry out secondary transformation on the current block or not to carry out secondary transformation on the current block.
In step 544, if the current block is transformed secondarily, the initial transform coefficient matrix is transformed secondarily to obtain the target transform coefficient matrix of the current block. And if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block. Up to this point, the target transform coefficient matrix of the current block may be obtained.
And step 545, encoding according to the target transform coefficient matrix to obtain an encoded bit stream of the current block.
For example, steps 544 to 545 can be referred to as steps 434 to 435, which are not described herein.
Illustratively, in the process of obtaining the coded bit stream of the current block by coding according to the target transform coefficient matrix, indication information may also be added to the coded bit stream. For example, if the encoding end performs secondary transform on the current block, the encoding end may add first indication information in the encoded bitstream, where the first indication information may be used to indicate that the current block is subjected to secondary transform. Or, if the encoding end does not perform the secondary transform on the current block, the encoding end may add second indication information in the encoded bitstream, where the second indication information may be used to indicate that the current block is not subjected to the secondary transform.
In summary, if the current block is initially transformed using the (DCT 2) transform kernel, after the initial transformation, it can be determined whether to perform the secondary transformation on the current block in the above manner, and if so, the coefficient matrix at the top left corner 4 × 4 of the initial transformation coefficient matrix is secondarily transformed. If the current block is initially transformed using the (DST 7) transform kernel, it is determined that the current block is not secondarily transformed after the initial transformation. Through the above processing, a transformed target transform coefficient matrix can be obtained, and the target transform coefficient matrix is changed into a coded bit stream through an entropy coding process and is transmitted to a decoding end.
In one possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel. Or, in another possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x or sr _ y is greater than or equal to 16, or the number of all non-zero transform coefficients in the transform coefficient matrix is marked as an even number, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel.
Example 9: based on the same application concept as that of the foregoing embodiment 5, referring to fig. 5E, a schematic flow chart of another encoding method proposed in the embodiment of the present application is shown, where the method may be applied to an encoding end, and the method may include the following steps:
and 551, acquiring a residual coefficient matrix corresponding to the current block.
Step 552, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
In step 553, if the current block supports the secondary transform, the AST technique is enabled for the current block, and the current block satisfies a second preset condition, it is determined whether to perform the secondary transform on the current block according to the rate-distortion cost value corresponding to the current block.
In step 554, if the current block is transformed secondarily, the initial transform coefficient matrix is transformed secondarily to obtain the target transform coefficient matrix of the current block. And if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block. Up to this point, the target transform coefficient matrix of the current block may be obtained.
For example, steps 551-554 can refer to steps 541-544, which are not described herein.
And step 555, determining the target characteristics of the target transformation coefficient matrix according to the transformation coefficients in the target transformation coefficient matrix.
Illustratively, the target feature may be a target parity, which may include, but is not limited to: parity of the number of all odd transform coefficients in the target transform coefficient matrix; for example, if there are 30 odd transform coefficients in the target transform coefficient matrix, the parity of all the odd transform coefficients is even, i.e., the target parity is even. Or, parity of the number of all even transform coefficients in the target transform coefficient matrix; for example, if 25 even transform coefficients exist in the target transform coefficient matrix, the parity of the number of all the even transform coefficients is odd, that is, the target parity is odd. Or, parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix; for example, the absolute values of all the transform coefficients in the target transform coefficient matrix are summed, and if the sum result is odd, the target parity is odd, and if the sum result is even, the target parity is even. Of course, the above target parity is only a few examples, and is not limited thereto, for example, the target parity may also be the parity of the number of coefficients with an absolute value of 1, the parity of the last non-zero transform coefficient, and the like.
For example, the target feature may be a target positive negative, which may include, but is not limited to: the positivity and the negativity of the last non-zero transformation coefficient in the target transformation coefficient matrix; or, the positive and negative of the first non-zero transform coefficient in the target transform coefficient matrix; or, the value of the nth non-zero transform coefficient in the target transform coefficient matrix may be arbitrarily configured according to actual needs, which is not limited to this. Of course, the target positive and negative are just a few examples, and the target positive and negative are not limited, for example, the target positive and negative may be the positive and negative of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
Illustratively, target parity and target negativity are examples of target features, and no limitation is made to this target feature. For convenience of description, the target parity is taken as an example for explanation, and the processing manner of other target features is similar.
Step 556, determining whether to adjust the target transform coefficient matrix according to the target feature and the target value of the preset flag bit of the current block. Illustratively, when the target value of the preset flag is the first value, the target value is used to indicate that the current block is to be secondarily transformed, and when the target value of the preset flag is the second value, the target value is used to indicate that the current block is not to be secondarily transformed.
Illustratively, after determining whether to perform a secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block, if it is determined to perform the secondary transformation on the current block, the target value of the preset flag bit is set as a first value to indicate that the secondary transformation is performed on the current block. And if the current block is determined not to be subjected to secondary transformation, setting the target value of the preset zone bit as a second value to indicate that the current block is not subjected to secondary transformation.
For example, the first value may be 1 and the second value may be 0; alternatively, the first value may be 0 and the second value may be 1; of course, the above is only an example, and the first value and the second value are not limited.
In one possible implementation, the encoding side and the decoding side may agree on the relationship between the target parity and the quadratic transformation, for example, when the target parity is odd, it means quadratic transformation is performed on the current block, and when the target parity is even, it means that no quadratic transformation is performed on the current block, i.e. the relationship between "odd" and performing quadratic transformation is agreed on, and "even" and not performing quadratic transformation is agreed on.
In the above case, if the target parity is an odd number and the target value of the preset flag of the current block is the first value, it is determined that the target transform coefficient matrix is not adjusted, and exemplarily, if the target parity is an odd number, it indicates that the current block is transformed secondarily, and the target value of the preset flag is the first value and also indicates that the current block is transformed secondarily, so that the target transform coefficient matrix is not adjusted. Or, if the target parity is an odd number and the target value of the preset flag of the current block is the second value, it is determined to adjust the target transform coefficient matrix, for example, if the target parity is an odd number, it indicates to perform quadratic transform on the current block, and the target value of the preset flag is the second value, it indicates not to perform quadratic transform on the current block, so that the target transform coefficient matrix is adjusted. Or, if the target parity is an even number and the target value of the preset flag of the current block is the first value, it is determined to adjust the target transform coefficient matrix, for example, if the target parity is an even number, it indicates that the current block is not subjected to secondary transform, and the target value of the preset flag is the first value, which indicates that the current block is subjected to secondary transform, so that the target transform coefficient matrix is adjusted. Or, if the target parity is an even number and the target value of the preset flag of the current block is the second value, it is determined that the target transform coefficient matrix is not adjusted, for example, if the target parity is an even number, it indicates that the current block is not subjected to secondary transform, and the target value of the preset flag is the second value, which indicates that the current block is not subjected to secondary transform, so the target transform coefficient matrix is not adjusted.
In another possible embodiment, the encoding side and the decoding side may agree on the relationship between the target parity and the quadratic transformation, for example, when the target parity is even, it means quadratic transformation is performed on the current block, and when the target parity is odd, it means that no quadratic transformation is performed on the current block, i.e. an "even" and quadratic transformation are agreed on, and an "odd" and no quadratic transformation are agreed on.
In the above case, if the target parity is an even number and the target value of the preset flag of the current block is the first value, it is determined that the target transform coefficient matrix is not adjusted, and exemplarily, if the target parity is an even number, it indicates that the current block is transformed secondarily, and the target value of the preset flag is the first value and also indicates that the current block is transformed secondarily, so that the target transform coefficient matrix is not adjusted. Or, if the target parity is an even number and the target value of the preset flag of the current block is the second value, it is determined to adjust the target transform coefficient matrix, for example, if the target parity is an even number, it indicates to perform quadratic transform on the current block, and the target value of the preset flag is the second value, it indicates not to perform quadratic transform on the current block, so the target transform coefficient matrix is adjusted. Or, if the target parity is an odd number and the target value of the preset flag of the current block is the first value, it is determined to adjust the target transform coefficient matrix, for example, if the target parity is an odd number, it indicates that the current block is not subjected to secondary transform, and the target value of the preset flag is the first value, which indicates that the current block is subjected to secondary transform, so that the target transform coefficient matrix is adjusted. Or, if the target parity is an odd number and the target value of the preset flag bit of the current block is the second value, it is determined that the target transform coefficient matrix is not adjusted, for example, if the target parity is an odd number, it indicates that the current block is not subjected to secondary transform, and the target value of the preset flag bit is the second value, which indicates that the current block is not subjected to secondary transform, so the target transform coefficient matrix is not adjusted.
For example, if the target transform coefficient matrix is not adjusted, step 557 is executed.
For example, if the target transform coefficient matrix is adjusted, step 558 is performed.
And 557, encoding the target transformation coefficient matrix to obtain the encoded bit stream of the current block.
In step 558, the transform coefficients in the target transform coefficient matrix are adjusted so that the target characteristics of the adjusted target transform coefficient matrix are matched with the target values of the preset flag bits. And after the transformation coefficient in the target transformation coefficient matrix is adjusted, encoding the adjusted target transformation coefficient matrix to obtain the encoded bit stream of the current block.
For example, if the encoding end and the decoding end agree on "odd" and perform quadratic transformation, "even" and do not perform quadratic transformation, and the target parity is odd, and the target value of the preset flag bit of the current block is the second value, it may adjust some odd transform coefficient in the target transform coefficient matrix, so that the odd transform coefficient is changed to be even, for example, add 1 or subtract 1 to the odd transform coefficient, and the changed transform coefficient is even and is not 0. Alternatively, some even transform coefficient in the target transform coefficient matrix is adjusted so that the even transform coefficient is changed to an odd number, and if the even transform coefficient is subjected to an addition process or a subtraction process, the changed transform coefficient is an odd number and is not 0.
After the above processing, the target parity of the adjusted target transform coefficient matrix is an even number, the "even number" indicates that the current block is not subjected to secondary transform, and the target value of the preset flag bit is the second value, which indicates that the current block is not subjected to secondary transform, i.e. the target parity of the adjusted target transform coefficient matrix matches the target value of the preset flag bit.
For another example, if the target parity is even, and the target value of the preset flag of the current block is the first value, some odd transform coefficient in the target transform coefficient matrix may be adjusted, so that the odd transform coefficient is changed to be even, e.g., the odd transform coefficient is subjected to an addition process or a subtraction process of 1. Alternatively, a certain even transform coefficient in the target transform coefficient matrix is adjusted so that the even transform coefficient is changed to an odd transform coefficient, for example, the even transform coefficient is subjected to an addition 1 process or a subtraction 1 process. After the above processing, the target parity of the adjusted target transform coefficient matrix is an odd number, the odd number indicates that the current block is subjected to secondary transform, the target value of the preset flag bit is the first value, which indicates that the current block is subjected to secondary transform, that is, the target parity of the adjusted target transform coefficient matrix is matched with the target value of the preset flag bit.
For another example, if the encoding side and the decoding side agree on "even" and perform quadratic transformation, and "odd" and do not perform quadratic transformation, the adjustment process is similar to the above adjustment method, and will not be repeated herein.
In summary, if the current block is initially transformed using the (DCT 2) transform kernel, after the initial transformation, it can be determined whether to perform the secondary transformation on the current block in the above manner, and if so, the coefficient matrix at the top left corner 4 × 4 of the initial transformation coefficient matrix is secondarily transformed. If the current block is initially transformed using the (DST 7) transform kernel, it is determined that the current block is not secondarily transformed after the initial transformation. Through the above processing, a transformed target transform coefficient matrix can be obtained, and the target transform coefficient matrix is changed into a coded bit stream through an entropy coding process and is transmitted to a decoding end.
In one possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel. Or, in another possible implementation, the target transform coefficient matrix after transform quantization needs to satisfy: sr _ x or sr _ y is greater than or equal to 16, or the number of all non-zero transform coefficients in the transform coefficient matrix is marked as an even number, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel.
Example 10: based on the same application concept as that of the foregoing embodiment 8, as shown in fig. 5F, a schematic flow chart of another decoding method proposed in the embodiment of the present application is shown, where the method may be applied to a decoding end, and the method may include:
step 561, obtaining the coded bit stream of the current block, and parsing the target transform coefficient matrix from the coded bit stream.
Step 562, if the current block supports the quadratic transformation, the AST technique is enabled for the current block, and the current block meets a fourth preset condition, parsing the indication information from the encoded bitstream, and determining whether to perform inverse quadratic transformation on the current block according to the indication information.
For an example, see embodiment 6 for an example of the fourth preset condition, and details are not repeated here.
For example, if the current block does not support the quadratic transform and/or the current block does not enable the AST technology, the transform technology in the embodiment of the present application is not used, and the implementation manner of this process is not limited. If the current block supports the quadratic transform and the current block enables the AST technique, the following steps may also be performed: it is determined whether the current block is initially inverse-transformed using a transform checkup (DCT 2) or initially inverse-transformed using a transform checkup (DST7 ). If the current block is initially inverse transformed using a transform check (DST 7), it may be determined that the current block is not inverse quadratic transformed. If the current block is subjected to the initial inverse transformation by adopting the transformation check (DCT 2) and the current block meets all the conditions of the remaining fourth preset conditions, whether the current block is subjected to the inverse secondary transformation or not can be determined according to the indication information. If the current block is subjected to the initial inverse transform by using a transform check (DCT 2), and the current block does not satisfy any of the remaining fourth preset conditions, the transform technique of the embodiment of the present application may not be used, and the implementation manner of this case is not limited.
Illustratively, the decoding side determines that the current block is initially inverse-transformed using a transform check (DCT 2) or a transform check (DST 7) in the following manner: parsing sr _ x and sr _ y from the encoded bitstream, and determining that the current block is initially inverse-transformed using a transform kernel (DCT 2) when sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16. When sr _ x is less than 16 and sr _ y is less than 16, the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix is determined. If the parity is odd, determining that the current block is initially inverse-transformed using a transform check (DST 7), and if the parity is even, determining that the current block is initially inverse-transformed using a transform check (DCT2 ).
Illustratively, when the current block supports quadratic transformation, the current block enables AST technology, and the current block meets a fourth preset condition, the indication information is analyzed from the coded bit stream, and if the indication information is the first indication information, the current block is determined to be subjected to inverse quadratic transformation; the first indication information indicates that the current block is secondarily transformed. Or if the indication information is second indication information, determining that the current block is not subjected to inverse quadratic transformation; the second indication information indicates that the current block is not secondarily transformed.
Step 563, if inverse quadratic transform is performed on the current block, inverse quadratic transform is performed on the target transform coefficient matrix to obtain the initial transform coefficient matrix of the current block. And if the current block is not subjected to inverse quadratic transformation, determining the target transformation coefficient matrix as the initial transformation coefficient matrix of the current block. Thus, an initial transform coefficient matrix of the current block is obtained.
And 564, performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block.
In step 565, the reconstructed value of the current block is determined according to the residual coefficient matrix.
For example, steps 563 to 565 may refer to steps 443 to 445, and the detailed description is not repeated here.
Example 11: based on the same application concept as that of the foregoing embodiment 9, referring to fig. 5G, a schematic flowchart of another decoding method proposed in this embodiment is shown, where the method may be applied to a decoding end, and the method may include the following steps:
step 571, obtaining the encoded bit stream of the current block, and parsing the target transform coefficient matrix from the encoded bit stream.
And step 572, if the current block supports the secondary transformation, the AST technology is enabled for the current block, and the current block meets a fourth preset condition, determining a target feature of the target transformation coefficient matrix according to the transformation coefficient in the target transformation coefficient matrix.
For an exemplary fourth preset condition, refer to the above embodiment 6, and details are not repeated herein.
In one possible implementation, a target characteristic of the target transform coefficient matrix may be determined according to the transform coefficients in the target transform coefficient matrix, and the target characteristic may include, but is not limited to, a target parity or a target negativity. Of course, target parity and target negativity are two examples of target features, and no limitation is made to this target feature. Target parity may include, but is not limited to: parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, parity of the number of all even transform coefficients in the target transform coefficient matrix; or, the parity of the sum of the absolute values of all transform coefficients in the target transform coefficient matrix. Of course, the above are only examples, and the target parity is not limited thereto, for example, the target parity may also be the parity of the number of coefficients with an absolute value of 1, the parity of the last non-zero transform coefficient, and the like. Target negativity may include, but is not limited to: the positivity and the negativity of the last non-zero transformation coefficient in the target transformation coefficient matrix; or, the positive and negative of the first non-zero transform coefficient in the target transform coefficient matrix; or the N-th non-zero transformation coefficient in the target transformation coefficient matrix has positive and negative properties, and the value of N is configured arbitrarily. Of course, the target positivity and negativity are just a few examples, and this is not limited, for example, the target positivity and negativity may be the positivity and negativity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
For convenience of description, the target parity is taken as an example for explanation, and the processing manner of other target features is similar.
And 573, determining a target value of the preset flag bit of the current block according to the target characteristic.
For example, when the target value of the preset flag is a first value, the target value is used to indicate that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag is a second value, the target value is used to indicate that inverse quadratic transformation is not performed on the current block.
In one possible embodiment, the decoding side and the encoding side may agree on the relationship between the target parity and the inverse quadratic transformation, for example, when the target parity is odd, it means that the current block is inverse quadratic transformed, and when the target parity is even, it means that the current block is not inverse quadratic transformed, i.e. agree on the relationship between "odd" and inverse quadratic transformation, and "even" and do not perform inverse quadratic transformation. And if the target parity of the target transformation coefficient matrix is an odd number, determining the target value of the preset zone bit of the current block as a first value. Exemplarily, if the target parity is odd, the target parity indicates that inverse quadratic transformation is performed on the current block, and the target value of the preset flag bit is the first value and also indicates that inverse quadratic transformation is performed on the current block, that is, the target parity matches the target value. And if the target parity of the target transformation coefficient matrix is an even number, determining the target value of the preset zone bit of the current block as a second value. Exemplarily, if the target parity is an even number, it indicates that the inverse quadratic transform is not performed on the current block, and the target value of the preset flag is the second value, which also indicates that the inverse quadratic transform is not performed on the current block, i.e. the target parity matches the target value.
In another possible embodiment, the decoding side and the encoding side may agree on the relationship between the target parity and the inverse quadratic transformation, for example, when the target parity is even, it means that the current block is inverse quadratic transformed, and when the target parity is odd, it means that the current block is not inverse quadratic transformed, i.e. agree on the relationship between "even" and inverse quadratic transformation, and "odd" and do not inverse quadratic transformation. And if the target parity of the target transformation coefficient matrix is an even number, determining the target value of the preset zone bit of the current block as a first value. Exemplarily, if the target parity is an even number, the target parity indicates that inverse quadratic transformation is performed on the current block, and the target value of the preset flag bit is the first value and also indicates that inverse quadratic transformation is performed on the current block, that is, the target parity matches the target value. And if the target parity of the target transformation coefficient matrix is an odd number, determining that the target value of the preset zone bit of the current block is a second value. Illustratively, if the target parity is odd, it indicates that the current block is not subjected to inverse quadratic transform, and the target value of the preset flag bit is the second value, and also indicates that the current block is not subjected to inverse quadratic transform, that is, the target parity matches the target value.
Step 574, determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset flag bit.
For example, if the target value of the preset flag bit is the first value, it may be determined that the current block is subjected to inverse quadratic transform; if the target value of the preset flag bit is the second value, it may be determined that the inverse quadratic transform is not performed on the current block.
In step 575, if inverse quadratic transformation is performed on the current block, inverse quadratic transformation is performed on the target transformation coefficient matrix to obtain the initial transformation coefficient matrix of the current block. And if the current block is not subjected to inverse quadratic transformation, determining the target transformation coefficient matrix as the initial transformation coefficient matrix of the current block. Thus, an initial transform coefficient matrix of the current block is obtained.
And 576, performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block.
In step 577, a reconstructed value of the current block is determined according to the residual coefficient matrix.
For example, steps 575 to 577 can refer to steps 443 to 445, and the description is not repeated here.
To sum up, the decoding end may obtain the istTuflag according to the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix, and sr _ x and sr _ y. If istTuflag is equal to 0, it means that the current block is initially inverse-transformed using a transform kernel (DCT 2), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using a transform kernel (DST7 ). And when the istTuflag is equal to 0, the current block supports quadratic transformation, the current block starts AST technology, and the current block meets a fourth preset condition, determining whether to perform inverse quadratic transformation on the current block according to the target parity of the target transformation coefficient matrix.
If inverse quadratic transformation is performed on the current block, during inverse transformation, inverse quadratic transformation may be performed on the region at the upper left corner 4 × 4 of the target transformation coefficient matrix, and the transformation coefficient at the upper left corner 4 × 4 is updated to obtain an initial transformation coefficient matrix, and then, initial inverse transformation may be performed on the initial transformation coefficient matrix. If the inverse quadratic transform is not performed on the current block, the initial inverse transform may be directly performed on the target transform coefficient matrix (i.e., the target transform coefficient matrix is used as the initial transform coefficient matrix).
And when the istTuflag is equal to 1, directly performing initial inverse transformation on the target transformation coefficient matrix.
Then, after inverse transformation, a residual block can be obtained, and the residual block and the prediction block are added to obtain a reconstructed block.
In the above-described embodiments, in embodiments 1 to 4, it is possible for the encoding side to determine whether to secondarily transform the current block based on the intra prediction mode of the current block. For the decoding side, it may be determined whether to inverse-quadratic-transform the current block based on the intra prediction mode of the current block. In embodiment 5, embodiment 6, embodiment 8, and embodiment 10, for an encoding end, whether to perform secondary transform on a current block may be determined by RDO, and indication information (e.g., secTuflag) is explicitly encoded to indicate whether to perform secondary transform on the current block, for example, when a value of secTuflag is a first value, it indicates that the current block is subjected to secondary transform, and when the value of secTuflag is a second value, it indicates that the current block is not subjected to secondary transform. For a decoding end, after an encoded bit stream is obtained, indication information (e.g., secTuflag) of a current block may be analyzed from the encoded bit stream, if a value of the secTuflag is a first value, inverse quadratic transformation is determined to be performed on the current block, and if the value of the secTuflag is a second value, the inverse quadratic transformation is determined not to be performed on the current block. In embodiment 5, embodiment 7, embodiment 9 and embodiment 11, for the encoding side, it may be determined whether to perform secondary transform on the current block through RDO, and whether to perform secondary transform on the current block is implicitly indicated by a target characteristic (such as parity) of a target transform coefficient matrix, rather than explicitly indicated by indication information. For the decoding end, after the coded bit stream is obtained, a target transform coefficient matrix is analyzed from the coded bit stream, and a target value (such as secTuflag) of a preset flag of the current block is determined according to a target feature of the target transform coefficient matrix, that is, the target value of the preset flag of the current block is deduced. And if the target value of the preset zone bit is the first value, determining to perform inverse quadratic transformation on the current block. And if the target value of the preset zone bit is the second value, determining that the current block is not subjected to inverse quadratic transformation.
Example 12: for any of the above embodiments 1-11, the second transformation process may be: different quadratic transformation matrices are used for 4 x 4 blocks and non-4 x 4 blocks. From the encoding end, transform coefficients are obtained after (DCT 2) transform, then 4 x 4 transform coefficients at the upper left corner are multiplied by a quadratic transform matrix to obtain new transform coefficients, and then quantization and entropy coding are carried out. From the decoding end, after inverse quantization is carried out on the transform coefficient obtained by entropy decoding of the code stream, secondary inverse transform is carried out on the 4 x 4 area at the upper left corner to obtain a new transform coefficient, and then inverse transform is carried out on the whole transform block by using (DCT 2) to obtain a residual coefficient. The specific decoding end inverse transformation process of the secondary transformation is as follows:
case one, if the value of the width or height of the current block is greater than 4 and the value of the quadratic transform enable flag is equal to 1 (the value of the quadratic transform enable flag is equal to 1, indicating that quadratic transform is allowed to be enabled at the sequence level or the frame level), then the following is performed on the coefficient matrix: firstly, a coefficient matrix C of the upper left corner 4 × 4 is obtained from the transform coefficient matrix: c. Cij=coeffijI is 0 to 3 and j is 0 to 3, and in the above formula, c isijIs an element of the matrix C, coeffijAre elements of a matrix of transform coefficients.
Illustratively, if the intra prediction mode has a value of 0 ~ 2, or 13 ~ 32, or 44 ~ 65, and the reference sample outside the current block to the left is "available", then: c. Cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pijIs the element of 4 x 4 matrix P, which is calculated as follows: p ═ CxS4,S4Is a 4 x 4 inverse transformation matrix, Clip3(-32768, 32767, (p)ij+26)>>7) Is shown if cijIs between-32768 and 32767, then cijHas a value of (p)ij+26)>>7 if cijA value of less than-32768, then cijHas a value of-32768, if cijIf the value of (3) is greater than 32767, then cijHas a value of 32767.
Illustratively, if the intra prediction mode has a value of 0 ~ 23, or 34 ~ 57, and the reference samples on the outside and above the current block are "available", then: c. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qijIs an element of a 4 x 4 matrix Q, which is calculated as follows: q ═ S4 T×C,S4 TIs S4Transposed matrix of (1), S4Is a 4 x 4 inverse transform matrix.
The values of the elements of the transform coefficient matrix are then modified according to matrix C: coeffij=cij,i=0~3,j=0~3。
Then, the matrix coeff is initially inverse transformed.
Case two, if the values of the width and height of the current block are equal to 4 and the value of the quadratic transform enable flag is equal to 1 (the value of the quadratic transform enable flag is equal to 1, indicating that quadratic transform is allowed to be enabled at the sequence level or the frame level), then the following is performed on the coefficient matrix: firstly, the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k is a radical ofij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows: v ═ D4 T×CoeffMatrix,D4 TIs an inverse transformation matrix D4The transpose matrix of (1), CoeffMatrix being a transform coefficient.
Then, the matrix K is subjected to horizontal inverse transformation as followsAlternatively, a matrix H is obtained: h isij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 22-BitDepth, matrix W: w ═ KXD4,D4Is an inverse transform matrix.
For example, for 4 × 4 blocks, the initial inverse transform is not needed after the inverse transform of the second transform is performed.
Example 13: determining whether to perform a secondary transformation process on the current block based on the intra-frame prediction mode of the current block, wherein the encoding method at the encoding end may be: if the current block is initially transformed using a transform kernel (DCT 2), the transform quantized transform coefficients need to satisfy: sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, or the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix is even, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel. If the current block is initially transformed using a transform kernel (DST 7), the transform-quantized transform coefficients need to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel.
In a possible implementation manner, if the current block is initially transformed by using a transform check (DCT 2), after the initial transformation and before quantization, it may be further determined whether to perform secondary transformation on the current block based on an intra prediction mode of the current block, for a specific process, see embodiments 1 and 3, which is not described herein again. And if the current block is subjected to secondary transformation, performing secondary transformation on the transformation coefficient matrix of the upper left corner 4 x 4 of the initial transformation coefficient matrix (namely the transformation coefficient matrix obtained after the initial transformation) to obtain a target transformation coefficient matrix. And if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix. And then, coding is carried out according to the target transformation coefficient matrix to obtain the coded bit stream of the current block. For example, when determining whether to perform secondary transform on the current block based on the intra prediction mode of the current block, if the current block supports secondary transform and the current block satisfies a first preset condition, it is determined not to perform secondary transform on the current block.
The decoding method of the decoding end can be as follows: and the decoding end obtains the istTuflag according to the parity of the number of all the non-zero transformation coefficients in the target transformation coefficient matrix and the sr _ x and sr _ y. If istTuflag is equal to 0, it means that the current block is initially inverse-transformed using a transform kernel (DCT 2), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using a transform kernel (DST7 ). And when the istTuflag is equal to 1, directly performing initial inverse transformation on the target transformation coefficient matrix.
If the istTuflag is equal to 0, the decoding end may determine whether to perform inverse quadratic transform on the current block based on the intra prediction mode of the current block, which is referred to in embodiment 2 and embodiment 4 for a specific process and is not described herein again. And if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the transformation coefficient matrix of the upper left corner 4 x 4 of the target transformation coefficient matrix to obtain an initial transformation coefficient matrix. And if the current block is not subjected to inverse quadratic transformation, determining the target transformation coefficient matrix as the initial transformation coefficient matrix. Then, a residual block may be obtained from the initial transform coefficient matrix, and the residual block may be added to the prediction block to obtain a reconstructed block. For example, the decoding end determining whether to inverse-quadratic-transform the current block based on the intra prediction mode of the current block may include: and if the current block supports quadratic transformation and meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation.
Example 14: through RDO, whether to perform secondary transform on the current block is determined, and indication information (such as secTuflag) is explicitly encoded to indicate whether to perform secondary transform on the current block, the encoding method at the encoding end may be:
if the current block is initially transformed using a transform kernel (DCT 2), the transform quantized transform coefficients need to satisfy: sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, or the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix is even, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel. Alternatively, if the current block is initially transformed using a transform kernel (DST 7), the transform-quantized transform coefficients need to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel.
In one possible implementation, if the current block is initially transformed using a transform check (DCT 2), after the initial transformation and before the quantization, the following operations may be further performed: and if the current block supports secondary transformation, the AST technology is started for the current block, and the current block meets a second preset condition, determining whether the current block needs to be subjected to secondary transformation according to the rate distortion cost value corresponding to the current block, namely judging whether the current block needs to be subjected to secondary transformation.
Illustratively, if the current block is subjected to quadratic transformation, the transformation coefficient matrix of the upper left corner 4 × 4 of the initial transformation coefficient matrix is subjected to quadratic transformation to obtain the target transformation coefficient matrix. And if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix. Then, encoding can be performed according to the target transformation coefficient matrix, so as to obtain the encoded bit stream of the current block. Indication information (such as secTuflag) may also be carried in the coded bitstream of the current block. If the current block is subjected to secondary transformation, when the value of the secTuflag is a first value, secondary transformation is performed on the current block, and if the current block is not subjected to secondary transformation, when the value of the secTuflag is a second value, secondary transformation is not performed on the current block.
The decoding method of the decoding end can be as follows: and the decoding end obtains the istTuflag according to the parity of the number of all the non-zero transformation coefficients in the target transformation coefficient matrix and the sr _ x and sr _ y. If istTuflag is equal to 0, it means that the current block is initially inverse-transformed using a transform kernel (DCT 2), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using a transform kernel (DST7 ). And when the istTuflag is equal to 1, directly performing initial inverse transformation on the target transformation coefficient matrix.
If the istTuflag is equal to 0, when the current block supports the secondary transform, the AST technology is enabled for the current block, and the current block satisfies a fourth preset condition, the decoding end may determine whether to perform inverse secondary transform on the current block based on indication information (such as secTuflag) in the encoded bitstream, for example, when a value of secTuflag is a first value, determine to perform inverse secondary transform on the current block, and when the value of secTuflag is a second value, determine not to perform inverse secondary transform on the current block.
And if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix. And if the current block is not subjected to inverse quadratic transformation, determining the target transformation coefficient matrix as the initial transformation coefficient matrix. Then, a residual block may be obtained from the initial transform coefficient matrix, and the residual block may be added to the prediction block to obtain a reconstructed block.
Example 15: whether the current block is secondarily transformed is determined through RDO, and whether the current block is secondarily transformed is implicitly represented through target characteristics (such as target parity and the like) of a target transformation coefficient matrix, rather than explicitly representing whether the current block is secondarily transformed through indication information, the encoding method of the encoding end may be:
if the current block is initially transformed using a transform kernel (DCT 2), the transform quantized transform coefficients need to satisfy: sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, or the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix is even, which is used to indicate that the current block is initially transformed using a (DCT 2) transform kernel. Alternatively, if the current block is initially transformed using a transform kernel (DST 7), the transform-quantized transform coefficients need to satisfy: sr _ x and sr _ y are smaller than 16 and the number of all non-zero transform coefficients in the target transform coefficient matrix is odd for indicating that the current block is initially transformed using a (DST 7) transform kernel.
In one possible implementation, if the current block is initially transformed using a transform check (DCT 2), after the initial transformation and before the quantization, the following operations may be further performed: and if the current block supports secondary transformation, the AST technology is started for the current block, and the current block meets a second preset condition, determining whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block. And if the current block is subjected to secondary transformation, performing secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix. And if the current block is not subjected to secondary transformation, determining the initial transformation coefficient matrix as a target transformation coefficient matrix. And then, coding is carried out according to the target transformation coefficient matrix to obtain the coded bit stream of the current block.
And when the coding is carried out according to the target transformation coefficient matrix to obtain the coded bit stream of the current block, determining the target parity of the target transformation coefficient matrix according to the transformation coefficient in the target transformation coefficient matrix. And determining whether to adjust the target transformation coefficient matrix according to the target parity and the target value of the preset zone bit of the current block. If not, the target transformation coefficient matrix is coded to obtain the coded bit stream of the current block. If so, adjusting the transformation coefficient in the target transformation coefficient matrix so as to enable the target parity of the adjusted target transformation coefficient matrix to be matched with the target value of the preset flag bit, and encoding the adjusted target transformation coefficient matrix to obtain the encoded bit stream of the current block.
In this example, the encoding side does not need to encode secTuflag, but implicitly indicates whether to transform the current block twice according to the target parity of the target transform coefficient matrix by adjusting the transform coefficient in the target transform coefficient matrix.
The decoding method of the decoding end can be as follows: and the decoding end obtains the istTuflag according to the parity of the number of all the non-zero transformation coefficients in the target transformation coefficient matrix and the sr _ x and sr _ y. If istTuflag is equal to 0, it means that the current block is initially inverse-transformed using a transform kernel (DCT 2), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using a transform kernel (DST7 ). And when the istTuflag is equal to 1, directly performing initial inverse transformation on the target transformation coefficient matrix.
If the istTuflag is equal to 0, the current block supports quadratic transformation, the AST technology is enabled for the current block, and the current block meets a fourth preset condition, the decoding end may determine whether to perform inverse quadratic transformation on the current block based on the target parity of the target transformation coefficient matrix, for example, determine a target value of a preset flag based on the target parity of the target transformation coefficient matrix, determine to perform inverse quadratic transformation on the current block if the target value of the preset flag (e.g., secTuflag) is a first value, and determine not to perform inverse quadratic transformation on the current block if the target value of the preset flag is a second value.
And if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix. And if the current block is not subjected to inverse quadratic transformation, determining the target transformation coefficient matrix as the initial transformation coefficient matrix. Then, a residual block may be obtained from the initial transform coefficient matrix, and the residual block may be added to the prediction block to obtain a reconstructed block.
In one possible implementation, the target parity may be a parity of the number of all odd transform coefficients (e.g., num _ odd) in the target transform coefficient matrix. And the decoding end derives a target value (secTuflag) of the preset flag bit according to the parity of the number of all odd-numbered transformation coefficients in the target transformation coefficient matrix. For example, when num _ odd is an odd number, secTuflag is 1 (i.e., the second value), and when num _ odd is an even number, secTuflag is 0 (i.e., the first value). secTuflag equal to 0, indicating inverse quadratic transformation of the current block, secTuflag equal to 1, indicating that inverse quadratic transformation is not performed on the current block.
In another possible implementation, the target parity may be a parity of a sum of absolute values of all transform coefficients in the target transform coefficient matrix (e.g., sum _ abs), i.e., whether to inverse-quadratic transform the current block is implicitly expressed based on the parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix. The decoding end derives a target value (secTuflag) of the preset flag bit according to the parity of the sum of the absolute values of all the transform coefficients (such as the sum of the absolute values of all the non-zero transform coefficients) in the target transform coefficient matrix. For example, when sum _ abs is an odd number, secTuflag is 1 (i.e., the second value), and when sum _ abs is an even number, secTuflag is 0 (i.e., the first value). secTuflag equal to 0, indicating inverse quadratic transformation of the current block, secTuflag equal to 1, indicating that inverse quadratic transformation is not performed on the current block.
Of course, the above two ways are only examples, and other types of target parity may also be adopted, without limitation.
Of course, the above embodiments 1 to 15 may be implemented individually or in combination. For example, embodiment 1 and embodiment 2 may be implemented in combination, embodiment 3 and embodiment 4 may be implemented in combination, embodiment 5 and embodiment 6 may be implemented in combination, embodiment 5 and embodiment 7 may be implemented in combination, embodiment 8 and embodiment 10 may be implemented in combination, and embodiment 9 and embodiment 11 may be implemented in combination. Of course, the above are only a few examples, and the combination manner between the embodiments is not limited.
Based on the same application concept as the method, an embodiment of the present application further provides an encoding apparatus applied to an encoding end, as shown in fig. 6A, which is a structural diagram of the apparatus, and the apparatus includes:
an obtaining module 611, configured to obtain a residual coefficient matrix corresponding to the current block;
a processing module 612, configured to perform initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module 613, configured to determine that the current block is not subjected to secondary transform if the current block supports secondary transform and the current block meets a first preset condition, and determine the initial transform coefficient matrix as a target transform coefficient matrix of the current block;
wherein the first preset condition comprises: the current block initially transforms the residual coefficient matrix by adopting a transform check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
Illustratively, the first preset condition further includes: the current block is a luma block.
Illustratively, the first pattern number section includes: mode number 34 to mode number 65.
Illustratively, the determining module 613 is further configured to: determining not to transform the current block secondarily if the current block is initially transformed by a transform check (DST 7) on the residual coefficient matrix.
Based on the same application concept as the method, an embodiment of the present application further provides an encoding apparatus applied to an encoding end, as shown in fig. 6B, which is a structural diagram of the apparatus, and the apparatus includes:
an obtaining module 621, configured to obtain a residual coefficient matrix corresponding to the current block;
a processing module 622, configured to perform initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module 623, configured to determine whether to perform secondary transform on the current block according to a rate distortion cost value corresponding to the current block if the current block supports secondary transform, and the current block enables a selectable secondary transform AST technique, and meets a second preset condition; wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
Illustratively, the second preset condition further includes a combination of one or more of the following conditions:
the current block does not support a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
Illustratively, the second preset condition further includes a combination of one or more of the following conditions:
the current block supports a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
Illustratively, the width size of the current block is equal to or less than n1, and the height size of the current block is equal to or less than n 2.
Illustratively, n1 ═ n2 ═ 32 or n1 ═ n2 ═ 64.
Illustratively, the second pattern number section includes: mode number 0 to mode number 2, mode number 13 to mode number 32, mode number 44 to mode number 65; the third pattern number section includes: mode number 0 to mode number 23, and mode number 34 to mode number 57.
The determining module 623 determines whether to perform secondary transform on the current block according to the rate-distortion cost value corresponding to the current block, specifically: determining a first rate-distortion cost value when only an initial transformation is performed on the current block;
determining a second rate-distortion cost value when the current block is subjected to initial transformation and then secondary transformation;
if the second rate distortion cost value is smaller than the first rate distortion cost value, determining to carry out secondary transformation on the current block;
and if the second rate distortion cost value is larger than the first rate distortion cost value, determining not to carry out secondary transformation on the current block.
The processing module 622 is further configured to: after determining whether to carry out secondary transformation on the current block, if so, carrying out secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix; if not, determining the initial transformation coefficient matrix as a target transformation coefficient matrix; and coding according to the target transformation coefficient matrix to obtain the coded bit stream of the current block.
The processing module 622 performs encoding according to the target transform coefficient matrix, and when obtaining the encoded bit stream of the current block, is specifically configured to: if the current block is determined to be secondarily transformed, adding first indication information in the coded bit stream; wherein the first indication information is used for indicating that the current block is secondarily transformed;
if the current block is determined not to be secondarily transformed, adding second indication information in the coded bit stream; wherein the second indication information indicates that the current block is not secondarily transformed.
The processing module 622 performs encoding according to the target transform coefficient matrix, and when obtaining the encoded bit stream of the current block, is specifically configured to: determining the target characteristics of the target transformation coefficient matrix according to the transformation coefficients in the target transformation coefficient matrix; determining whether to adjust the target transformation coefficient matrix according to the target characteristics and the target value of the preset zone bit of the current block; when the target value of the preset flag bit is a first value, the target value is used for indicating that the current block is subjected to secondary transformation, and when the target value of the preset flag bit is a second value, the target value is used for indicating that the current block is not subjected to secondary transformation; if the target transformation coefficient matrix is not adjusted, encoding the target transformation coefficient matrix to obtain the encoded bit stream of the current block; and if the target transformation coefficient matrix is adjusted, adjusting the transformation coefficient in the target transformation coefficient matrix so as to enable the target characteristic of the adjusted target transformation coefficient matrix to be matched with the target value of the preset zone bit, and encoding the adjusted target transformation coefficient matrix to obtain the encoded bit stream of the current block.
The target feature includes a target parity, and the processing module 622 determines whether to adjust the target transform coefficient matrix according to the target feature and a target value of a preset flag of the current block, where the target feature is specifically configured to: if the target parity is an odd number and the target value of the preset flag bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; or if the target parity is an odd number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transform coefficient matrix; or if the target parity is an even number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transform coefficient matrix; or if the target parity is an even number and the target value of the preset flag bit of the current block is a second value, determining that the target transform coefficient matrix is not adjusted; when the target parity is odd, the target parity is used for indicating the current block to be subjected to secondary transformation; and when the target parity is even, indicating that the current block is not secondarily transformed.
The target feature includes a target parity, and the processing module 622 determines whether to adjust the target transform coefficient matrix according to the target feature and a target value of a preset flag of the current block, where the target feature is specifically configured to: if the target parity is an even number and the target value of the preset flag bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; or if the target parity is an even number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transform coefficient matrix; or if the target parity is an odd number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transform coefficient matrix; or if the target parity is an odd number and the target value of the preset flag bit of the current block is a second value, determining that the target transform coefficient matrix is not adjusted; when the target parity is even, the target parity is used for indicating the secondary transformation of the current block; and when the target parity is odd, indicating that the current block is not subjected to secondary transformation.
The target parity, comprising: parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, parity of the number of all even transform coefficients in the target transform coefficient matrix; or, a parity of a sum of absolute values of all transform coefficients in the target transform coefficient matrix.
The second preset condition further includes: the current block is initially transformed using a transform kernel (DCT2 ).
Based on the same application concept as the method, an embodiment of the present application further provides a decoding apparatus applied to a decoding end, as shown in fig. 6C, which is a structural diagram of the apparatus, and the apparatus includes: an obtaining module 631, configured to obtain an encoded bitstream of a current block, and parse a target transform coefficient matrix from the encoded bitstream; a determining module 632, configured to determine that the current block is not subjected to inverse quadratic transform if the current block supports quadratic transform and the current block meets a third preset condition, and determine the target transform coefficient matrix as an initial transform coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix; a processing module 633, configured to perform initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block; determining a reconstruction value of the current block according to the residual coefficient matrix; wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
Illustratively, the third preset condition further includes: the current block is a luma block.
Illustratively, the first pattern number section includes: mode number 34 to mode number 65.
Illustratively, the determining module 632 is further configured to: if the current block is initially inverse transformed using a transform kernel (discrete sine transform DST7, DST7), it is determined that the current block is not inverse quadratic transformed.
Based on the same application concept as the method, an embodiment of the present application further provides a decoding apparatus applied to a decoding end, as shown in fig. 6D, which is a structural diagram of the apparatus, and the apparatus includes:
an obtaining module 641, configured to obtain an encoded bitstream of the current block;
a determining module 642, configured to, if the current block supports secondary transform, enable a selectable AST technique for secondary transform, and the current block satisfies a fourth preset condition, parse indication information from the encoded bitstream, and determine whether to perform inverse secondary transform on the current block according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The determining module 642 is specifically configured to, when determining whether to perform inverse quadratic transform on the current block according to the indication information: if the indication information is first indication information, determining to perform inverse quadratic transformation on the current block; the first indication information is used for indicating that the current block is subjected to secondary transformation; if the indication information is second indication information, determining that the current block is not subjected to inverse quadratic transformation; the second indication information is used for indicating that the current block is not secondarily transformed.
Exemplarily, the device further comprises (not shown in the figures): a processing module, configured to parse a target transform coefficient matrix from the encoded bitstream after determining whether to inverse-quadratic transform the current block according to the indication information; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix; determining the target transform coefficient matrix as an initial transform coefficient matrix if the inverse quadratic transform is not performed on the current block; performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block; and determining a reconstruction value of the current block according to the residual coefficient matrix.
The fourth preset condition further includes: the current block is initially inverse transformed using a transform kernel (DCT2 ).
Based on the same application concept as the method, an embodiment of the present application further provides a decoding apparatus applied to a decoding end, as shown in fig. 6E, which is a structural diagram of the apparatus, and the apparatus includes: an obtaining module 651, configured to obtain an encoded bitstream of a current block, and parse a target transform coefficient matrix from the encoded bitstream;
a determining module 652, configured to determine, if a current block supports quadratic transform, the current block enables a selectable AST quadratic transform technology, and the current block satisfies a fourth preset condition, a target feature of the target transform coefficient matrix according to a transform coefficient in the target transform coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block; determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
The fourth preset condition further comprises a combination of one or more of the following conditions:
the current block does not support a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
The fourth preset condition further comprises a combination of one or more of the following conditions:
the current block supports a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
Illustratively, the width size of the current block is equal to or less than n1, and the height size of the current block is equal to or less than n 2.
Illustratively, n1 ═ n2 ═ 32 or n1 ═ n2 ═ 64.
Illustratively, the second pattern number section includes: mode number 0 to mode number 2, mode number 13 to mode number 32, mode number 44 to mode number 65; the third pattern number section includes: mode number 0 to mode number 23, and mode number 34 to mode number 57.
The target feature includes a target parity, and the determining module 652 is specifically configured to, when determining the target value of the preset flag of the current block according to the target feature: if the target parity is an odd number, determining that the target value of the preset zone bit is a first value; if the target parity is an even number, determining that the target value of the preset zone bit is a second value;
the determining module 652 is specifically configured to determine whether to perform inverse quadratic transform on the current block according to the target value of the preset flag: if the target value of the preset zone bit is a first value, determining to perform inverse quadratic transformation on the current block; and if the target value of the preset zone bit is a second value, determining that the current block is not subjected to inverse quadratic transformation.
The target feature includes a target parity, and the determining module 652 is specifically configured to, when determining the target value of the preset flag of the current block according to the target feature: if the target parity is an even number, determining that the target value of the preset zone bit is a first value; if the target parity is an odd number, determining that the target value of the preset zone bit is a second value;
the determining module 652 is specifically configured to determine whether to perform inverse quadratic transform on the current block according to the target value of the preset flag: if the target value of the preset zone bit is a first value, determining to perform inverse quadratic transformation on the current block; and if the target value of the preset zone bit is a second value, determining that the current block is not subjected to inverse quadratic transformation.
The target parity, comprising: parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, parity of the number of all even transform coefficients in the target transform coefficient matrix; or, a parity of a sum of absolute values of all transform coefficients in the target transform coefficient matrix.
Exemplarily, the device further comprises (not shown in the figures): the processing module is used for determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset flag bit, and if so, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix; if not, determining the target transformation coefficient matrix as an initial transformation coefficient matrix; performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block; and determining a reconstruction value of the current block according to the residual coefficient matrix.
The fourth preset condition further includes: the current block is initially inverse transformed using a transform kernel (DCT2 ).
For the encoding-side device (for example, the encoding-side device may be a video encoder) provided in the embodiment of the present application, from a hardware level, a schematic diagram of a hardware architecture of the encoding-side device may specifically refer to fig. 7A. The method comprises the following steps: a processor 711 and a machine-readable storage medium 712, the machine-readable storage medium 712 storing machine-executable instructions executable by the processor 711; the processor 711 is configured to execute machine-executable instructions to implement the methods disclosed in the above examples of the present application. For example, a processor is used to execute machine executable instructions to implement the steps of:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block; wherein the first preset condition comprises: the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation, the current block starts a selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block;
wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
For the decoding-side device (for example, the decoding-side device may be a video decoder) provided in the embodiment of the present application, from a hardware level, a schematic diagram of a hardware architecture of the decoding-side device may specifically refer to fig. 7B. The method comprises the following steps: a processor 721 and a machine-readable storage medium 722, the machine-readable storage medium 722 storing machine-executable instructions executable by the processor 721; the processor 721 is configured to execute machine-executable instructions to implement the methods disclosed in the above examples of the present application. For example, a processor is used to execute machine executable instructions to implement the steps of:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation and the current block meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation, and determining the target transformation coefficient matrix as an initial transformation coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block;
if the current block supports secondary transformation, the current block enables selectable secondary transformation AST technology, and the current block meets a fourth preset condition, indication information is analyzed from the coded bit stream, and whether inverse secondary transformation is carried out on the current block is determined according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation, the current block enables selectable AST (auto-switch) technology, and the current block meets a fourth preset condition, determining target characteristics of the target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
Based on the same application concept as the method, the embodiment of the present application further provides a camera device, and the camera device may include the encoding apparatus and/or the decoding apparatus in any of the embodiments.
Based on the same application concept as the method, embodiments of the present application further provide a machine-readable storage medium, where a plurality of computer instructions are stored on the machine-readable storage medium, and when the computer instructions are executed by a processor, the encoding and decoding methods disclosed in the above examples of the present application can be implemented. The machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: a RAM (random Access Memory), a volatile Memory, a non-volatile Memory, a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with certain functionality. A typical implementation is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. The present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (44)

1. An encoding method applied to an encoding end, the method comprising:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block;
wherein the first preset condition comprises: the current block initially transforms the residual coefficient matrix by adopting a transform check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
2. The method of claim 1,
the first preset condition further includes: the current block is a luma block.
3. The method of claim 2,
the first pattern number section includes: mode number 34 to mode number 65.
4. The method according to any one of claims 1-3, further comprising:
and if the current block is subjected to initial transformation on the residual coefficient matrix by adopting a transformation check (discrete sine transformation DST7, DST7), determining that the current block is not subjected to secondary transformation.
5. An encoding method applied to an encoding end, the method comprising:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation, the current block starts a selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block;
wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
6. The method of claim 5, wherein the second preset condition further comprises a combination of one or more of the following conditions:
the current block does not support a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
7. The method of claim 5, wherein the second preset condition further comprises a combination of one or more of the following conditions:
the current block supports a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
8. The method according to claim 6 or 7,
the width size of the current block is equal to or less than n1, and the height size of the current block is equal to or less than n 2.
9. The method of claim 8,
n 1-n 2-32 or n 1-n 2-64.
10. The method according to claim 6 or 7,
the second pattern number section includes: mode number 0 to mode number 2, mode number 13 to mode number 32, mode number 44 to mode number 65; the third pattern number section includes: mode number 0 to mode number 23, and mode number 34 to mode number 57.
11. The method of claim 5,
the determining whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block includes:
determining a first rate-distortion cost value when only an initial transformation is performed on the current block;
determining a second rate-distortion cost value when the current block is subjected to initial transformation and then secondary transformation;
if the second rate distortion cost value is smaller than the first rate distortion cost value, determining to carry out secondary transformation on the current block;
and if the second rate distortion cost value is larger than the first rate distortion cost value, determining not to carry out secondary transformation on the current block.
12. The method of claim 5 or 11, wherein after determining whether to transform the current block twice according to the rate distortion cost value corresponding to the current block, the method further comprises:
if so, carrying out secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix; if not, determining the initial transformation coefficient matrix as a target transformation coefficient matrix;
and coding according to the target transformation coefficient matrix to obtain the coded bit stream of the current block.
13. The method of claim 12,
the encoding according to the target transform coefficient matrix to obtain the encoded bit stream of the current block includes:
if the current block is determined to be secondarily transformed, adding first indication information in the coded bit stream; wherein the first indication information is used for indicating that the current block is secondarily transformed;
if the current block is determined not to be secondarily transformed, adding second indication information in the coded bit stream; wherein the second indication information indicates that the current block is not secondarily transformed.
14. The method of claim 12,
the encoding according to the target transform coefficient matrix to obtain the encoded bit stream of the current block includes:
determining the target characteristics of the target transformation coefficient matrix according to the transformation coefficients in the target transformation coefficient matrix;
determining whether to adjust the target transformation coefficient matrix according to the target characteristics and the target value of the preset zone bit of the current block; when the target value of the preset flag bit is a first value, the target value is used for indicating that the current block is subjected to secondary transformation, and when the target value of the preset flag bit is a second value, the target value is used for indicating that the current block is not subjected to secondary transformation;
if the target transformation coefficient matrix is not adjusted, encoding the target transformation coefficient matrix to obtain the encoded bit stream of the current block;
and if the target transformation coefficient matrix is adjusted, adjusting the transformation coefficient in the target transformation coefficient matrix so as to enable the target characteristic of the adjusted target transformation coefficient matrix to be matched with the target value of the preset zone bit, and encoding the adjusted target transformation coefficient matrix to obtain the encoded bit stream of the current block.
15. The method of claim 14,
the determining whether to adjust the target transform coefficient matrix according to the target characteristic and a target value of a preset flag bit of the current block includes:
if the target parity is an odd number and the target value of the preset flag bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; alternatively, the first and second electrodes may be,
if the target parity is an odd number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transformation coefficient matrix; alternatively, the first and second electrodes may be,
if the target parity is an even number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transformation coefficient matrix; alternatively, the first and second electrodes may be,
if the target parity is an even number and the target value of the preset flag bit of the current block is a second value, determining that the target transformation coefficient matrix is not adjusted;
when the target parity is odd, the target parity is used for indicating the current block to be subjected to secondary transformation; and when the target parity is even, indicating that the current block is not secondarily transformed.
16. The method of claim 14,
the determining whether to adjust the target transform coefficient matrix according to the target characteristic and a target value of a preset flag bit of the current block includes:
if the target parity is an even number and the target value of the preset flag bit of the current block is a first value, determining that the target transformation coefficient matrix is not adjusted; alternatively, the first and second electrodes may be,
if the target parity is an even number and the target value of the preset flag bit of the current block is a second value, determining to adjust the target transformation coefficient matrix; alternatively, the first and second electrodes may be,
if the target parity is an odd number and the target value of the preset flag bit of the current block is a first value, determining to adjust the target transformation coefficient matrix; alternatively, the first and second electrodes may be,
if the target parity is an odd number and the target value of the preset flag bit of the current block is a second value, determining that the target transformation coefficient matrix is not adjusted;
when the target parity is even, the target parity is used for indicating the secondary transformation of the current block; and when the target parity is odd, indicating that the current block is not subjected to secondary transformation.
17. The method of claim 15 or 16, wherein the target parity comprises:
parity of the number of all odd transform coefficients in the target transform coefficient matrix; alternatively, the first and second electrodes may be,
parity of the number of all even transform coefficients in the target transform coefficient matrix; alternatively, the first and second electrodes may be,
parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
18. The method according to any one of claims 5 to 17, wherein the second preset condition further comprises: the current block is initially transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
19. A decoding method applied to a decoding end, the method comprising:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation and the current block meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation, and determining the target transformation coefficient matrix as an initial transformation coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
20. The method of claim 19,
the third preset condition further includes: the current block is a luma block.
21. The method of claim 20,
the first pattern number section includes: mode number 34 to mode number 65.
22. The method according to any one of claims 19-21, further comprising:
if the current block is initially inverse transformed using a transform kernel (discrete sine transform DST7, DST7), it is determined that the current block is not inverse quadratic transformed.
23. A decoding method applied to a decoding end, the method comprising:
acquiring a coded bit stream of a current block;
if the current block supports secondary transformation, the current block enables selectable secondary transformation AST technology, and the current block meets a fourth preset condition, indication information is analyzed from the coded bit stream, and whether inverse secondary transformation is carried out on the current block is determined according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
24. The method of claim 23,
the determining whether to inverse-twice transform the current block according to the indication information includes:
if the indication information is first indication information, determining to perform inverse quadratic transformation on the current block; wherein the first indication information is used for indicating that the current block is secondarily transformed;
if the indication information is second indication information, determining that the current block is not subjected to inverse quadratic transformation; wherein the second indication information indicates that the current block is not secondarily transformed.
25. The method of claim 23 or 24,
after determining whether to inverse-quadratic transform the current block according to the indication information, the method further comprises:
parsing a target transform coefficient matrix from the encoded bitstream;
if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix; determining the target transform coefficient matrix as an initial transform coefficient matrix if the inverse quadratic transform is not performed on the current block;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
and determining a reconstruction value of the current block according to the residual coefficient matrix.
26. The method according to claim 23 or 24, wherein the fourth preset condition further comprises: the current block is initially inverse transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
27. A decoding method applied to a decoding end, the method comprising:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation, the current block enables selectable AST (auto-switch) technology, and the current block meets a fourth preset condition, determining target characteristics of the target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
28. The method of claim 27, wherein the fourth preset condition further comprises a combination of one or more of the following conditions:
the current block does not support a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
29. The method of claim 27, wherein the fourth preset condition further comprises a combination of one or more of the following conditions:
the current block supports a DT partition mode;
the mode number of the intra-frame prediction mode adopted by the current block is positioned in the second mode number interval, and the reference sample on the left outside the current block is available; and the mode number of the intra-frame prediction mode adopted by the current block is positioned in the third mode number interval, and the reference sample at the upper edge outside the current block is available;
the width size and the height size of the current block meet preset size conditions.
30. The method of claim 28 or 29,
the width size of the current block is equal to or less than n1, and the height size of the current block is equal to or less than n 2.
31. The method of claim 30,
n 1-n 2-32 or n 1-n 2-64.
32. The method of claim 28 or 29,
the second pattern number section includes: mode number 0 to mode number 2, mode number 13 to mode number 32, mode number 44 to mode number 65; the third pattern number section includes: mode number 0 to mode number 23, and mode number 34 to mode number 57.
33. The method of claim 27, wherein the target feature comprises a target parity, and wherein determining the target value of the preset flag of the current block according to the target feature comprises:
if the target parity is an odd number, determining that the target value of the preset zone bit is a first value;
if the target parity is an even number, determining that the target value of the preset zone bit is a second value;
the determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset flag bit includes:
if the target value of the preset zone bit is a first value, determining to perform inverse quadratic transformation on the current block;
and if the target value of the preset zone bit is a second value, determining that the current block is not subjected to inverse quadratic transformation.
34. The method of claim 27, wherein the target feature comprises a target parity, and wherein determining the target value of the preset flag of the current block according to the target feature comprises:
if the target parity is an even number, determining that the target value of the preset zone bit is a first value;
if the target parity is an odd number, determining that the target value of the preset zone bit is a second value;
the determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset flag bit includes:
if the target value of the preset zone bit is a first value, determining to perform inverse quadratic transformation on the current block;
and if the target value of the preset zone bit is a second value, determining that the current block is not subjected to inverse quadratic transformation.
35. The method of claim 33 or 34, wherein the target parity comprises:
parity of the number of all odd transform coefficients in the target transform coefficient matrix; alternatively, the first and second electrodes may be,
parity of the number of all even transform coefficients in the target transform coefficient matrix; alternatively, the first and second electrodes may be,
parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
36. The method of any one of claims 27-35, wherein after determining whether to inverse-twice transform the current block according to the target value of the predetermined flag, the method further comprises:
if so, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix; if not, determining the target transformation coefficient matrix as an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
and determining a reconstruction value of the current block according to the residual coefficient matrix.
37. The method according to any one of claims 27-35, wherein the fourth preset condition further comprises: the current block is initially inverse transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
38. An encoding apparatus applied to an encoding side, the apparatus comprising:
the acquisition module is used for acquiring a residual coefficient matrix corresponding to the current block;
the processing module is used for carrying out initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module, configured to determine that no secondary transform is performed on the current block and determine the initial transform coefficient matrix as a target transform coefficient matrix of the current block if the current block supports secondary transform and the current block meets a first preset condition;
wherein the first preset condition comprises: the current block initially transforms the residual coefficient matrix by adopting a transform check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
39. An encoding apparatus applied to an encoding side, the apparatus comprising:
the acquisition module is used for acquiring a residual coefficient matrix corresponding to the current block;
the processing module is used for carrying out initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
a determining module, configured to determine whether to perform secondary transform on the current block according to a rate distortion cost value corresponding to the current block if the current block supports secondary transform, and the current block enables a selectable secondary transform AST technique, and meets a second preset condition; wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
40. A decoding apparatus, applied to a decoding side, the apparatus comprising:
an obtaining module, configured to obtain a coded bit stream of a current block, and parse a target transform coefficient matrix from the coded bit stream;
a determining module, configured to determine that inverse quadratic transform is not performed on the current block and determine the target transform coefficient matrix as an initial transform coefficient matrix of the current block if the current block supports quadratic transform and the current block meets a third preset condition; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
the processing module is used for carrying out initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block; determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transform DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and the first mode number interval of intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
41. A decoding apparatus, applied to a decoding side, the apparatus comprising:
an obtaining module, configured to obtain a coded bit stream of a current block;
a determining module, configured to, if a current block supports secondary transform, enable a selectable AST technique for secondary transform, and the current block satisfies a fourth preset condition, parse indication information from the encoded bitstream, and determine whether to perform inverse secondary transform on the current block according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
42. A decoding apparatus, applied to a decoding side, the apparatus comprising:
an obtaining module, configured to obtain a coded bit stream of a current block, and parse a target transform coefficient matrix from the coded bit stream;
a determining module, configured to determine a target feature of a target transform coefficient matrix according to a transform coefficient in the target transform coefficient matrix if a current block supports quadratic transform, the current block enables a selectable AST technique, and the current block satisfies a fourth preset condition; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block; determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
43. An encoding side device, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine executable instructions to perform the steps of:
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation and the current block meets a first preset condition, determining that the secondary transformation is not carried out on the current block, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block; wherein the first preset condition comprises: the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
obtaining a residual error coefficient matrix corresponding to the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports secondary transformation, the current block starts a selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform secondary transformation on the current block according to the rate distortion cost value corresponding to the current block;
wherein the second preset condition comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
44. A decoding-side apparatus, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine executable instructions to perform the steps of:
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation and the current block meets a third preset condition, determining that the current block is not subjected to inverse quadratic transformation, and determining the target transformation coefficient matrix as an initial transformation coefficient matrix of the current block; if the current block is subjected to inverse quadratic transformation, performing inverse quadratic transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the current block;
determining a reconstruction value of the current block according to the residual coefficient matrix;
wherein the third preset condition comprises: the current block is subjected to initial inverse transformation by adopting a transformation check (discrete cosine transformation DCT2, DCT2), the prediction mode of the current block is an intra-frame prediction mode, and a first mode number interval of the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block;
if the current block supports secondary transformation, the current block enables selectable secondary transformation AST technology, and the current block meets a fourth preset condition, indication information is analyzed from the coded bit stream, and whether inverse secondary transformation is carried out on the current block is determined according to the indication information; wherein the fourth preset condition includes: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient;
alternatively, the first and second electrodes may be,
acquiring a coded bit stream of a current block, and analyzing a target transformation coefficient matrix from the coded bit stream;
if the current block supports quadratic transformation, the current block enables selectable AST (auto-switch) technology, and the current block meets a fourth preset condition, determining target characteristics of the target transformation coefficient matrix according to transformation coefficients in the target transformation coefficient matrix; determining a target value of a preset zone bit of the current block according to the target characteristic; when the target value of the preset flag bit is a first value, the target value is used for indicating that inverse quadratic transformation is performed on the current block, and when the target value of the preset flag bit is a second value, the target value is used for indicating that inverse quadratic transformation is not performed on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset zone bit;
wherein the fourth preset condition includes: the current block is a luminance block, the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
CN201911223606.0A 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment Active CN112911312B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911223606.0A CN112911312B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment
CN202111150952.8A CN114007080B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911223606.0A CN112911312B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202111150952.8A Division CN114007080B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment

Publications (2)

Publication Number Publication Date
CN112911312A true CN112911312A (en) 2021-06-04
CN112911312B CN112911312B (en) 2023-03-28

Family

ID=76104570

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202111150952.8A Active CN114007080B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment
CN201911223606.0A Active CN112911312B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202111150952.8A Active CN114007080B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment

Country Status (1)

Country Link
CN (2) CN114007080B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120082212A1 (en) * 2010-09-30 2012-04-05 Mangesh Sadafale Transform and Quantization Architecture for Video Coding and Decoding
CN105791867A (en) * 2016-03-23 2016-07-20 北京大学 Optimized video data coding method based on boundary adaptive transform
WO2018038554A1 (en) * 2016-08-24 2018-03-01 엘지전자(주) Method and apparatus for encoding/decoding video signal by using secondary transform
CN109076226A (en) * 2016-05-13 2018-12-21 索尼公司 Image processing apparatus and method
CN109983771A (en) * 2016-11-21 2019-07-05 松下电器(美国)知识产权公司 Code device, decoding apparatus, coding method and coding/decoding method
CN110419218A (en) * 2017-03-16 2019-11-05 联发科技股份有限公司 The method and apparatus of enhancing multiple transform and inseparable quadratic transformation for coding and decoding video

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110326294A (en) * 2017-01-03 2019-10-11 Lg电子株式会社 Use the method and apparatus of quadratic transformation encoding/decoding video signal
CN109819250B (en) * 2019-01-15 2020-09-25 北京大学 Method and system for transforming multi-core full combination mode

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120082212A1 (en) * 2010-09-30 2012-04-05 Mangesh Sadafale Transform and Quantization Architecture for Video Coding and Decoding
CN105791867A (en) * 2016-03-23 2016-07-20 北京大学 Optimized video data coding method based on boundary adaptive transform
CN109076226A (en) * 2016-05-13 2018-12-21 索尼公司 Image processing apparatus and method
WO2018038554A1 (en) * 2016-08-24 2018-03-01 엘지전자(주) Method and apparatus for encoding/decoding video signal by using secondary transform
CN109983771A (en) * 2016-11-21 2019-07-05 松下电器(美国)知识产权公司 Code device, decoding apparatus, coding method and coding/decoding method
CN110419218A (en) * 2017-03-16 2019-11-05 联发科技股份有限公司 The method and apparatus of enhancing multiple transform and inseparable quadratic transformation for coding and decoding video

Also Published As

Publication number Publication date
CN112911312B (en) 2023-03-28
CN114007080B (en) 2022-12-23
CN114007080A (en) 2022-02-01

Similar Documents

Publication Publication Date Title
KR101818997B1 (en) Methods of encoding and decoding using multi-level prediction and apparatuses for using the same
RU2577320C1 (en) Video decoding device, video coding device, video decoding method and video coding method
KR101354151B1 (en) Method and apparatus for transforming and inverse-transforming image
US20080199090A1 (en) Coding method conversion apparatus
EP2744210A1 (en) Adaptive transformation of residual blocks depending on the intra prediction mode
US20140140411A1 (en) Video encoding method with bit depth adjustment for fixed-point conversion and apparatus therefor, and video decoding method and apparatus therefor
CN108141612B (en) Apparatus and method for encoding and decoding image
US10085030B2 (en) Method and apparatus for SSIM-based bit allocation
US11582465B2 (en) Video display preference filtering
WO2008004769A1 (en) Image encoding/decoding method and apparatus
KR101621854B1 (en) Tsm rate-distortion optimizing method, encoding method and device using the same, and apparatus for processing picture
JP7283024B2 (en) Image encoding method, decoding method, encoder and decoder
JP5377395B2 (en) Encoding device, decoding device, and program
KR20120117613A (en) Method and apparatus for encoding a moving picture
CN113709480B (en) Encoding and decoding method, device and equipment
CN112911312B (en) Encoding and decoding method, device and equipment
CN113473129B (en) Encoding and decoding method and device
Lee et al. A new intra prediction method using channel correlations for the H. 264/AVC intra coding
US20230199196A1 (en) Methods and Apparatuses of Frequency Domain Mode Decision in Video Encoding Systems
US11856227B2 (en) Transform architecture in video encoding systems
JPWO2021139572A5 (en)
CN114598871A (en) Encoding and decoding method, device and equipment
CN116998151A (en) Encoding method, decoding method, encoder, decoder and storage medium
CN113766225A (en) Encoding method, decoding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant