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

Encoding and decoding method, device and equipment Download PDF

Info

Publication number
CN112911312B
CN112911312B CN201911223606.0A CN201911223606A CN112911312B CN 112911312 B CN112911312 B CN 112911312B CN 201911223606 A CN201911223606 A CN 201911223606A CN 112911312 B CN112911312 B CN 112911312B
Authority
CN
China
Prior art keywords
current block
target
transformation
coefficient matrix
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.)
Active
Application number
CN201911223606.0A
Other languages
Chinese (zh)
Other versions
CN112911312A (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 CN202111150952.8A priority Critical patent/CN114007080B/en
Priority to CN201911223606.0A priority patent/CN112911312B/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

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 meets a first preset condition, determining that the current block is not subjected to secondary transformation, and determining the initial transformation coefficient matrix as a target transformation coefficient matrix of the current block; wherein the first preset condition comprises: and the current block carries out initial transformation on the residual error 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 achieve the purpose of saving space, video images are transmitted after being coded, and the complete video coding method can comprise the processes of prediction, transformation, quantization, entropy coding, filtering and the like. Predictive coding may include intra-coding and inter-coding. Inter-frame coding uses the correlation of video time domain, uses the pixel of adjacent coded image to predict the pixel of current image, and achieves the goal of removing video time domain redundancy. 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: and the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT 2), 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 the secondary transformation, the current block starts the selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform the 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 transformation DCT2, DCT 2), 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 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 quadratic transformation AST 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: and the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT 2), 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 transformation DCT2, DCT 2), 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 decoding device, is applied to the decoding end, the device includes:
an obtaining module, configured to obtain an encoded bitstream 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 flag bit;
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 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, DCT 2), 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;
or,
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, DCT 2), 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;
or,
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;
or,
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 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.
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 use of the word "if" may be interpreted as "at … …," or "at … …," 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 modes include a mode of copying pixels in an angular direction and deriving a predicted value 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·A T Formula (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, as shown in the transformation kernel shown in table 1.
The inverse transform is the inverse process of the forward transform, i.e., the frequency domain signal F can be converted into a time domain residual signal F by the transform matrix a and the transform matrix B. For example, the inverse transformation process may be represented by a matrix form of equation (2).
f=B T F. 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 = a · f T Then F = B · X T For example, by a matrix form of formula (3).
F=B·f·A T =B·(A·f T ) T Formula (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, where 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 Distortion, which is usually measured by using an SSE index, where SSE refers to the sum of the mean square differences between a reconstructed block and a 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, the 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 (DCT 2 ) or (DST 7, DST 7) through RDO, and 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 non-zero transform coefficients of the current block is an even number, and if the actual non-zero transform coefficient is an odd number, the encoding end may set the last non-zero transform coefficient to zero, so that the number of 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 number of multiplications required for hardware implementation of the DST7 transform core is large, and the hardware implementation cost is 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 cores 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 ), and the above process 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 transform 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 I frames or non-I frames, 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: 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.
A video coding framework: referring to fig. 3, the encoding end processing flow of the embodiment of the present application may be implemented by using a video encoding frame, a schematic diagram of a video decoding frame is similar to that of fig. 3, and details are not repeated here, and the decoding end processing flow of the embodiment of the present application may be implemented by using a video decoding frame. 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 performing lossless coding according to the principle of information entropy, in a last processing module of video compression, a series of element symbols used for representing a video sequence are converted into a binary code stream used for transmission or storage, the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, and the like, and output data of an entropy coding module is a final code stream after 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 transform 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 the transform coefficients of 4*4 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 performed on the transform coefficient obtained by entropy decoding of the code stream, secondary inverse transform is performed on the 4*4 region at the upper left corner to obtain a new transform coefficient, and then (DCT 2 ) is used for inverse transform on the whole transform block to obtain a residual coefficient. The specific inverse transform process of the secondary transform at the decoding end 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:
first, the coefficient matrix C of the top left corner 4*4 is obtained from the transform coefficient matrix: c. C ij =coeff ij I =0 to 3, j =0 to 3, and in the above formula, c ij Is an element of the matrix C, coeff ij Are elements of a matrix of transform coefficients.
Illustratively, if the intra prediction mode has a value of 0 to 2, or 13 to 32, or 44 to 65, and the reference sample outside the current block to the left is "available", then: c. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is 4*4, the matrix P is calculated as follows: p = C × S 4 ,S 4 Is 4*4 inverse transformation matrix, clip3 (-32768, 32767, (p) ij +2 6 )>>7) Is shown if c ij Is between-32768 and 32767, then c ij Has a value of (p) ij +2 6 )>>7 if c ij A value of less than-32768, then c ij Has a value of-32768, if c ij If the value of (3) is greater than 32767, then c ij Has a value of 32767.
Illustratively, if the intra prediction mode has a value of 0 to 23, or 34 to 57, and the reference samples outside and above the current block are "available", then: c. C ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3。q ij Is an element of a 4 x 4 matrix Q, which is calculated as follows: q = S 4 T ×C,S 4 T Is S 4 Transposed matrix of (1), S 4 Is 4*4 inverse transform matrix.
The values of the elements of the transform coefficient matrix are then modified according to matrix C: coeff ij =c ij ,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 of formula ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1,v ij Is an element of the matrix V, k ij Are elements of matrix K. The matrix V is calculated as follows: v = D 4 T ×CoeffMatrix,D 4 T Is an inverse transformation matrix D 4 The 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 is ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1,w i,j Is an element of the matrix W, h ij Are elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equals 22-BitDepth, and the matrix W is: w = K × D 4 ,D 4 Is an inverse transform matrix.
For example, for a block of 4*4, the initial inverse transform is not needed after the inverse transform of the secondary 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, an over-fitting phenomenon may occur when the transform coefficient after the initial transform is re-transformed, thereby causing a problem of relatively 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 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 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. Exemplarily, the current block supports a quadratic transform which may represent that: 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 adopts a transformation check (DCT 2 ) to carry out initial transformation on the residual coefficient matrix, 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.
For example, the first preset condition, in addition to that the current block performs an initial transformation on the residual coefficient matrix by using a transformation check (DCT 2 ), the prediction mode of the current block is an intra prediction mode, and the first mode number interval 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.
Exemplarily, if the current block is initially transformed by using the transform checkup (DST 7 ) on the residual coefficient matrix, 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 coded bit stream of the current block is obtained, and the target transform coefficient matrix is parsed from the coded 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 one possible embodiment, the third preset condition may include, but is not limited to: the current block is subjected to initial inverse transformation 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 the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
Illustratively, the third preset condition, in addition to the step of performing an initial inverse transform on the current block by using a transform kernel (DCT 2 ), wherein 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 kernel (DST 7 ), it may be determined that the current block is not inverse-quadratic 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 the secondary transform or not, thereby improving the 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 step 432, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
Illustratively, 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 the transform check (DCT 2 ), the initial transformation process may be as shown in equation (3), where matrix a is DCT2 (as shown in table 1) and matrix B is also DCT2. When the residual coefficient matrix is initially transformed by using the transformation checkups (DST 7 ), the initial transformation process can be shown in formula (3), where a is DST7 (see table 1), and B is also DST7.
As to whether the residual coefficient matrix is initially transformed by the transform kernel (DCT 2 ) or by the 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 adopts a transformation check (DCT 2 ) to carry out initial transformation on the residual coefficient matrix. 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 check (DCT 2 ) is less than the rate-distortion cost value of the transform check (DST 7 ), performing initial transform on the residual coefficient matrix by using the transform check (DCT 2 ); and if the rate distortion cost value of the transformation check (DCT 2 ) is larger than the rate distortion cost value of the transformation check (DST 7 ), performing initial transformation on the residual coefficient matrix by using the transformation check (DST 7 ).
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 adopts a transformation check (DCT 2 ) to carry out initial transformation on the residual coefficient matrix, 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, in addition to that the current block performs initial transformation on the residual coefficient matrix by using a transformation check (DCT 2 ), the prediction mode of the current block is an intra-prediction mode, and the first mode number interval 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.
Exemplarily, if the current block is initially transformed by using the transform checkup (DST 7 ) on the residual coefficient matrix, 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: and judging whether the current block adopts a transformation check (DCT 2 ) to carry out initial transformation on the residual coefficient matrix or adopts a transformation check (DST 7 ) to carry out initial transformation on the residual coefficient matrix. And if the current block adopts a transformation check (DST 7 ) to carry out initial transformation on the residual coefficient matrix, determining not to carry out secondary transformation on the current block. If the current block uses the 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-frame 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 of the upper left corner 4*4 is transformed secondarily. 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 by 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-frame prediction mode of the current block, and if so, the coefficient matrix at the upper left corner 4*4 of the initial transformation coefficient matrix is secondarily transformed. If the current block is subjected to initial transformation by using a (DST 7 ) transformation core, after the initial transformation is carried out, determining that the current block is not subjected to secondary 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, which is used to indicate 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: and sr _ x or sr _ y is more 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, and the result is used for indicating that the current block is subjected to initial transform by 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 coded bit stream of the current block is obtained, and the target transform coefficient matrix is parsed from the coded 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 subjected to initial inverse transformation 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 the intra-frame prediction comprises the mode number of the intra-frame prediction mode of the current block.
Illustratively, the third preset condition, in addition to the step of performing an initial inverse transform on the current block by using a transform kernel (DCT 2 ), wherein 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: and judging whether the current block adopts the transformation check (DCT 2 ) to carry out initial inverse transformation or adopts the transformation check (DST 7 ) to carry out initial inverse transformation. If the current block is initially inverse transformed using a transform kernel (DST 7 ), it may be determined that the current block is not inverse-quadratic transformed. If the current block is subjected to initial inverse transform by using a transform kernel (DCT 2 ), 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-frame 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-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 thus the decoding side can determine not to perform inverse quadratic 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 by using a transform check (DCT 2 ) or initially inverse-transformed by using a transform check (DST 7 ), and the following method can be adopted: the decoding end can analyze the coded bit stream to obtain sr _ x and sr _ y, and when sr _ x is larger than or equal to 16 or sr _ y is larger than or equal to 16, the decoding end can directly judge that the current block carries out initial inverse transformation by adopting transformation check (DCT 2 ). 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, determining that the current block is subjected to initial inverse transformation by using a transformation check (DST 7 ), and if the parity is even, determining that the current block is subjected to initial inverse transformation by using a transformation check (DCT 2 ).
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 process of performing inverse quadratic transformation, if the value of the width or height of the target transformation coefficient matrix is greater than 4, inverse quadratic transformation is performed on the coefficient matrix of the upper left corner 4*4, and if the value of the width and height of the target transformation coefficient matrix are both 4, inverse quadratic transformation is performed on the target transformation coefficient matrix, which is not limited to this inverse quadratic transformation manner, see subsequent embodiment 12, and is not described herein again.
Illustratively, the inverse quadratic transformation on the target transformation coefficient matrix is an inverse process of the above 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 check (DCT 2 ) to obtain the initial transformation coefficient matrix, the initial transformation coefficient matrix may be initially inverse transformed by using the transformation check (DCT 2 ) to obtain the residual coefficient matrix corresponding to the current block. And 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 transform checkup (DCT 2 ), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using transform checkup (DST 7 ). 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 4*4 area at the upper left corner of a target transformation coefficient matrix, the transformation coefficient of the 4*4 at the upper left corner 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 provided 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 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 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 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 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 n2. For example, n1= n2=32; alternatively, n1= n2=64. Of course, the above is merely an example and is not limited 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 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, 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 bitstream 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 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 a non-zero transform coefficient, may further include: the current block is initially transformed using a transform kernel (DCT 2 ).
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 (DCT 2 ).
Exemplarily, if the indication information is the 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. 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 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 odd, determining that the target value of the preset zone bit is 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.
Step 543, if the current block supports the secondary transformation, the AST technology is started on the current block, and the current block meets a second preset condition, determining whether to perform the secondary transformation on the current block according to the 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 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 a non-zero transform coefficient, may further include: the current block is initially transformed using a transform kernel (DCT 2 ). For example, if the current block adopts the transformation check (DCT 2 ) to perform the initial transformation on the residual coefficient matrix, it indicates that the transformation check (DCT 2 ) satisfies the second preset 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 meet the second preset condition.
For example, 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-frame prediction mode, and the initial transform coefficient matrix of the current block contains a non-zero transform coefficient, and the current block is initially transformed by using a transform kernel (DCT 2 ): 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 condition, for example, the width size may be less than or equal to n1, and the height size may be less than or equal to n2. For example, n1= n2=32; alternatively, n1= n2=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: and judging whether the current block adopts a transformation check (DCT 2 ) to carry out initial transformation on the residual coefficient matrix or adopts a transformation check (DST 7 ) to carry out initial transformation on the residual coefficient matrix.
If the current block is initially transformed by 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 adopts the transformation check (DCT 2 ) to carry out the initial transformation on the residual coefficient matrix, and the current block meets all the conditions of the remaining second preset conditions (for example, the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, the initial transformation coefficient matrix of the current block contains non-zero transformation coefficients, the condition 1, the condition 2, the condition 3 and the like), whether the current block is subjected to the secondary transformation can be determined according to the rate distortion cost value corresponding to the current block. If the current block adopts the transformation check (DCT 2 ) to carry out the initial transformation on the residual error coefficient matrix and does not meet any one of the remaining second preset conditions, the transformation technology of the embodiment of the application is not adopted, the current block can be subjected to the secondary transformation, or the current block is not subjected to the secondary transformation, and the implementation mode of the process is not limited.
In summary, if the current block supports the secondary transform, the current block enables the AST technology, the current block performs the initial transform on the residual coefficient matrix by using a transform check (DCT 2 ), the current block is a luminance block, the prediction mode of the current block is the intra-frame prediction mode, the initial transform coefficient matrix of the current block contains a non-zero transform coefficient, the current block does not support the DT partition mode (or the current block supports the DT partition mode), the mode number of the intra-frame prediction mode used by the current block is located in the second mode number interval, the reference sample on the left outside of the current block is available (or the mode number of the intra-frame prediction mode used by the current block is located in the third mode number interval, and the reference sample on the upper outside of the current block is available), and the width size and the height size of the current block satisfy the preset size condition, it may be determined whether to perform the secondary transform on the current block according to the rate distortion cost value corresponding to the current block.
In one possible embodiment, determining whether to perform the secondary transform on the current block according to the corresponding rate-distortion cost value of the current block may include, but is not limited to, the following ways: 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 by using the (DCT 2 ) transform kernel, after the initial transform is performed, whether to perform the secondary transform on the current block may also be determined in the above manner, and if so, the coefficient matrix at the upper left corner 4*4 of the initial transform coefficient matrix is secondarily transformed. If the current block is subjected to initial transformation by using a (DST 7 ) transformation kernel, determining not to perform secondary transformation on the current block after the initial transformation is performed. 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, which is used to indicate 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: and sr _ x or sr _ y is more 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, and the result is used for indicating that the current block is subjected to initial transform by 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 error 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.
And step 554, 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. 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 to 554 can refer to steps 541 to 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 there are 25 even transform coefficients in the target transform coefficient matrix, the parity of the number of all the even transform coefficients is odd, i.e., 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 only 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.
For example, 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 is set as the 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, for example, if the target parity is an odd number, it indicates that the current block is subjected to secondary transform, and the target value of the preset flag is the first value and also indicates that the current block is subjected to secondary transform, 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 the secondary transform, and the target value of the preset flag is the second value, which indicates that the current block is not subjected to the secondary transform, so that 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 by using the (DCT 2 ) transform kernel, after the initial transformation is performed, it may 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 transform coefficient matrix is secondarily transformed. If the current block is subjected to initial transformation by using a (DST 7 ) transformation kernel, determining not to perform secondary transformation on the current block after the initial transformation is performed. 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, which is used to indicate 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: and sr _ x or sr _ y is more 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, and the result is used for indicating that the current block is subjected to initial transform by 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: and judging whether the current block adopts the transformation check (DCT 2 ) to carry out initial inverse transformation or adopts the transformation check (DST 7 ) to carry out initial inverse transformation. If the current block is initially inverse transformed using a transform kernel (DST 7 ), it may be determined that the current block is not inverse-quadratic transformed. If the current block adopts the transformation check (DCT 2 ) to carry out the initial inverse transformation and meets all the conditions of the residual fourth preset conditions, whether the current block is subjected to the inverse secondary transformation can be determined according to the indication information. If the current block is subjected to initial inverse transformation by adopting transformation check (DCT 2 ) and does not meet any one of the remaining fourth preset conditions, the transformation technology of the embodiment of the application may not be adopted, and the implementation manner of the situation is not limited.
Illustratively, the decoding side determines that the current block is initially inverse-transformed by using a transform check (DCT 2 ) or a transform check (DST 7 ), and may adopt the following modes: and parsing sr _ x and sr _ y from the coded bit stream, and when sr _ x is greater than or equal to 16 or sr _ y is greater than or equal to 16, determining that the current block is subjected to initial inverse transformation by using a transformation check (DCT 2 ). When sr _ x is less than 16 and sr _ y is less than 16, 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 (DCT 2 ).
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 error 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.
Step 572, if the current block supports the second transformation, the AST technology is enabled for the current block, and the current block meets a fourth preset condition, determining a target characteristic of the target transformation coefficient matrix according to the transformation coefficient in the target transformation coefficient matrix.
For example, the fourth preset condition may refer to embodiment 6 described above, and details are not repeated here.
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 to 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 positive and negative 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. For example, 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, that is, 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 transform, 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. it agrees on the relationship between "even" and inverse quadratic transform, and "odd" and not inverse quadratic transform. 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 (DST 7 ). 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 the current block is subjected to inverse quadratic transformation, during inverse transformation, inverse quadratic transformation may be performed on the 4*4 region at the upper left corner 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, whether to perform the secondary transform on the current block may be determined by RDO, and whether to perform the 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 a decoding end, after obtaining an encoded bit stream, a target transform coefficient matrix is parsed from the encoded bit stream, and a target value (such as secTuflag) of a preset flag of a 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 derived. 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 transform 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 the transform coefficients of 4*4 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 performed on the transform coefficient obtained by entropy decoding of the code stream, secondary inverse transform is performed on the 4*4 region at the upper left corner to obtain a new transform coefficient, and then (DCT 2 ) is used for inverse transform on the whole transform block to obtain a residual coefficient. The specific inverse transform process of the secondary transform at the decoding end 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: first, the coefficient matrix C of the top left corner 4*4 is obtained from the transform coefficient matrix: c. C ij =coeff ij I =0 to 3, j =0 to 3, and in the above formula, c ij Is an element of the matrix C, coeff ij Are 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. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is 4*4, the matrix P is calculated as follows: p = C × S 4 ,S 4 Is 4*4 inverse transformation matrix, clip3 (-32768, 32767, (p) ij +2 6 )>>7) Is shown if c ij Is between-32768 and 32767, then c ij Has a value of (p) ij +2 6 )>>7 if c ij A value of less than-32768, then c ij Has a value of-32768, if c ij If the value of (3) is greater than 32767, then c ij Has a value of 32767.
Illustratively, if the intra prediction mode has a value of 0 to 23, or 34 to 57, and the reference samples outside and above the current block are "available", then: c. C ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3。q ij Is an element of a 4 x 4 matrix Q, which is calculated as follows: q = S 4 T ×C,S 4 T Is S 4 Transposed matrix of (1), S 4 Is 4*4 inverse transform matrix.
The values of the elements of the transform coefficient matrix are then modified according to matrix C: coeff ij =c ij ,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 of ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1,v ij Is an element of the matrix V, k ij Are elements of matrix K. The matrix V is calculated as follows: v = D 4 T ×CoeffMatrix,D 4 T Is an inverse transform matrix D 4 The 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 is ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1,w i,j Is an element of the matrix W, h ij Are elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equals 22-BitDepth, and the matrix W is: w = K × D 4 ,D 4 Is an inverse transform matrix.
For example, for a block 4*4, 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 coefficients after transform quantization 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 the (DCT 2 ) transform kernel. If the current block is initially transformed using a transform kernel (DST 7 ), the transform coefficients after transform quantization 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, which is used to indicate that the current block is initially transformed using a (DST 7 ) transform kernel.
In a possible implementation manner, if the current block uses the transform kernel (DCT 2 ) to perform the initial transform, after the initial transform is performed and before quantization is performed, it may be further determined whether to perform the secondary transform on the current block based on the intra prediction mode of the current block, which is referred to embodiment 1 and embodiment 3 and is not described herein again. If the current block is subjected to secondary transformation, the transformation coefficient matrix of the upper left corner 4*4 of the initial transformation coefficient matrix (namely the transformation coefficient matrix obtained after the initial transformation) is subjected to secondary 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 (DST 7 ). 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 a transformation coefficient matrix of the 4*4 at the upper left corner 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 an 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 coefficients after transform quantization 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 the (DCT 2 ) transform kernel. Or, if the current block is initially transformed using a transform kernel (DST 7 ), the transform coefficients after transform quantization 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, which is used to indicate that the current block is initially transformed using a (DST 7 ) transform kernel.
In a possible embodiment, if the current block is initially transformed using a transform kernel (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.
Exemplarily, if the current block is subjected to the quadratic transformation, the transformation coefficient matrix of the top left corner 4*4 of the initial transformation coefficient matrix is subjected to the 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 transform checkup (DCT 2 ), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using transform checkup (DST 7 ). 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 coefficients after transform quantization 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 the (DCT 2 ) transform kernel. Or, if the current block is initially transformed using a transform kernel (DST 7 ), the transform coefficients after transform quantization 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, indicating that the current block is initially transformed using a (DST 7 ) transform kernel.
In a possible embodiment, if the current block is initially transformed using a transform kernel (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, carrying out 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 transform checkup (DCT 2 ), and if istTuflag is equal to 1, it means that the current block is initially inverse-transformed using transform checkup (DST 7 ). When istTuflag is equal to 1, the initial inverse transform is directly performed on the target transform 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 =1 (i.e., the second value), and when num _ odd is an even number, secTuflag =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 =1 (i.e., the second value), and when sum _ abs is an even number, secTuflag =0 (i.e., the first value). secTuflag equal to 0, indicating that the current block is inverse quadratic transformed, secTuflag equal to 1, indicating that the current block is not inverse quadratic transformed.
Of course, the above two ways are only examples, and other types of target parity may also be adopted, which is not limited thereto.
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: and the current block carries out initial transformation on the residual coefficient matrix by adopting a transformation check (discrete cosine transformation DCT2, DCT 2), 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: and if the current block adopts a transformation check (DST 7 ) to carry out initial transformation on the residual coefficient matrix, determining that the current block is not subjected to secondary transformation.
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 partitioning 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 less than or equal to n1, and the height size of the current block is less than or equal to n2.
Exemplarily, 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, according to the rate-distortion cost value corresponding to the current block, determines whether to perform secondary transform on 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 is configured to, when obtaining the encoded bit stream of the current block, perform encoding according to the target transform coefficient matrix: 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 is specifically configured to, according to the target feature and a target value of the preset flag of the current block, determine whether to adjust the target transform coefficient matrix: 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 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 an odd number, the target parity is used for 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 (DCT 2 ).
Based on the same application concept as the method, an embodiment of the present application further provides a decoding apparatus, which is applied to a decoding end, as shown in fig. 6C, and is a structural diagram of the apparatus, where 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 transformation DCT2, DCT 2), 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 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: and if the current block adopts a transformation check (discrete sine transformation DST7, DST 7) to carry out initial inverse transformation, determining that the current block is not subjected to inverse quadratic transformation.
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 perform inverse quadratic transform on 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 (DCT 2 ).
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 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 fourth preset condition further comprises a combination of one or more of the following conditions:
the current block does not support a DT partitioning 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 less than or equal to n1, and the height size of the current block is less than or equal to n2.
Illustratively, n1= n2=32 or n1= n2=64.
Illustratively, the second pattern number interval 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 characteristic 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 characteristic: 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 (DCT 2 ).
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, DCT 2), 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;
or,
acquiring a residual error coefficient matrix corresponding to a current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
if the current block supports the secondary transformation, the current block starts the selectable secondary transformation AST technology, meets a second preset condition, and determines whether to perform the 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, DCT 2), 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;
or,
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;
or,
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: RAM (random Access Memory), volatile Memory, non-volatile Memory, 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, respectively. 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 so forth) 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 (32)

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, 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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
2. The method of claim 1, wherein the second preset condition further comprises a combination of one or more of the following conditions:
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 satisfy a preset size condition.
3. The method of claim 2,
the width size of the current block is less than or equal to n1, and the height size of the current block is less than or equal to n2.
4. The method of claim 3,
n1= n2=32 or n1= n2=64.
5. The method of claim 2,
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.
6. The method of claim 1,
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.
7. The method of claim 1 or 6, 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.
8. The method of claim 7,
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.
9. The method of claim 7,
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.
10. The method of claim 9,
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; 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 a second value, determining that the target transformation coefficient matrix is not adjusted;
when the target parity is an odd number, 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.
11. The method of claim 9,
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; 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 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.
12. The method of claim 10 or 11, wherein the target parity comprises:
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,
parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
13. The method according to claim 1, wherein the second preset condition further comprises: the current block is initially transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
14. A decoding method, applied to a decoding side, 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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
15. The method of claim 14,
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.
16. The method according to claim 14 or 15,
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.
17. The method according to claim 14 or 15, wherein the fourth preset condition further comprises: the current block is initially inverse transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
18. A decoding method, applied to a decoding side, 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 brightness block, the prediction mode of the current block is an intra-frame prediction mode, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains non-zero transform coefficients; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
19. The method of claim 18, wherein the fourth preset condition further comprises a combination of one or more of the following conditions:
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.
20. The method of claim 19,
the width size of the current block is less than or equal to n1, and the height size of the current block is less than or equal to n2.
21. The method of claim 20,
n1= n2=32 or n1= n2=64.
22. The method of claim 19,
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.
23. The method of claim 18, 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.
24. The method of claim 18, 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.
25. The method of claim 23 or 24, wherein the target parity comprises:
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,
parity of the sum of absolute values of all transform coefficients in the target transform coefficient matrix.
26. The method of claim 18, wherein after determining whether to inverse 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.
27. The method of claim 18, wherein the fourth preset condition further comprises: the current block is initially inverse transformed using a transform kernel (discrete cosine transform DCT2, DCT 2).
28. 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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
29. A decoding apparatus, applied to a decoding side, the apparatus comprising:
an obtaining module, configured to obtain an encoded bitstream 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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
30. 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 an alternative 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 comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
31. An encoding 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 residual error coefficient matrix corresponding to a 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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
32. 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;
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 comprises: the current block is a brightness block, the prediction mode of the current block is an intra-frame prediction mode, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains a non-zero transform coefficient; the current block enables the selectable quadratic transform AST technology represents that the sequence level allows the selectable quadratic transform technology to be enabled;
or,
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 second value, the target value of the preset flag bit is used for indicating that the inverse quadratic transformation is not carried out on the current block;
determining whether to perform inverse quadratic transformation on the current block according to the target value of the preset flag bit;
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, the current block does not support a DT partition mode, and an initial transform coefficient matrix of the current block contains non-zero transform coefficients; the current block enables the selectable quadratic transform AST technique means that the sequence level allows the selectable quadratic transform technique to be enabled.
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
CN202111150952.8A CN114007080B (en) 2019-12-03 2019-12-03 Encoding and decoding method, device and equipment
CN201911223606.0A CN112911312B (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 CN112911312A (en) 2021-06-04
CN112911312B true CN112911312B (en) 2023-03-28

Family

ID=76104570

Family Applications (2)

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

Family Applications After (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) CN112911312B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9378185B2 (en) * 2010-09-30 2016-06-28 Texas Instruments Incorporated Transform and quantization architecture for video coding and decoding
US20190356915A1 (en) * 2017-01-03 2019-11-21 Lg Electronics Inc. Method and apparatus for encoding/decoding video signal using secondary transform
CN109819250B (en) * 2019-01-15 2020-09-25 北京大学 Method and system for transforming multi-core full combination mode

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN112911312A (en) 2021-06-04
CN114007080B (en) 2022-12-23
CN114007080A (en) 2022-02-01

Similar Documents

Publication Publication Date Title
US9264722B2 (en) Methods and devices for encoding and decoding transform domain filters
KR101818997B1 (en) Methods of encoding and decoding using multi-level prediction and apparatuses for using the same
EP2744210A1 (en) Adaptive transformation of residual blocks depending on the intra prediction mode
US10085030B2 (en) Method and apparatus for SSIM-based bit allocation
KR101621854B1 (en) Tsm rate-distortion optimizing method, encoding method and device using the same, and apparatus for processing picture
KR20080018469A (en) Method and apparatus for transforming and inverse-transforming image
CN112771865A (en) Encoding and decoding quantization matrices using parameterized models
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
JP7467687B2 (en) Encoding/Decoding Method and Apparatus
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
JP6402520B2 (en) Encoding apparatus, method, program, and apparatus
US20230199196A1 (en) Methods and Apparatuses of Frequency Domain Mode Decision 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
CN116847082A (en) Video coding method and device
CN115086654A (en) Video encoding and decoding method and device, computer readable medium and electronic equipment
KR20080068279A (en) Method and apparatus for encoding and decoding based on intra prediction

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