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

Encoding and decoding method, device and equipment Download PDF

Info

Publication number
CN113709481B
CN113709481B CN202111153185.6A CN202111153185A CN113709481B CN 113709481 B CN113709481 B CN 113709481B CN 202111153185 A CN202111153185 A CN 202111153185A CN 113709481 B CN113709481 B CN 113709481B
Authority
CN
China
Prior art keywords
component
transformation
coefficient matrix
chrominance
matrix corresponding
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
CN202111153185.6A
Other languages
Chinese (zh)
Other versions
CN113709481A (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 CN202111153185.6A priority Critical patent/CN113709481B/en
Publication of CN113709481A publication Critical patent/CN113709481A/en
Application granted granted Critical
Publication of CN113709481B publication Critical patent/CN113709481B/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/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/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
    • 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
    • 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/186Methods 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 a colour or a chrominance component

Abstract

The application provides a coding method, a decoding method, a device and equipment thereof, wherein the decoding method comprises the following steps: acquiring a coded bit stream of a current block, and analyzing a transformation coefficient flag bit from the coded bit stream; if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or not carrying out secondary inverse transformation on the chrominance component; if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit. 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 and uses the pixel of adjacent coded image to predict the pixel of current image so as to remove the redundancy of video time domain. In the intra-frame coding, strong spatial correlation between adjacent blocks is considered, pixels which are reconstructed around are used as reference pixels to predict a current uncoded block, and only the subsequent coding processing is needed to be carried out on a residual value instead of the original value, so that the redundancy on a spatial domain is effectively removed, and the compression efficiency is greatly improved.
In video coding, transform refers to converting an image described in the form of pixels in the spatial domain into an image in the transform domain and representing it in the form of transform coefficients. Most images contain more flat areas and slowly-changing areas, so that the image energy can be distributed in a spatial domain in a dispersed manner in a proper conversion process and converted into relatively concentrated distribution in a conversion domain, thereby removing the frequency domain correlation among signals and effectively compressing a code stream in cooperation with a quantization process.
For the transformation process, a quadratic transformation technique is proposed in the related art. The quadratic transformation technique is as follows: firstly, initial transformation is carried out to obtain a transformation coefficient after the initial transformation. And then, carrying out secondary transformation on the transformation coefficient after the initial transformation to obtain a new transformation coefficient. Then, the new transform coefficients are quantized and entropy encoded. However, how to perform the secondary transform on the luminance component and the chrominance component of the current block does not have an effective implementation manner at present, and has the problems of poor coding performance and the like.
Disclosure of Invention
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 transform coefficient flag bit from the coded bit stream, wherein the transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transform coefficient;
if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or the chrominance component is not subjected to secondary inverse transformation; wherein, the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
If the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
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 chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; if the current block meets a second preset condition, determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; quantizing the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encoding a transform coefficient flag bit in the encoded bit stream of the current block, wherein the transform coefficient flag bit is used for indicating whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed; wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
The application provides a decoding device, is applied to the decoding end, the device includes: an obtaining module, configured to obtain a coded bit stream of a current block; a decoding module, configured to parse a transform coefficient flag from the encoded bitstream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to a chroma component of the current block contains a non-zero transform coefficient; if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or not carrying out secondary inverse transformation on the chrominance component; wherein, the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream; the processing module is used for carrying out inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and the determining module is used for determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation flag bit.
The application provides a coding device, is applied to the coding end, the device includes: the acquisition module is used for acquiring a residual coefficient matrix corresponding to the chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; a determining module, configured to determine whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component if the current block satisfies a second preset condition, so as to obtain a target transformation coefficient matrix corresponding to the chroma component; the processing module is used for quantizing the target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component; an encoding module, configured to encode a transform coefficient flag in an encoded bitstream of the current block, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient; coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed; wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation 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 transform coefficient flag bit from the coded bit stream, wherein the transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transform coefficient;
if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or not carrying out secondary inverse transformation on the chrominance component; wherein, the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
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 chrominance component of the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
if the current block meets a second preset condition, determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
quantizing the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encoding a transform coefficient flag bit in the encoded bit stream of the current block, wherein the transform coefficient flag bit is used for indicating whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed;
Wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
According to the technical scheme, after the chroma components of the current block are subjected to initial transformation, whether the chroma components of the current block are subjected to secondary transformation can be determined, if yes, the chroma components of the current block can be subjected to secondary transformation, namely, the secondary transformation technology can also be applied to the chroma components of the current block, and when the chroma components are subjected to initial transformation and the energy is not concentrated enough, the chroma components can also be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
Drawings
FIGS. 1A-1C are schematic diagrams of DT splitting patterns in one embodiment of the present application;
FIG. 1D is a diagram illustrating luma intra prediction modes according to an embodiment of the present application;
FIGS. 1E-1L illustrate an application of intra prediction filtering according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a video coding framework in one embodiment of the present application;
FIGS. 3A and 3B are flow diagrams of a decoding method in one embodiment of the present application;
FIGS. 4A and 4B are flow diagrams of an encoding method in one embodiment of the present application;
FIG. 5A is a flow chart of a decoding method in one embodiment of the present application;
FIG. 5B is a flow chart of an encoding method in one embodiment of the present application;
fig. 6A is a block diagram of a decoding apparatus according to an embodiment of the present application;
fig. 6B is a block diagram of an encoding device according to an embodiment of the present application;
fig. 7A is a hardware structure diagram of a decoding-side device according to an embodiment of the present application;
fig. 7B is a hardware configuration diagram of an encoding end device in 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 herein 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, and depending on the context, the word "if" may be interpreted as "at 8230 \ 8230when, or" when 8230 \8230, when, or "in response to a determination" is used.
In order to make the technical solutions of the present application better understood by those skilled in the art, the following brief description of technical terms is provided.
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 through 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, transformation is an essential stage for realizing data compression, the transformation can make the energy of a signal more concentrated, and a transformation technology based on Discrete Cosine Transform (DCT)/Discrete Sine Transform (DST) has been a mainstream transformation technology 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 BDA0003287836460000041
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)
In formula (1), M represents the width of a residual block (i.e., a block of residual coefficients), N represents the height of the residual block, F represents an original residual signal in dimensions N × M, F represents a frequency domain signal in dimensions N × M (i.e., a frequency domain signal after conversion), a and B represent transformation matrices in dimensions M × M and N × N, and both a and B satisfy orthogonality, such as the transformation kernels shown in table 1.
The inverse transform (also called inverse transform) is an inverse process of the forward transform, i.e., the frequency domain signal F is converted into a time domain residual signal F by an orthogonal transform matrix a and an orthogonal 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, and after the first forward transformation, an M × N signal X is obtained, and the correlation between the horizontal pixels of the two-dimensional residual signal is removed, so that the first forward transformation is called horizontal transformation, and is called a horizontal transformation matrix. After the second forward transformation, a signal F is obtained, and the correlation between the pixels in the vertical direction of the two-dimensional residual signal is removed, so the second forward transformation is called vertical transformation, and is called a vertical transformation matrix B.
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-Distortion 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 value corresponding to the mode: j (mode) = D + λ R. Illustratively, D represents the distorsion, which is usually measured by using an SSE index, wherein SSE is the sum of the mean square of the difference values of the reconstructed block and the source image; λ is the Lagrangian multiplier; r is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residual, etc. When selecting the mode, if the RDO principle is used to make a comparison decision on the coding mode, the best coding performance can be ensured.
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. Referring to fig. 1A, a schematic diagram of QTBT + EQT + DT is shown, which indicates non-dividing when the derivation mode flag is 0, and indicates using the derivation mode when the derivation mode flag is 1, and the derivation modes are specifically divided into horizontal derivation modes (2N × hN, 2N × nU, 2N × nD) and vertical derivation modes (hN × 2N, nL × 2N, nR × 2N). For a CU without DT, its PU mode is 2N × 2N, where 2 '2N's represent widths and heights that are not necessarily equal, the first '2N' represents that the PU is equal to the width of the CU, and the second '2N' represents that the PU is equal to the height of the CU. For 2N × hN, '2N' indicates that the width of the PU is equal to that of the CU, and 'hN' indicates that the height of the PU is 1/4 higher than that of the CU.
The derived patterns may be grown on leaf nodes of a quadtree or a binary tree, and as shown in fig. 1B, the derived patterns may be obtained by continuously merging partition boundaries with a coding unit to obtain different PU partitions (2 nxhn, 2 nxnu, 2 nxnd, hN × 2N, nL × 2N, nR × 2N) of the derived patterns for prediction and transform blocks generated by intra prediction.
The derivation mode can be matched with QTBT and EQT to generate richer block division and obtain more performances.
Referring to fig. 1C, for the Intra mode (i.e., intra prediction mode), the coding unit using the derived mode for prediction can use 4 non-blocks for transform quantization, and does not need to introduce a new transform kernel.
Luma intra prediction mode of AVS 3: AVS2 has 33 luminance intra prediction modes in common, including 30 angular modes and 3 special modes (DC, plane, and Biliner). To support finer angle prediction, AVS3 proposes to extend the angle pattern into 62, plus 3 special patterns, for a total of 65 patterns. Referring to fig. 1D, which is a diagram illustrating the luma intra prediction mode, the mode number of the original angular mode is not changed, and the mode number of the new angular mode is increased from 34 to 65.
Chroma intra prediction mode of AVS 3: in AVS3, there are 18 chrominance Intra prediction modes in total, and the 18 chrominance Intra prediction modes include 5 conventional chrominance Intra prediction modes (DM, DC, HOR, VER, BI), 12 special chrominance Intra prediction modes, and Intra _ Chroma _ PCM mode. Illustratively, the 12 special chroma intra prediction modes include a TSCPM mode (e.g., TSCPM _ L, TSCPM _ T, etc.) and a PMC mode (e.g., PMC _ L, PMC _ T, EPMC _ L, EPMC _ T, EPMC2_ L, EPMC2_ T, etc.), respectively.
It should be noted that the Chroma PCM mode is derived from an Intra Luma mode and an Intra Chroma mode, and if the Luma Intra prediction mode of the current block is a Luma PCM mode (or named Luma IPD _ IPCM or Intra _ Luma _ PCM) and the Chroma prediction mode of the current block is a DM mode, the Chroma prediction mode of the current block is a Chroma PCM mode (or named Chroma IPD _ IPCM or Intra _ Chroma _ PCM).
The TSCPM mode is an inter-component prediction technology, inter-component redundancy is removed by exploring a linear relation between different components, the TSCPM mode can be divided into two steps, firstly, a Co-located luma block is used for generating a temporary prediction block with the same size through a parameter alpha and a parameter beta, and then the temporary prediction block is downsampled to obtain a prediction value of a chroma component.
For example, 4 available pixel point pairs may be obtained by dividing the availability of the pixels of the neighboring block into 3 cases, the parameter α and the parameter β are calculated through the 4 available pixel point pairs, and after the parameter α and the parameter β are obtained, the chroma prediction value is obtained by reconstructing the pixel through the luminance according to the linear relationship between the luminance and the chroma. When selecting 4 pairs of available pixel points, the usability of the upper side pixel and the left side pixel can be considered, and the following 3 conditions are divided: 1. if both the right upper side and the right left side pixels of the current block are "available", 2 pixel point pairs are selected from the upper side and 2 pixel point pairs are selected from the left side. 2. If the current block is only available on the top side, 4 pixel point pairs are all selected from the top side directly, the width of the selected position is: 0/4,1/4,2/4,3/4. 3. If only the left-hand pixel of the current block is available, then 4 pixel point pairs are each selected from the right left, the height of the selected position being: 0/4,1/4,2/4,3/4. For case 1, two enhancement modes are proposed for enhanced TSCPM, TSCPM _ T and TSCPM _ L: i.e. 4 pixel point pairs only from the top right side (TSCPM _ T) and 4 pixel point pairs only from the left side (TSCPM _ L).
In addition to predicting the chroma component by the luma component, AVS3 also supports the prediction of the Cr component by the Y component and the Cb component, i.e., the PMC mode, whose prediction process can be expressed by the following two equations: IPred = a · Rec Y +B,FPred Cr =IPred′-Rec cb X k. In the above formula, recY is a Y component reconstruction value, recCb is a Cb component reconstruction value, IPred is a generated intermediate variable, IPred' is a value obtained by down-sampling IPred, and FPredCr is a Cr component prediction value obtained finally. The parameters A and B in the equation are set to (alpha) 0 ×k+α 1 ,β 0 ×k+β 1 ),(α 0 ,β 0 ) And (alpha) 1 ,β 1 ) K is 0.5, 1, or 2, determined by the image level flag and the CU level flag, for both parameter α (i.e., alpha) and parameter β (i.e., beta) for Cb and Cr in TSCPM. For example, the header can transmit a flag bit, and if the header flag bit is equal to 0, k of the picture is 1 or 2; if the picture header flag is 1, then k for this picture is 1 or 0.5. Each CU using the EPMC mode further transmits a flag bit to determine one of the two k values of the present image.
For an example, the intra mode code stream flag schemes of TSCPM and PMC can be seen from table 2.
TABLE 2
Figure BDA0003287836460000061
Figure BDA0003287836460000071
Intra Prediction Filtering (IPF): in the intra-frame prediction process, the relevance between some reference pixel points and the current prediction unit can be ignored, and the spatial relevance can be effectively enhanced through IPF, so that the intra-frame prediction precision is improved. As shown in fig. 1E, the prediction direction is from top right to bottom left, the generated current intra prediction block mainly uses the reference pixel point MRB, and the left side of the prediction sample block has poor prediction effect because the relevance with the URB is not considered.
To solve this problem, IPF filters intra-predicted blocks using reference pixels in the URB. The filters in IPF include three types, a horizontal 2-tap filter (see formula (4)), a vertical 2-tap filter (see formula (5)), and a 3-tap filter (see formula (6)) that filters in both horizontal and vertical directions.
P' (x, y) = f (x) · P (-1, y) + (1-f (x)) · P (x, y) formula (4)
P' (x, y) = f (y) · P (x, -1) + (1-f (y)) · P (x, y) formula (5)
P' (x, y) = f (x) · P (-1, y) + f (y) · P (x, -1) + (1-f (x) -f (y)) · P (x, y) equation (6)
For the luminance component, a filter is selected from the luminance component according to the intra-prediction mode to filter the current prediction value. The horizontal 2-tap filter is applied in the prediction mode near vertical down, the vertical 2-tap filter is applied in the prediction mode near horizontal left, and the 3-tap filter is applied in the non-angular prediction mode as well as the diagonal down-right mode. For the chroma components, when the chroma intra-frame prediction mode is horizontal or TSCPM _ L, a vertical 2-tap filter is adopted to filter the predicted value; when the chroma intra prediction mode is vertical or TSCPM _ T, a horizontal 2-tap filter is used to filter the prediction value.
If the size of the current intra-frame prediction block is M × N, for a pixel with coordinates (i, i) in the block, the filter coefficients f [ i ] and f [ j ] corresponding to the pixel are obtained by respectively looking up the intra-frame prediction boundary filter coefficient table by M, i, N and j, as shown in table 3.
TABLE 3
Figure BDA0003287836460000072
Improved Intra Prediction (IIP) mode: the IIP improves four aspects of luminance intra prediction compared to the conventional luminance intra prediction mode, and the improvement of the luminance intra prediction process in the IIP mode in the present application is described below.
Among other things, improvements relating to angular modes. To obtain more accurate prediction pixels, the original 4-tap interpolation filter can be replaced by an 8-tap interpolation filter to generate the reference pixels of the sub-pixel points, and to support 8-tap filtering, the left and upper 4 reference pixels are padded as shown in fig. 1F. Illustratively, when MIPF is enabled, a class 3 8-tap filter is used, the index value of the filter being implicitly derived based on the size of the current block and the row-column index number, the index of the filter being derived using the following formula: filter _ idx = mipf _ enable _ flag? (j < 1. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current block, respectively.
Among other things, improvements in DC mode. For the conventional DC mode: for a luma block, the reference samples above the current block are denoted as r [ i ]]The reference sample to the left of the current block is denoted as c [ j ]],r[0]Is equal to c0]If i is greater than 2M, then r [ i]=r[2M]If j is greater than 2N, then cj]=c[2N]. If r [ i ]]、c[j](i =1 to M, j =1 to N) is all "available", then:
Figure BDA0003287836460000081
Figure BDA0003287836460000082
if r [ i ]](i = 1-M) "available", c [ j](j =1 to N) "unavailable",
Figure BDA0003287836460000083
Figure BDA0003287836460000084
otherwise, if cj](j =1 to N) "available", r [ i](i =1 to M) "not available", then
Figure BDA0003287836460000085
Otherwise, predMatrix [ x ]][y]=2BitDepth-1 (x = 0-M-1, y = 0-N-1.
For the improved DC mode: a conventional DC mode, in which all pixels of the current block have the same prediction value, while for the improved DC mode, the pixels inside the current block and the pixels near the boundary have different prediction values, and the conventional DC value is still used for the inside pixels (not the pixels of the first two rows or columns); for pixels near the boundary (pixels of the first two rows or columns), as shown in fig. 1G and 1H, a weighted average of (DC value and reference pixel value) is used as the final prediction value.
For example, as shown in fig. 1G, if the current pixel point is located at the first row a position, the weighted average of the reference pixels A0, A1, A2 and DC may be used as the predicted value of the a position; if the current pixel point is located at the position B of the first column, the weighted average value of the reference pixels B0, B1, B2 and DC can be used as the predicted value of the position B; if the current pixel point is located at the position C at the upper left corner of the current block, the weighted average of the reference pixels C0, C1, C2, C3, C4 and DC can be used as the predicted value of the position C. Referring to fig. 1H, if the current pixel point is located at the second row D position, the weighted average of the reference pixel D and the DC may be used as the predicted value of the D position; if the current pixel point is located at the E position of the second column, the weighted average value of the reference pixel E and the DC can be used as the predicted value of the E position; if the current pixel point is located at the position F at the upper left corner of the current block, the weighted average of the reference pixels F0, F1 and DC can be used as the predicted value of the position F. For example, the weights for the a, b, c, d, e, and f positions may be as shown in table 4, and the last weight may be the weight of the DC value.
TABLE 4
a {18,38,18,182}
b {18,38,18,182}
c {18,38,18,38,18,126}
d {13,243}
e {13,243}
f {13,13,230}
Among them, improvement on the Plane model. For the conventional plane intra prediction process: orgPredmatrix [ x ]][y]=(ia+(x-((M>>1)-1))×ib+(y-((N>>1)-1))×ic+16)>>5(x=0~M-1,y=0~N-1)。predMatrix[x][y]=Clip1(orgPredMatrix[x][y]) (x =0 to M-1, y =0 to N-1). Exemplary, ia = (r [ M)]+c[N])<<4,ib=((ih<<5)×imh+(1<<(ish-1)))>>ish,ic=((iv<<5)×imv+(1<<(isv-1)))>>isv,ibMult[5]={13,17,5,11,23},ibShift[5]={7,10,11,15,19},imh=ibMult[Log(M)-2],ish=ibShift[Log(M)-2],imv=ibMult[Log(N)-2],isv=ibShift[Log(N)-2],
Figure BDA0003287836460000091
Figure BDA0003287836460000092
For the improved plane mode: similar to the improved DC prediction process, the improved plane prediction process also uses the same operation, except that the target to be processed is the reference pixel value and the plane value, and a weighted average method is used to obtain a new prediction value for the first two rows or the first two columns of the current block, the specific weight is shown in table 4, and no repeated description is given here.
Among them, improvement on the Biliner model. The conventional Biliner mode prediction process: referring to fig. 1I, a predicted value of a lower right corner C position (weighted average of the upper right corner reference pixel a and the lower left corner reference pixel B) is generated, a predicted value of a right boundary AC position (weighted average of the predicted values of the upper right corner reference pixel a and the lower right corner C position) is generated, similarly, a predicted value of a lower boundary BC position (weighted average of the predicted values of the lower left corner reference pixel B and the lower right corner C position) is generated, and predicted values of the remaining other internal pixel points are generated by weighted average of horizontal linear prediction and vertical linear prediction. The predicted value generated by the horizontal linear prediction model is the weighted average of the predicted values of the reference pixel L at the left corresponding position and the position of the right boundary AC; the predicted value generated by the vertical linear prediction model is the weighted average of the predicted values of the reference pixel T at the position corresponding to the upper edge and the position of the lower boundary BC.
Exemplary, orgPredmatrix [ x ] [ y ] = ((((ia-c [ y +1 ]) x (x + 1)) < < Log (N)) + ((ib-r [ x +1 ]) x (y + 1)) < < Log (M)) + ((r [ x +1] + c [ y +1 ]) < (Log (M) + Log (N))) + ((ic < < 1) -ia-ib). Times.x y + (1 < (Log (M) + Log (N))) > (Log (M) + Log (N) + 1), (x = 0-M-1, y = 0-N-1). predMatrix [ x ] [ y ] = Clip1 (orgPredMatrix [ x ] [ y ]), (x =0 to M-1, y =0 to N-1). ia = r [ M ], ib = c [ N ], if M is equal to N, ic = (ia + ib + 1) > >1; otherwise ic = (((ia < < Log (M)) + (ib < < Log (N)))) x weight + (1 < (ishift + 5))) > (ishift + 6), ishift = Log (Min (M, N)), weight = bilianerwight [ Log (Max (M, N)/Min (M, N)) -1], bilianerwight [3] = {21,13,7}.
Improved Biliner prediction process: the number of the reference pixels is improved, the original 1 reference pixel value is replaced by the weighted average value of 5 reference pixels, and the weight of the 5 reference pixels is as follows: {82,252,356,252,82}, see FIG. 1J.
And (3) predicted value correction process: based on the improved angular, DC, plane, or Bilinear mode, the current block reference pixel is further used to modify the predicted pixel, as shown in fig. 1K and 1L, for the pixel X in the first row or column, the reference pixel used is labeled as "D1", otherwise, the reference pixel used is labeled as "D2", D1 and D2 contain reference pixels in four different positions, and if the current pixel is in the first two rows or columns, the weighted average weight used is {10,216}, otherwise, the weight used is {13,204}. In summary, the IIP mode includes the five improvements above, and for the IIP mode, 1 flag bit, iIP _ flag, is used to identify whether the current block uses the improved intra prediction mode to generate the intra prediction value.
The video coding framework to which the present application applies: referring to fig. 2, a video encoding frame may be used to implement the encoding-side processing flow of the embodiment of the present application, a schematic diagram of a video decoding frame is similar to that of fig. 2, and details are not repeated here, and a video decoding frame may be used to implement the decoding-side processing flow of the embodiment of the present application. In the video encoding and decoding frameworks, there may be included, but not limited to: intra prediction, motion estimation/motion compensation, reference picture buffer, in-loop filtering, reconstruction, transform, quantization, inverse transform, inverse quantization, entropy coder, 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.
Illustratively, the prediction is divided into intra-frame prediction and inter-frame prediction, the intra-frame prediction considers that strong spatial correlation exists between adjacent blocks in an image, a current uncoded block can be predicted by using surrounding reconstructed pixels as reference pixels, only a residual signal (an original signal-a prediction signal) needs to be subjected to subsequent coding processing instead of coding the original signal, the redundancy in a spatial domain is effectively removed, and the compression efficiency of a video signal is greatly improved. Inter-frame prediction refers to using the correlation in the video signal time domain to predict the pixels of the current image by using the pixels of the adjacent coded images, so as to achieve the purpose of removing the video time domain redundancy.
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-changed areas, so that the image energy can be distributed in a spatial domain in a dispersed manner and converted into relatively concentrated distribution in a transform domain in a proper transformation process, the frequency domain correlation among signals can be removed, and the code stream can be effectively compressed 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: different quadratic transformation matrices are used for 4 x 4 blocks and non-4 x 4 blocks. For the encoding end, transform coefficients are obtained after (DCT 2 ) transform, the transform coefficients of 4 x 4 blocks 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. For a decoding end, after inverse quantization is carried out on a transformation coefficient obtained by entropy decoding of a code stream, secondary inverse transformation is carried out on a 4-by-4 area at the upper left corner to obtain a new transformation coefficient, and then (DCT 2 ) is used for carrying out inverse transformation on the whole transformation 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 following is performed on the coefficient matrix:
first, a 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. If the intra prediction mode (IntraLumaPredMode) has a value of 0-2, or 13-32, or 44-65, and the reference samples outside the current block to the left are "available", then: c. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is the element of 4 by 4 matrix P, which is calculated as follows: p = C × S 4 ,S 4 Is 4 x 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 (D) is greater than 32767, then c ij Has a value of 32767. If the intra prediction mode (IntraLumaPredMode) has a value of 0 to 23, or 34 to 57, and the reference samples on the 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 a 4 x 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 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 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 CoeffMatrix is 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 4 × 4 blocks, the initial inverse transform is not needed after the inverse transform of the second transform is performed.
Referring to the above embodiments, the quadratic transformation technique refers to: firstly, carrying out initial transformation to obtain a transformation coefficient after the initial transformation, carrying out secondary transformation on the transformation coefficient after the initial transformation to obtain a new transformation coefficient, and carrying out quantization, entropy coding and other processes on the new transformation coefficient. In the related art, a secondary transform is performed on a luminance component of a current block. However, the secondary transform is only used for the luminance component and not for the chrominance component, and for the chrominance component of the current block, only the initial transform of (DCT 2 ) is performed by default, and for the chrominance component, there is also a problem that the energy may not be concentrated enough after the initial transform. In view of the above findings, in the embodiment of the present application, the chroma components may be subjected to secondary transformation, so as to improve the encoding performance.
In one possible implementation, for the encoding side, whether the chroma component is subjected to the secondary transform is determined by a rate distortion cost value (RDO), and a secondary transform flag bit is explicitly encoded to indicate whether the chroma component of the current block uses the secondary transform, and the chroma U component and the chroma V component share the same secondary transform flag bit, i.e., the secondary transform flag bit indicates that the chroma U component and the chroma V component are subjected to the secondary transform at the same time, or neither the chroma U component nor the chroma V component is subjected to the secondary transform.
In another possible implementation, for the encoding side, whether the chroma components are subjected to the secondary transform is determined by a rate distortion cost value (RDO), and a secondary transform flag is explicitly encoded to indicate whether the chroma components of the current block use the secondary transform, and the chroma U component and the chroma V component use separate secondary transform flags, respectively. That is, one secondary transform flag bit indicates that the chrominance U component is secondarily transformed or that the chrominance U component is not secondarily transformed. Another secondary transform flag bit indicates that the chrominance V component is to be secondary transformed or that the chrominance V component is not to be secondary transformed.
In another possible implementation, for the encoding side, whether the luma component and the chroma component are subjected to the secondary transform is determined by a rate distortion cost value (RDO), and a secondary transform flag bit is explicitly encoded to indicate whether the luma component and the chroma component of the current block use the secondary transform, and the luma component and the chroma component (the chroma U component and the chroma V component) share the same secondary transform flag bit, that is, the secondary transform flag bit indicates that the luma component, the chroma U component and the chroma V component are subjected to the secondary transform at the same time, or neither the luma component, the chroma U component nor the chroma V component is subjected to the secondary transform.
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. 3A, which is a schematic flow chart of a decoding method proposed in an embodiment of the present application, the decoding method may be applied to a decoding end, and the decoding method may include the following steps:
step 311, obtaining the encoded bit stream of the current block, and parsing a transform coefficient flag from the encoded bit stream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component of the current block contains a non-zero transform coefficient.
For example, if the flag bit of the transform coefficient is the first value, it can be used to indicate that the final transform coefficient matrix corresponding to the chroma component of the current block contains a non-zero transform coefficient. Or, if the transform coefficient flag is the second value, it may be used to indicate that the final transform coefficient matrix corresponding to the chroma component of the current block does not contain a non-zero transform coefficient.
For example, the encoding end may encode a final transform coefficient matrix corresponding to the chroma component of the current block in the encoded bitstream of the current block, and the final transform coefficient matrix may contain a non-zero transform coefficient or may not contain a non-zero transform coefficient, see the following embodiments. When the encoding end sends the encoded bit stream to the decoding end, a transform coefficient flag bit may be encoded in the encoded bit stream, where the transform coefficient flag bit is used to indicate whether a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient. To sum up, after obtaining the encoded bit stream, the decoding end may parse the transform coefficient flag from the encoded bit stream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient.
The chrominance component of the current block is a chrominance U component and a chrominance V component, and the transform coefficient flag bit comprises a chrominance U component transform coefficient flag bit and a chrominance V component transform coefficient flag bit. When the value of the chroma U component transformation coefficient flag bit is a first value, the method is used for indicating that a final transformation coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transformation coefficient; and when the value of the chroma U component transformation coefficient flag bit is the second value, the chroma U component transformation coefficient flag bit is used for indicating that the final transformation coefficient matrix corresponding to the chroma U component of the current block does not contain a non-zero transformation coefficient. When the value of the chroma V component transformation coefficient flag bit is a first value, the method is used for indicating that a final transformation coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transformation coefficient; and when the value of the chroma V component transformation coefficient flag bit is the second value, the flag bit is used for indicating that the final transformation coefficient matrix corresponding to the chroma V component of the current block does not contain a non-zero transformation coefficient. For example, the first value may be 1, and the second value may be 0. Based on this, the flag bit of the transform coefficient is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and includes: the value of the chroma U component transformation coefficient zone bit is a first value, and/or the value of the chroma V component transformation coefficient zone bit is a first value.
In summary, the decoding end may parse the chroma U-component transform coefficient flag and the chroma V-component transform coefficient flag from the encoded bitstream of the current block. If the value of the flag bit of the transform coefficient of the chrominance U component is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the chrominance U component contains a non-zero transform coefficient. If the value of the flag bit of the transform coefficient of the chrominance U component is the second value, the decoding end may determine that the final transform coefficient matrix corresponding to the chrominance U component does not contain a non-zero transform coefficient. If the value of the flag bit of the chrominance V component transform coefficient is the first value, the decoding end may determine that the final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient. If the value of the flag bit of the chrominance V component transform coefficient is the second value, the decoding end may determine that the final transform coefficient matrix corresponding to the chrominance V component does not contain a non-zero transform coefficient.
In step 312, if the current block satisfies the first predetermined condition, a secondary transform flag bit of the chroma component at the block level is parsed from the coded bitstream, where the secondary transform flag bit is used to indicate that the chroma component is to be inversely transformed secondarily, or the chroma component is not to be inversely transformed secondarily. The first preset condition may include at least: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
When the value of the secondary transformation zone bit is the first value, the secondary inverse transformation is performed on the chrominance component, and when the value of the secondary transformation zone bit is the second value, the secondary inverse transformation is not performed on the chrominance component.
For example, the first value is 1, and the second value is 0.
Step 313, if the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chroma component of the current block from the coded bit stream of the current block, performing inverse quantization on the final transform coefficient matrix corresponding to the chroma component to obtain a target transform coefficient matrix corresponding to the chroma component, and determining whether to perform secondary inverse transform on the target transform coefficient matrix corresponding to the chroma component according to the secondary transform flag bit.
For example, if the transform coefficient flag bit is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, the decoding end determines that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, analyzes the final transform coefficient matrix corresponding to the chroma component of the current block from the coded bit stream of the current block, and performs inverse quantization on the final transform coefficient matrix corresponding to the chroma component to obtain a target transform coefficient matrix corresponding to the chroma component.
For example, the decoding end may determine whether the current block satisfies a first preset condition, and if the current block does not satisfy the first preset condition, the decoding end determines that the target transform coefficient matrix corresponding to the chroma component of the current block is not subjected to the inverse transform twice. If the current block satisfies the first predetermined condition, the decoding end may further parse a secondary transform flag (referred to as a secondary transform flag for short) of the block-level chroma component from the encoded bitstream of the current block. And if the secondary transformation flag bit is used for indicating that the secondary inverse transformation is carried out on the target transformation coefficient matrix corresponding to the chrominance component, the decoding end determines to carry out the secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation flag bit. And if the secondary transformation zone bit is used for indicating that the secondary inverse transformation is not carried out on the target transformation coefficient matrix corresponding to the chrominance component, the decoding end determines that the secondary inverse transformation is not carried out on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
In a possible embodiment, the first preset condition may include at least: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chrominance component of the current block contains a non-zero transform coefficient. In summary, if it is determined that the prediction mode of the current block is the intra prediction mode and the flag of the transform coefficient is the first value, the decoding end may determine that the current block satisfies the first predetermined condition. If the prediction mode of the current block is determined not to be the intra-frame prediction mode and/or the flag bit of the transform coefficient is the second value, the decoding end may determine that the current block does not satisfy the first preset condition.
Referring to the above embodiment, the transform coefficient flag includes a chroma U-component transform coefficient flag and a chroma V-component transform coefficient flag, based on which, if the prediction mode of the current block is the intra-frame prediction mode, and the chroma U-component transform coefficient flag is the first value and/or the chroma V-component transform coefficient flag is the first value, the decoding end determines that the current block satisfies the first preset condition. And if the prediction mode of the current block is not the intra-frame prediction mode and/or the chroma U component transformation coefficient flag bit and the chroma V component transformation coefficient flag bit are both second values, the decoding end determines that the current block does not meet the first preset condition.
In a possible embodiment, in addition to that the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, the first predetermined condition may include, but is not limited to, at least one of: the current block does not use the intra prediction filtering mode; the current block does not use the improved intra prediction mode; the current block adopts a transformation check (DCT 2 ) to carry out initial inverse transformation; the chroma intra-frame prediction mode of the current block meets a preset mode condition; the size of the chrominance component of the current block meets a preset size condition; the control information allows the chroma components to use a quadratic inverse transform.
For example, the first preset condition may include: the prediction mode of the current block is an intra prediction mode, the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, and the current block does not use an intra prediction filtering mode (IPF mode).
For another example, the first preset condition may include: the prediction mode of the current block is an intra prediction mode, the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and the current block does not use an improved intra prediction mode (IIP mode).
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, and the current block carries out initial inverse transformation by adopting transformation checks (DCT 2 and DCT 2).
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, and the chroma intra-frame prediction mode of the current block meets a preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, and the size of the chrominance component of the current block meets a preset size condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, and the control information allows the chroma component to use secondary inverse transformation.
For example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, and the current block does not use an improved intra-frame prediction mode.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the current block carries out initial inverse transformation by adopting transformation check (DCT 2 ).
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the chroma intra-frame prediction mode of the current block meets a preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the size of the chroma component of the current block meets a preset size condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the control information allows the chroma component to use secondary inverse transformation.
For example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, and the chrominance intra-frame prediction mode of the current block meets the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, and the size of the chrominance component of the current block meets a preset size condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the flag bit of the transformation coefficient is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, and the control information allows the chrominance component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the flag bit of the transformation coefficient is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, the chrominance intra-frame prediction mode of the current block meets a preset mode condition, the size of the chrominance component of the current block meets a preset size condition, and the control information allows the chrominance component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the flag bit of the transformation coefficient is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, and the control information allows the chrominance component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the chroma intra-frame prediction mode of the current block meets a preset mode condition, and the control information allows the chroma component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to carry out initial inverse transformation, and the chrominance intra-frame prediction mode of the current block meets the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the chroma intra-frame prediction mode of the current block meets a preset mode condition.
Of course, the above are only examples, and the first preset condition may include any combination of the above conditions.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, which may include, but is not limited to, at least one of: the chroma intra-frame prediction mode of the current block is not a TSCPM mode; the chroma intra-prediction mode of the current block is not a PMC mode; the mode numbers of the chroma intra-prediction modes of the current block are from 0 to 4; the Chroma Intra prediction mode of the current block is not Intra _ Chroma _ PCM mode; the chroma intra prediction mode of the current block is not the DM mode.
For example, if the chroma intra prediction mode of the current block is not the TSCPM mode, or the chroma intra prediction mode of the current block is not the PMC mode, or the mode numbers of the chroma intra prediction modes of the current block are the mode numbers 0 to 4, it may be determined that the chroma intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode (or IPD _ IPCM mode), or the Chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode and the Chroma Intra prediction mode of the current block is not the TSCPM mode, it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode (or named Chroma IPD _ IPCM mode), it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode), or the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode) and the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode), and/or the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
In the above embodiment, the size of the chroma component of the current block satisfies the preset size condition, which may include but is not limited to at least one of the following: the width of the chrominance component is equal to or less than n1, and the height of the chrominance component is equal to or less than n2. The width of the chrominance component is equal to or less than n1, or the height of the chrominance component is equal to or less than n2. The width of the chrominance component is equal to or greater than n3, and the height of the chrominance component is equal to or greater than n4. The width of the chrominance component is equal to or greater than n3, or the height of the chrominance component is equal to or greater than n4. The product of the width and height of the chrominance components is greater than or equal to n5. The product of the width and height of the chrominance components is less than or equal to n6.
For example, any combination of the above-mentioned preset size conditions may be: the width of the chrominance component is n3 or more and n1 or less, and the height of the chrominance component is n4 or more and n2 or less. For example, the width of the chrominance component is n3 or more and n1 or less, or the height of the chrominance component is n4 or more and n2 or less. For another example, the width of the chrominance component is equal to or less than n1, the height of the chrominance component is equal to or less than n2, and the product of the width and the height of the chrominance component is equal to or greater than n5. For another example, the width of the chrominance component is equal to or less than n1, the height of the chrominance component is equal to or less than n2, and the product of the width and the height of the chrominance component is equal to or less than n6.
Of course, the above is only an example of the preset size condition, and the preset size condition may be any combination of the above conditions.
Illustratively, n1 and n2 may be empirically configured, and n1 and n2 may be the same or different, for example, n1= n2=32. Of course, 32 is merely exemplary and other values, such as 64, etc., are possible. n3 and n4 may be empirically configured, and n3 and n4 may be the same or different, for example, n3= n4=4. Of course, 4 is merely an example and may be other values, such as 8, etc. n5 and n6 may be empirically configured, and n5 and n6 may be the same or different, for example, n5= n6=128. Of course, 128 is merely exemplary and other values, such as 256, etc., are possible.
In the above embodiment, the control information allows the chroma components to use a quadratic inverse transform, which may include, but is not limited to, one of: the sequence level control information allows the chroma components to use a quadratic inverse transform. The picture parameter set level control information allows the chroma components to use a quadratic inverse transform. The picture header level control information allows the chroma components to use a quadratic inverse transform. The slice header level control information allows the chroma components to use a quadratic inverse transform. Of course, the above are just a few examples of the control information, and the level of the control information is not limited.
Sequence Parameter Set (SPS) there is a flag bit that determines whether certain tools (methods) are allowed to switch in the entire video sequence (i.e., multi-frame video image), and if the flag bit is 1, the video sequence allows the corresponding tool (method) to be enabled; otherwise the tool (method) cannot be enabled during the encoding of the sequence.
Based on this, the chroma components may be allowed to use the second inverse transform by the sequence level control information, or the chroma components may not be allowed to use the second inverse transform by the sequence level control information. For example, secondary _ transform _ enable _ flag =1, which indicates that the secondary inverse transform is allowed to be used for the chroma components by the sequence level control information, secondary _ transform _ enable _ flag =0, which indicates that the secondary inverse transform is not allowed to be used for the chroma components by the sequence level control information, and secondary _ transform _ enable _ flag may also be referred to as secondary transform enable flag.
For another example, est _ enable _ flag =1, which indicates that the sequence level control information allows the enhancement inverse transform to be used, and est _ enable _ flag =1, which indicates that the sequence level control information allows the chroma components to be used in the inverse transform. est _ enable _ flag =0, which indicates that the sequence-level control information does not allow the enhanced inverse secondary transform to be used, and est _ enable _ flag =0, which indicates that the sequence-level control information does not allow the chroma components to be used in the inverse secondary transform. The est _ enable _ flag may also be denoted as EstEnablFlag.
For another example, st _ chroma _ enable _ flag =1 indicates that the chroma component is permitted to use the second inverse transform by the sequence-level control information, and st _ chroma _ enable _ flag =0 indicates that the chroma component is not permitted to use the second inverse transform by the sequence-level control information. st _ chroma _ enable _ flag may also be denoted as stchroma enableflag.
For another example, if second _ transform _ enable _ flag =1 and est _ enable _ flag =1, it indicates that the sequence level control information allows the chroma components to use the second inverse transform, and if second _ transform _ enable _ flag =1 and est _ enable _ flag =0, it indicates that the sequence level control information does not allow the chroma components to use the second inverse transform. If secondary _ transform _ enable _ flag =0, it is not necessary to decode the est _ enable _ flag, and it can directly indicate that the sequence level control information does not allow the secondary inverse transform to be used for the chroma components.
For another example, if secondary _ transform _ enable _ flag =1 and st _ chroma _ enable _ flag =1, it indicates that the sequence-level control information allows the chroma component to use the second inverse transform, and if secondary _ transform _ enable _ flag =1 and st _ chroma _ enable _ flag =0, it indicates that the sequence-level control information does not allow the chroma component to use the second inverse transform. If secondary _ transform _ enable _ flag =0, it is not necessary to decode st _ chroma _ enable _ flag, and it can directly indicate that the sequence level control information does not allow the chroma components to use the second inverse transform.
Of course, the above is only a few examples that allow the chroma components to use the inverse quadratic transform and do not allow the chroma components to use the inverse quadratic transform through the sequence level control information, and this is not limited.
The Picture Parameter Set (PPS) has flag bits that determine whether certain tool (method) switches are allowed in a certain picture. If the flag bit is 1, the corresponding tool (method) is allowed to be enabled in the image; otherwise, the tool (method) cannot be enabled during the encoding of the image. Based on this, the chroma components are allowed to use the quadratic inverse transform by the picture parameter set level control information, or the chroma components are not allowed to use the quadratic inverse transform by the picture parameter set level control information.
Picture header: common information for a certain frame of picture, different from the picture parameter set (which can be used by different pictures), is held in the picture header only for the current picture. For example, when the current picture contains multiple slices, the multiple slices may share information in the picture header. The image header has flag bits that determine whether certain tool (method) switches are allowed in the current image. If the flag bit is 1, the current image allows the corresponding tool (method) to be started; otherwise, the tool (method) cannot be enabled during the encoding of the current image. Based on this, the chrominance components may be allowed to use the quadratic inverse transform by the picture header level control information, or the chrominance components may not be allowed to use the quadratic inverse transform by the picture header level control information.
Slice header (Slice header): one frame of image contains at least one slice, and in the header information of each slice, there is a flag bit for determining whether certain tools (methods) are allowed to switch in the slice. If the flag bit is 1, enabling a corresponding tool (method) in slice; otherwise, the tool (method) cannot be enabled during the encoding of the slice. Based on this, the chroma components may be allowed to use the second inverse transform by the slice-header-level control information, or the chroma components may not be allowed to use the second inverse transform by the slice-header-level control information.
In a possible embodiment, the chroma components of the current block are chroma U components and chroma V components, and the secondary transform flag may be a UV component common secondary transform flag, which indicates that the chroma U component and the chroma V component are subjected to simultaneous inverse transform twice when a value of the UV component common secondary transform flag is a first value, or indicates that neither the chroma U component nor the chroma V component is subjected to inverse transform twice when a value of the UV component common secondary transform flag is a second value. Based on this, in step 313, if the value of the analyzed UV component shared secondary transform flag is the first value, it is determined that the chroma U component and the chroma V component are subjected to the secondary inverse transform at the same time, and if the value of the analyzed UV component shared secondary transform flag is the second value, it is determined that neither the chroma U component nor the chroma V component is subjected to the secondary inverse transform.
In another possible implementation, the chrominance components of the current block are chrominance U components and chrominance V components, and the secondary transform flag bit may include a U component secondary transform flag bit and a V component secondary transform flag bit; when the value of the U component secondary transformation zone bit is a first value, the U component secondary transformation zone bit is used for indicating that secondary inverse transformation is carried out on the chroma U component, or when the value of the U component secondary transformation zone bit is a second value, the U component secondary transformation zone bit is used for indicating that secondary inverse transformation is not carried out on the chroma U component; when the value of the V component quadratic transformation zone bit is a first value, the method is used for indicating that the chromaticity V component is subjected to quadratic inverse transformation, or when the value of the V component quadratic transformation zone bit is a second value, the method is used for indicating that the chromaticity V component is not subjected to quadratic inverse transformation. Based on this, in step 313, if the analyzed secondary transform flag bit of the U component is the first value, it is determined to perform secondary inverse transform on the chrominance U component; and if the analyzed secondary transformation flag bit of the U component is a second value, determining that secondary inverse transformation is not performed on the chrominance U component. If the analyzed secondary transformation flag bit of the V component is a first value, determining to perform secondary inverse transformation on the chrominance V component; and if the analyzed secondary transformation flag bit of the V component is a second value, determining that the secondary inverse transformation is not carried out on the chrominance V component.
In one possible embodiment, the decoding end parses the secondary transform flag bit from the coded bit stream, which may include but is not limited to: the decoding end analyzes the secondary transformation zone bit from the coded bit stream by adopting a context-based binary arithmetic decoding mode; or the decoding end analyzes the secondary conversion flag bit from the coded bit stream by adopting a bypass decoding mode.
Illustratively, the decoding end uses a context-based binary arithmetic decoding manner to parse the quadratic transform flag bit from the coded bitstream, which may include but is not limited to: the decoding end selects a target context model from at least two pre-configured context models based on the chroma intra-frame prediction mode of the current block, and analyzes a secondary transformation flag bit from the coded bit stream based on the target context model. Alternatively, the decoding end selects a target context model from at least two context models configured in advance based on the size of the chrominance component, and parses a quadratic transform flag from the encoded bitstream based on the target context model.
According to the technical scheme, in the embodiment of the application, after the chroma components of the current block are subjected to initial transformation, whether the chroma components of the current block are subjected to secondary transformation can be determined, if yes, the chroma components of the current block can be subjected to secondary transformation, namely, the secondary transformation technology can also be applied to the chroma components of the current block, and when the chroma components are subjected to initial transformation and the problem of insufficient energy concentration exists, the chroma components can also be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
Example 2: in a possible implementation manner, referring to fig. 3B, a flowchart of a decoding method proposed in an embodiment of the present application is shown, where the decoding method can be applied to a decoding end, and the decoding method can include the following steps:
step 321, obtaining the encoded bit stream of the current block, and parsing a transform coefficient flag from the encoded bit stream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component of the current block contains a non-zero transform coefficient.
Step 322, if the current block satisfies the first predetermined condition, parsing a secondary transform flag of the block-level chroma component from the encoded bitstream, where the secondary transform flag is used to indicate that the chroma component is subjected to secondary inverse transform or the chroma component is not subjected to secondary inverse transform. The first preset condition may include at least: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
Step 323, if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component of the current block from the coded bit stream of the current block, performing inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component, and determining whether to perform secondary inverse transform on the target transform coefficient matrix corresponding to the chrominance component according to the secondary transform flag bit.
For an exemplary implementation process of steps 321 to 323, refer to embodiment 1, and details are not repeated here.
Step 324, if the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation, performing secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component to obtain an initial transformation coefficient matrix corresponding to the chrominance component; and if the target transformation coefficient matrix corresponding to the chrominance component is not subjected to secondary inverse transformation, determining the target transformation coefficient matrix corresponding to the chrominance component as the initial transformation coefficient matrix corresponding to the chrominance component.
For example, the target transform coefficient matrix corresponding to the chrominance component may include a target transform coefficient matrix corresponding to the chrominance U component and a target transform coefficient matrix corresponding to the chrominance V component, and on the basis:
and if the secondary transformation zone bit is a secondary transformation zone bit shared by the UV components and the secondary transformation zone bit shared by the UV components is used for indicating that the chromaticity U component and the chromaticity V component are subjected to secondary inverse transformation simultaneously, performing secondary inverse transformation on a target transformation coefficient matrix corresponding to the chromaticity U component to obtain an initial transformation coefficient matrix corresponding to the chromaticity U component. And carrying out secondary inverse transformation on the target transformation coefficient matrix corresponding to the chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component. And if the UV component shares the secondary transformation zone bit for indicating that the secondary inverse transformation is not performed on the chrominance U component and the chrominance V component, determining a target transformation coefficient matrix corresponding to the chrominance U component as an initial transformation coefficient matrix corresponding to the chrominance U component, and determining a target transformation coefficient matrix corresponding to the chrominance V component as an initial transformation coefficient matrix corresponding to the chrominance V component.
And if the secondary transformation zone bit is a U component secondary transformation zone bit and a V component secondary transformation zone bit, and if the U component secondary transformation zone bit is used for indicating the secondary inverse transformation of the chromaticity U component, performing secondary inverse transformation on a target transformation coefficient matrix corresponding to the chromaticity U component to obtain an initial transformation coefficient matrix corresponding to the chromaticity U component. And if the secondary transformation flag bit of the U component is used for indicating that the secondary inverse transformation is not performed on the chrominance U component, determining a target transformation coefficient matrix corresponding to the chrominance U component as an initial transformation coefficient matrix corresponding to the chrominance U component. And if the V component secondary transformation zone bit is used for indicating that the chrominance V component is subjected to secondary inverse transformation, performing secondary inverse transformation on a target transformation coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component. And if the V component secondary transformation zone bit is used for indicating that the chrominance V component is not subjected to secondary inverse transformation, determining a target transformation coefficient matrix corresponding to the chrominance V component as an initial transformation coefficient matrix corresponding to the chrominance V component.
In one possible implementation, in step 324, inverse transforming the target transform coefficient matrix twice to obtain an initial transform coefficient matrix corresponding to the chrominance component (e.g., inverse transforming the target transform coefficient matrix corresponding to the chrominance U component twice to obtain an initial transform coefficient matrix corresponding to the chrominance U component, or inverse transforming the target transform coefficient matrix corresponding to the chrominance V component twice to obtain an initial transform coefficient matrix corresponding to the chrominance V component), which may include but is not limited to:
In case one, if the width of the chrominance component is greater than a preset threshold, or the height of the chrominance component is greater than a preset threshold, determining a coefficient matrix based on a transformation coefficient of a designated area located at the upper left corner in the target transformation coefficient matrix; performing horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; carrying out vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; and updating the transformation coefficient of the specified area positioned at the upper left corner in the target transformation coefficient matrix based on the vertical inverse transformation matrix to obtain the initial transformation coefficient matrix. For example, the preset threshold may be empirically configured, such as 4, and the specified region at the upper left corner may be empirically configured, such as a sub-region of 4 × 4 located at the upper left corner in the target transform coefficient matrix.
Determining a coefficient matrix based on the transformation coefficient of the designated area positioned at the upper left corner in the target transformation coefficient matrix if the width of the chrominance component is greater than a preset threshold value or the height of the chrominance component is greater than a preset threshold value; if the mode number of the chroma intra-frame prediction mode of the current block is located in the first mode number interval, performing horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; and if the mode number of the chroma intra-frame prediction mode of the current block is positioned in the second mode number interval, performing vertical inverse transformation on the coefficient matrix to obtain a vertical inverse transformation matrix. And if only the horizontal inverse transformation is carried out on the coefficient matrix, updating the transformation coefficient of the specified area positioned at the upper left corner in the target transformation coefficient matrix based on the horizontal inverse transformation matrix to obtain an initial transformation coefficient matrix. And if only the vertical inverse transformation is carried out on the coefficient matrix, updating the transformation coefficient of the specified area positioned at the upper left corner in the target transformation coefficient matrix based on the vertical inverse transformation matrix to obtain an initial transformation coefficient matrix.
For example, the first pattern number section and the second pattern number section may be configured empirically, and are not limited thereto, and the first pattern number section and the second pattern number section may not have a repetitive pattern number, and the first pattern number section and the second pattern number section may also have a repetitive pattern number. For example, the first pattern number section includes pattern numbers 0 to 2, 4 to 6, 8 to 9, 11 to 12, and 14 to 15, and the second pattern number section includes pattern numbers 0 to 1, 3 to 5, 7 to 8, 10 to 11, 13 to 14, and 16. If the mode number of the chroma intra prediction mode of the current block is 0-2, or 4-6, or 8-9, or 11-12, or 14-15, the mode number of the chroma intra prediction mode of the current block is located in the first mode number interval. If the mode number of the chroma intra prediction mode of the current block is 0-1, or 3-5, or 7-8, or 10-11, or 13-14, or 16, the mode number of the chroma intra prediction mode of the current block is located in the second mode number interval.
For example, if the mode number of the chroma intra prediction mode of the current block is located in both the first mode number section and the second mode number section, the coefficient matrix may be horizontally inversely transformed to obtain a horizontal inverse transformation matrix, and then the horizontal inverse transformation matrix may be vertically inversely transformed to obtain a vertical inverse transformation matrix. On the basis, horizontal inverse transformation is firstly carried out on the coefficient matrix, and then vertical inverse transformation is carried out on the coefficient matrix, so that the transformation coefficient of the specified area positioned at the upper left corner in the target transformation coefficient matrix can be updated based on the vertical inverse transformation matrix after vertical inverse transformation, and the initial transformation coefficient matrix is obtained.
If the width of the chrominance component is equal to a preset threshold value and the height of the chrominance component is equal to the preset threshold value, performing vertical inverse transformation on the target transformation coefficient matrix to obtain a vertical inverse transformation matrix; performing horizontal inverse transformation on the vertical inverse transformation matrix to obtain a horizontal inverse transformation matrix; an initial transform coefficient matrix is determined based on the horizontal inverse transform matrix.
In summary, based on the first case, the second case and the third case, if the preset threshold is 4, and the designated region is the sub-region of 4 × 4 at the upper left corner, in the process of performing the secondary inverse transformation on the chroma components, if the value of the width or the height of the target transform coefficient matrix is greater than 4, the coefficient matrix of 4 × 4 at the upper left corner is subjected to the secondary inverse transformation, and if the values of the width and the height of the target transform coefficient matrix are both 4, the target transform coefficient matrix is subjected to the secondary inverse transformation, and the secondary inverse transformation process is not described again.
In summary, in step 324, the initial transform coefficient matrix corresponding to the chrominance component, that is, the initial transform coefficient matrix corresponding to the chrominance U component and the initial transform coefficient matrix corresponding to the chrominance V component, may be obtained.
And 325, performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance components to obtain a residual error coefficient matrix corresponding to the chrominance components. For example, the decoding end may perform initial inverse transformation on an initial transformation coefficient matrix corresponding to the chrominance U component to obtain a residual coefficient matrix corresponding to the chrominance U component, and may perform initial inverse transformation on an initial transformation coefficient matrix corresponding to the chrominance V component to obtain a residual coefficient matrix corresponding to the chrominance V component.
For example, in the process of the initial inverse transformation, if the encoding end performs the initial transformation on the residual coefficient matrix corresponding to the chrominance components by using the transformation check (DCT 2 ) to obtain the initial transformation coefficient matrix, the decoding end may perform the initial inverse transformation on the initial transformation coefficient matrix by using the transformation check (DCT 2 ) to obtain the residual coefficient matrix corresponding to the chrominance components.
Of course, when the encoding end performs the initial transformation by using other transformation checks, the decoding end also performs the initial inverse transformation by using the same transformation check, that is, the initial inverse transformation is the inverse process of the initial transformation, and the description of the initial inverse transformation process is omitted.
And step 326, determining a reconstructed value of the chroma component according to the residual coefficient matrix corresponding to the chroma component.
For example, the decoding end may determine the reconstructed value of the chrominance U component according to the residual coefficient matrix corresponding to the chrominance U component, and the decoding end may determine the reconstructed value of the chrominance V component according to the residual coefficient matrix corresponding to the chrominance V component.
For example, a reference block corresponding to the chrominance component may be determined, and for each pixel of the chrominance component, a reference point corresponding to the pixel may be determined from the reference block, and a residual coefficient value corresponding to the pixel may be 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 pixel points of the chrominance component can be formed into the reconstructed value of the chrominance component. Of course, the above-described manner is merely an example, and is not limited thereto.
According to the technical scheme, after the chroma components of the current block are subjected to initial transformation, whether the chroma components of the current block are subjected to secondary transformation can be determined, if yes, the chroma components of the current block can be subjected to secondary transformation, namely, the secondary transformation technology can also be applied to the chroma components of the current block, and when the chroma components are subjected to initial transformation and the energy is not concentrated enough, the chroma components can also be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
Example 3: in a possible implementation manner, referring to fig. 4A, which is a schematic flow chart of an encoding method proposed in an embodiment of the present application, the encoding method may be applied to an encoding end, and the encoding method may include the following steps:
and 411, obtaining a residual coefficient matrix corresponding to the chrominance component of the current block.
For example, a reference block corresponding to the chroma component of the current block may be determined, and for each pixel point of the chroma component, 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 chrominance components form the residual coefficient matrix corresponding to the chrominance components of the current block. Of course, the above-described manner is merely an example, and is not limited thereto.
Step 412, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
For example, the chrominance component of the current block includes a chrominance U component and a chrominance V component, and the encoding end may perform initial transformation on the residual coefficient matrix corresponding to the chrominance U component to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, and perform initial transformation on the residual coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component.
For example, the encoding end may perform initial transformation on the residual coefficient matrix corresponding to the chrominance component (e.g., chrominance U component or chrominance V component) by using a transformation check (DCT 2 ), so as to obtain an initial transformation coefficient matrix corresponding to the chrominance component. Of course, other transformation checks may also be used to perform the initial transformation, and the process of this initial transformation will not be described again.
Step 413, if the current block meets a second preset condition, determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component.
For example, the encoding end may determine whether the current block satisfies a second preset condition, and if the current block does not satisfy the second preset condition, the encoding end determines that the initial transform coefficient matrix corresponding to the chroma component of the current block is not subjected to the secondary transform. If the current block meets the second preset condition, the encoding end may further determine whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component of the current block based on the cost value corresponding to the chroma component, and the specific determination manner refers to the following embodiments.
In a possible embodiment, the second preset condition may include at least: the prediction mode of the current block is an intra-frame prediction mode, and an initial transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient. In summary, if it is determined that the prediction mode of the current block is the intra prediction mode and the initial transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, it is determined that the current block satisfies the second predetermined condition. And if the prediction mode of the current block is determined not to be the intra-frame prediction mode and/or the initial transform coefficient matrix corresponding to the chrominance component does not contain the non-zero transform coefficient, determining that the current block does not meet the second preset condition.
For example, since the chrominance component of the current block includes a chrominance U component and a chrominance V component, if the prediction mode of the current block is an intra-frame prediction mode and the initial transform coefficient matrix corresponding to the chrominance U component and/or the initial transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient, it is determined that the current block satisfies the second preset condition. And if the prediction mode of the current block is not the intra-frame prediction mode, and/or the initial transform coefficient matrix corresponding to the chroma U component and the initial transform coefficient matrix corresponding to the chroma V component do not contain non-zero transform coefficients, determining that the current block does not meet the second preset condition.
For example, in addition to that the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix corresponding to the chroma component contains non-zero transform coefficients, the second predetermined condition may include, but is not limited to, at least one of the following: the current block does not use an intra prediction filtering mode (IPF mode); the current block does not use the improved intra prediction mode (IIP mode); the current block is subjected to initial transformation by adopting a transformation check (DCT 2 ); the chroma intra-frame prediction mode of the current block meets the preset mode condition; the size of the chrominance component of the current block meets a preset size condition; the control information allows the chroma components to use a quadratic transform.
For example, the combination manner of each condition in the second preset condition may refer to the combination manner of each condition in the first preset condition in embodiment 1, and details are not repeated here. For example, the second predetermined condition needs to match the first predetermined condition, for example, when the first predetermined condition includes that the current block does not use the intra prediction filtering mode, the second predetermined condition also includes that the current block does not use the intra prediction filtering mode. The first preset condition does not include that the current block does not use the intra prediction filtering mode, the second preset condition does not include that the current block does not use the intra prediction filtering mode, and the like.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, which may include, but is not limited to, at least one of: the chroma intra-frame prediction mode of the current block is not a TSCPM mode; the chroma intra prediction mode of the current block is not a PMC mode; the mode numbers of the chroma intra-prediction modes of the current block are from 0 to 4; the Chroma Intra prediction mode for the current block is not Intra _ Chroma _ PCM mode; the chroma intra prediction mode of the current block is not the DM mode.
For example, if the chroma intra prediction mode of the current block is not the TSCPM mode, or the chroma intra prediction mode of the current block is not the PMC mode, or the mode numbers of the chroma intra prediction modes of the current block are the mode numbers 0 to 4, it may be determined that the chroma intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode (or IPD _ IPCM mode), or the Chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode and the Chroma Intra prediction mode of the current block is not the TSCPM mode, it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Chroma Intra prediction mode of the current block is not the Intra _ Chroma _ PCM mode (or named Chroma IPD _ IPCM mode), it may be determined that the Chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode), or the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode) and the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
For another example, if the Luma Intra prediction mode of the current block is not the Intra _ Luma _ PCM mode (or named Luma IPD _ IPCM mode), and/or the chroma Intra prediction mode of the current block is not the DM mode, it may be determined that the chroma Intra prediction mode of the current block satisfies the preset mode condition.
For example, the chroma intra prediction mode of the current block satisfies the preset mode condition, see that the chroma intra prediction mode of the current block satisfies the preset mode condition in embodiment 1, which is not repeated herein.
In the above embodiment, the size of the chroma component of the current block satisfies the preset size condition, which may include but is not limited to at least one of the following: the width of the chrominance components is less than or equal to n1, and the height of the chrominance components is less than or equal to n2. The width of the chrominance component is equal to or less than n1, or the height of the chrominance component is equal to or less than n2. The width of the chrominance component is equal to or greater than n3, and the height of the chrominance component is equal to or greater than n4. The width of the chrominance component is equal to or greater than n3, or the height of the chrominance component is equal to or greater than n4. The product of the width and height of the chrominance components is greater than or equal to n5. The product of the width and height of the chrominance components is less than or equal to n6.
In the above embodiments, the control information allows the chroma components to use a quadratic transform, which may include, but is not limited to, one of: the sequence level control information allows the chroma components to use a quadratic transform. The picture parameter set level control information allows the chroma components to use a quadratic transform. The picture header level control information allows the chroma components to use a quadratic transform. The slice header level control information allows the chroma components to use a quadratic transform.
In a possible implementation manner, if the current block satisfies the second preset condition, the encoding end may further determine whether to perform secondary transformation on the chrominance component of the current block, for example, determine whether to perform secondary transformation on the chrominance component based on a cost value (e.g., a rate distortion cost value) of the chrominance component, where the specific determination manner refers to the following steps and is not described herein again.
Step 414, quantizing the target transform coefficient matrix corresponding to the chroma component to obtain a final transform coefficient matrix corresponding to the chroma component, and encoding a transform coefficient flag bit in the encoded bit stream of the current block, where the transform coefficient flag bit is used to indicate whether the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient.
Step 415, after the current block satisfies the second preset condition and determines whether to perform secondary transform on the chrominance component of the current block, a secondary transform flag of the chrominance component at the block level may also be encoded in the encoded bit stream of the current block. Illustratively, the secondary transform flag is used to indicate whether the chroma component is to be secondarily transformed or not.
In a possible embodiment, the chroma components of the current block are chroma U components and chroma V components, and the quadratic transformation flag may be a UV component common quadratic transformation flag, and when a value of the UV component common quadratic transformation flag is a first value, the quadratic transformation flag is used to indicate that the chroma U component and the chroma V component are simultaneously quadratic transformed, or when a value of the UV component common quadratic transformation flag is a second value, the quadratic transformation flag is used to indicate that neither the chroma U component nor the chroma V component is quadratic transformed. Based on this, in step 413, a first cost value when only the chrominance U component and the chrominance V component are initially transformed may be determined, and a second cost value when the chrominance U component and the chrominance V component are initially transformed and then secondarily transformed may be determined. And if the second generation value is greater than the first generation value, determining that neither the initial transformation coefficient matrix corresponding to the chrominance U component nor the initial transformation coefficient matrix corresponding to the chrominance V component is subjected to secondary transformation.
For example, if the second cost value is equal to the first cost value, it may be determined that neither the chrominance U component nor the chrominance V component is subjected to the secondary transform, or it may be determined that both the chrominance U component and the chrominance V component are subjected to the secondary transform at the same time.
In step 415, if it is determined that the chrominance U component and the chrominance V component are secondarily transformed at the same time, when the UV component encoded in the encoded bitstream of the current block shares the secondary transformation flag, the value of the UV component sharing the secondary transformation flag is the first value. And if the chroma U component and the chroma V component are determined not to be subjected to secondary transformation, when the UV component is coded in the coded bit stream of the current block and shares the secondary transformation zone bit, the value of the UV component sharing the secondary transformation zone bit is a second value.
In another possible implementation, the chrominance components of the current block are chrominance U components and chrominance V components, and the secondary transform flag includes a U-component secondary transform flag and a V-component secondary transform flag. And when the value of the U component secondary transformation zone bit is a first value, indicating that secondary transformation is carried out on the chrominance U component, or when the value of the U component secondary transformation zone bit is a second value, indicating that secondary transformation is not carried out on the chrominance U component. And when the value of the V component quadratic transformation zone bit is a first value, indicating to carry out quadratic transformation on the chrominance V component, or when the value of the V component quadratic transformation zone bit is a second value, indicating not to carry out quadratic transformation on the chrominance V component. Based on this, in step 413, the third cost value when only the initial transform is performed on the chrominance U component is determined, and the fourth cost value when the initial transform is performed first and then the secondary transform is performed on the chrominance U component is determined. If the fourth cost value is smaller than the third generation value, determining to carry out secondary transformation on the initial transformation coefficient matrix corresponding to the chromaticity U component; if the fourth cost value is larger than the third generation value, determining that the secondary transformation is not carried out on the initial transformation coefficient matrix corresponding to the chromaticity U component; and if the fourth cost value is equal to the third cost value, determining not to perform secondary transformation on the chroma U component or performing secondary transformation on the chroma U component. And determining a fifth cost value when only the initial transformation is carried out on the chrominance V component, and determining a sixth cost value when the initial transformation is firstly carried out on the chrominance V component and then the secondary transformation is carried out on the chrominance V component. If the sixth cost value is smaller than the fifth cost value, determining to carry out secondary transformation on an initial transformation coefficient matrix corresponding to the chromaticity V component; if the sixth cost value is greater than the fifth cost value, determining that the secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chromaticity V component; and if the sixth cost value is equal to the fifth cost value, determining that the chrominance V component is not subjected to secondary transformation or is subjected to secondary transformation.
In step 415, if it is determined that the chroma U component is secondarily transformed, the value of the U component secondary transformation flag is the first value when the U component secondary transformation flag is encoded in the encoded bitstream. And if the chroma U component is determined not to be secondarily transformed, the value of the U component secondary transformation zone bit is the second value when the U component secondary transformation zone bit is coded in the coded bit stream. If the secondary transformation of the chrominance V component is determined, the value of the secondary transformation zone bit of the V component is the first value when the secondary transformation zone bit of the V component is coded in the coded bit stream. And if the chroma V component is determined not to be secondarily transformed, the value of the V component secondary transformation zone bit is the second value when the V component secondary transformation zone bit is coded in the coded bit stream.
In a possible implementation manner, in step 415, the encoding end encodes a secondary transform flag in the encoded bitstream of the current block, which may include but is not limited to: the encoding end encodes the quadratic transformation zone bit by adopting a context-based binary arithmetic encoding mode; or, the encoding end adopts a bypass encoding mode to encode the secondary conversion flag bit.
For example, the encoding end encodes the quadratic transformation flag bit by using a context-based binary arithmetic coding method, which may include but is not limited to: the encoding end may select a target context model from at least two pre-configured context models based on a chroma intra prediction mode of the current block, and encode the secondary transform flag based on the target context model. Or, the encoding end may select a target context model from at least two context models configured in advance based on the size of the chrominance component of the current block, and encode the secondary transform flag based on the target context model.
According to the technical scheme, in the embodiment of the application, after the chroma components of the current block are subjected to initial transformation, whether the chroma components of the current block are subjected to secondary transformation can be determined, if yes, the chroma components of the current block can be subjected to secondary transformation, namely, the secondary transformation technology can also be applied to the chroma components of the current block, and when the chroma components are subjected to initial transformation and the problem of insufficient energy concentration exists, the chroma components can also be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
Example 4: in a possible implementation manner, referring to fig. 4B, a flowchart of an encoding method provided in an embodiment of the present application is shown, where the encoding method may be applied to an encoding end, and the encoding method may include the following steps:
step 421, obtaining a residual coefficient matrix corresponding to the chrominance component of the current block.
Step 422, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
And 423, if the current block meets the second preset condition, determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance components to obtain a target transformation coefficient matrix corresponding to the chrominance components.
For an exemplary implementation process of steps 421 to 423, refer to embodiment 3, and details are not repeated here.
Step 424, if it is determined that the initial transformation coefficient matrix corresponding to the chrominance component is transformed secondarily, the initial transformation coefficient matrix corresponding to the chrominance component is transformed secondarily to obtain a target transformation coefficient matrix corresponding to the chrominance component. And if the initial transformation coefficient matrix corresponding to the chrominance component is determined not to be subjected to secondary transformation, determining the initial transformation coefficient matrix corresponding to the chrominance component as a target transformation coefficient matrix corresponding to the chrominance component.
In a possible implementation, the initial transform coefficient matrix corresponding to the chrominance component may include an initial transform coefficient matrix corresponding to the chrominance U component and an initial transform coefficient matrix corresponding to the chrominance V component, and on the basis:
and if the secondary transformation zone bit is the UV component shared secondary transformation zone bit and the chrominance U component and the chrominance V component are subjected to secondary transformation simultaneously, carrying out secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain a target transformation coefficient matrix corresponding to the chrominance U component, and carrying out secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a target transformation coefficient matrix corresponding to the chrominance V component. Or, if the chroma U component and the chroma V component are not subjected to secondary transformation, determining the initial transformation coefficient matrix corresponding to the chroma U component as the target transformation coefficient matrix corresponding to the chroma U component, and determining the initial transformation coefficient matrix corresponding to the chroma V component as the target transformation coefficient matrix corresponding to the chroma V component.
If the secondary transformation flag bit is a U-component secondary transformation flag bit and a V-component secondary transformation flag bit, and the chroma U component is secondarily transformed, the initial transformation coefficient matrix corresponding to the chroma U component may be secondarily transformed to obtain a target transformation coefficient matrix corresponding to the chroma U component. If the chroma U component is not transformed twice, the initial transform coefficient matrix corresponding to the chroma U component may be determined as the target transform coefficient matrix corresponding to the chroma U component.
And if the chromaticity V component is subjected to secondary transformation, carrying out secondary transformation on the initial transformation coefficient matrix corresponding to the chromaticity V component to obtain a target transformation coefficient matrix corresponding to the chromaticity V component. And if the chroma V component is not subjected to secondary transformation, determining the initial transformation coefficient matrix corresponding to the chroma V component as a target transformation coefficient matrix corresponding to the chroma V component.
In a possible embodiment, the performing the quadratic transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain the target transformation coefficient matrix corresponding to the chrominance component (for example, performing the quadratic transformation on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain the target transformation coefficient matrix corresponding to the chrominance U component, or performing the quadratic transformation on the initial transformation coefficient matrix corresponding to the chrominance V component to obtain the target transformation coefficient matrix corresponding to the chrominance V component) may include, but is not limited to:
In case 1, if the width of the chrominance component is greater than a preset threshold, or the height of the chrominance component is greater than a preset threshold, determining a coefficient matrix based on a transform coefficient of a designated area located at the upper left corner in the initial transform coefficient matrix; performing vertical transformation on the coefficient matrix to obtain a vertical transformation matrix; horizontally transforming the vertical transformation matrix to obtain a horizontal transformation matrix; and updating the transformation coefficient of the designated area positioned at the upper left corner in the initial transformation coefficient matrix based on the horizontal transformation matrix to obtain the target transformation coefficient matrix. For example, the preset threshold may be empirically configured, such as 4, etc., and the specified region at the upper left corner may be empirically configured, such as a sub-region of 4 × 4 located at the upper left corner in the target transform coefficient matrix.
Case 2, if the width of the chrominance component is greater than a preset threshold, or the height of the chrominance component is greater than a preset threshold, determining a coefficient matrix based on the transform coefficient of the designated area located at the upper left corner in the initial transform coefficient matrix; if the mode number of the chroma intra-frame prediction mode of the current block is positioned in the first mode number interval, performing horizontal transformation on the coefficient matrix to obtain a horizontal transformation matrix; and if the mode number of the chroma intra-frame prediction mode of the current block is positioned in the second mode number interval, performing vertical transformation on the coefficient matrix to obtain a vertical transformation matrix. If only the coefficient matrix is subjected to horizontal transformation, updating the transformation coefficient of the designated area positioned at the upper left corner in the initial transformation coefficient matrix based on the horizontal transformation matrix to obtain the target transformation coefficient matrix; and if only the coefficient matrix is vertically transformed, updating the transformation coefficient of the designated area positioned at the upper left corner in the initial transformation coefficient matrix based on the vertical transformation matrix to obtain the target transformation coefficient matrix.
The first mode number section includes mode numbers 0 to 2, 4 to 6, 8 to 9, 11 to 12, and 14 to 15, and the second mode number section includes mode numbers 0 to 1, 3 to 5, 7 to 8, 10 to 11, 13 to 14, and 16. If the mode number of the chroma intra prediction mode is 0-2, or 4-6, or 8-9, or 11-12, or 14-15, the mode number of the chroma intra prediction mode is located in the first mode number interval. If the mode number of the chroma intra prediction mode is 0 to 1, or 3 to 5, or 7 to 8, or 10 to 11, or 13 to 14, or 16, the mode number of the chroma intra prediction mode is located in the second mode number section.
For example, if the mode number of the chroma intra prediction mode of the current block is located in both the first mode number interval and the second mode number interval, the coefficient matrix may be vertically transformed to obtain a vertical transformation matrix; then, the vertical transformation matrix is horizontally transformed to obtain a horizontal transformation matrix. On this basis, the coefficient matrix is subjected to vertical transformation and then horizontal transformation, so that the transformation coefficients of the designated area positioned at the upper left corner in the initial transformation coefficient matrix can be updated based on the horizontal transformation matrix after horizontal transformation, and the target transformation coefficient matrix is obtained.
Case 3, if the width of the chrominance component is equal to a preset threshold value and the height of the chrominance component is equal to a preset threshold value, performing horizontal transformation on the initial transformation coefficient matrix to obtain a horizontal transformation matrix; performing vertical transformation on the horizontal transformation matrix to obtain a vertical transformation matrix; the target transform coefficient matrix is determined based on the vertical transform matrix.
In summary, based on the cases 1, 2, and 3, if the preset threshold is 4 and the designated region is a sub-region of 4 × 4 at the top left corner, in the process of performing secondary transformation on the chroma components, if the value of the width or height of the initial transform coefficient matrix is greater than 4, the coefficient matrix at the top left corner 4 × 4 is subjected to secondary transformation, and if the value of the width and height of the initial transform coefficient matrix are both 4, the initial transform coefficient matrix is subjected to secondary transformation, which is not described again.
In summary, in step 424, the target transform coefficient matrix corresponding to the chrominance component, that is, the target transform coefficient matrix corresponding to the chrominance U component and the target transform coefficient matrix corresponding to the chrominance V component, may be obtained.
Step 425 quantizes the target transform coefficient matrix corresponding to the chroma component to obtain a final transform coefficient matrix corresponding to the chroma component, and encodes a transform coefficient flag in the encoded bitstream of the current block, where the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient.
For example, after the final transform coefficient matrix corresponding to the chroma component is obtained, the final transform coefficient matrix corresponding to the chroma component may be encoded in the encoded bit stream of the current block, which is not limited to this encoding process.
For example, if the flag bit of the transform coefficient is the first value, it indicates that the final transform coefficient matrix corresponding to the chroma component of the current block contains a non-zero transform coefficient. Or, if the flag bit of the transform coefficient is the second value, it indicates that the final transform coefficient matrix corresponding to the chroma component of the current block does not contain a non-zero transform coefficient. For example, the transform coefficient flag may include a chrominance U component transform coefficient flag and a chrominance V component transform coefficient flag. When the value of the chroma U component transform coefficient flag bit is the first value, the value can be used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient; when the value of the chroma U component transform coefficient flag is the second value, it may be used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block does not contain a non-zero transform coefficient. In addition, when the value of the chroma V component transform coefficient flag is the first value, the value may be used to indicate that a final transform coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transform coefficient; when the value of the chroma V component transform coefficient flag is the second value, it may be used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block does not contain a non-zero transform coefficient.
In step 426, a secondary transform flag indicating that the chroma components of the current block are to be secondarily transformed or that the chroma components of the current block are not to be secondarily transformed is encoded in the encoded bitstream of the current block.
For example, before encoding the secondary transform flag in the encoded bitstream of the current block, it may be determined whether the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and if the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, the secondary transform flag is encoded in the encoded bitstream of the current block. And if the final transform coefficient matrix corresponding to the chrominance component does not contain the non-zero transform coefficient, the secondary transform flag bit is not coded in the coded bit stream of the current block.
For example, for an application scenario in which the UV components share the secondary transform flag, if the final transform coefficient matrix corresponding to the chrominance U component contains a non-zero transform coefficient and/or the final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient, the UV components share the secondary transform flag in the encoded bitstream. If the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient, and the final transform coefficient matrix corresponding to the chroma V component does not contain a non-zero transform coefficient, the UV component is not coded in the coded bit stream to share the secondary transform flag bit.
For example, for an application scenario in which the U component secondary transform flag and the V component secondary transform flag are applied, if a non-zero transform coefficient is included in the final transform coefficient matrix corresponding to the chrominance U component, the U component secondary transform flag is encoded in the encoded bitstream, and if a non-zero transform coefficient is not included in the final transform coefficient matrix corresponding to the chrominance U component, the U component secondary transform flag is not encoded in the encoded bitstream. If the final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient, encoding a V component secondary transform flag bit in the encoded bit stream, and if the final transform coefficient matrix corresponding to the chroma V component does not contain a non-zero transform coefficient, not encoding a V component secondary transform flag bit in the encoded bit stream.
According to the technical scheme, after the chroma components of the current block are subjected to initial transformation, whether the chroma components of the current block are subjected to secondary transformation can be determined, if yes, the chroma components of the current block can be subjected to secondary transformation, namely, the secondary transformation technology can also be applied to the chroma components of the current block, and when the chroma components are subjected to initial transformation and the energy is not concentrated enough, the chroma components can also be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
In the above embodiments 1 to 4, 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.
Example 5: in a possible implementation manner, referring to fig. 5A, which is a schematic flow chart of a decoding method proposed in an embodiment of the present application, the decoding method may be applied to a decoding end, and the decoding method may include the following steps:
step 511, obtaining the encoded bit stream of the current block, and parsing the luma component transform coefficient flag, the chroma U component transform coefficient flag, and the chroma V component transform coefficient flag from the encoded bit stream.
Illustratively, the luma component transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the luma component contains a non-zero transform coefficient, the chroma U component transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient, and the chroma V component transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient.
For example, if the value of the flag bit of the luminance component transform coefficient is the first value, it is determined that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient. And if the value of the flag bit of the luminance component transformation coefficient is the second value, determining that the final transformation coefficient matrix corresponding to the luminance component does not contain a non-zero transformation coefficient. And if the value of the flag bit of the chrominance U component transformation coefficient is the first value, determining that the final transformation coefficient matrix corresponding to the chrominance U component contains a non-zero transformation coefficient. And if the value of the chroma U component transformation coefficient zone bit is the second value, determining that the final transformation coefficient matrix corresponding to the chroma U component does not contain a non-zero transformation coefficient. And if the value of the chroma V component transformation coefficient zone bit is the first value, determining that the final transformation coefficient matrix corresponding to the chroma V component contains a non-zero transformation coefficient. And if the value of the flag bit of the chrominance V component transformation coefficient is the second value, determining that the final transformation coefficient matrix corresponding to the chrominance V component does not contain a non-zero transformation coefficient.
And step 512, if the current block meets a third preset condition, analyzing a block-level luminance and chrominance secondary transformation flag bit from the coded bit stream, wherein the luminance and chrominance secondary transformation flag bit is a luminance component, and the chrominance U component and the chrominance V component share the secondary transformation flag bit.
Step 513, if the final transform coefficient matrix includes a non-zero transform coefficient (for example, at least one of the final transform coefficient matrix corresponding to the luminance component, the final transform coefficient matrix corresponding to the chrominance U component, and the final transform coefficient matrix corresponding to the chrominance V component includes a non-zero transform coefficient), then the final transform coefficient matrix corresponding to the luminance component, the final transform coefficient matrix corresponding to the chrominance U component, and the final transform coefficient matrix corresponding to the chrominance V component are parsed from the encoded bitstream. And performing inverse quantization on the final transformation coefficient matrix corresponding to the brightness component to obtain a target transformation coefficient matrix corresponding to the brightness component, performing inverse quantization on the final transformation coefficient matrix corresponding to the chromaticity U component to obtain a target transformation coefficient matrix corresponding to the chromaticity U component, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chromaticity V component to obtain a target transformation coefficient matrix corresponding to the chromaticity V component.
And step 514, determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the luminance component, the target transformation coefficient matrix corresponding to the chrominance U component and the target transformation coefficient matrix corresponding to the chrominance V component according to the luminance and chrominance secondary transformation flag bit, that is, performing secondary inverse transformation simultaneously or not performing secondary inverse transformation.
For example, the decoding end may determine whether the current block satisfies a third preset condition, and if the current block does not satisfy the third preset condition, the decoding end determines that the second inverse transform is not performed on the target transform coefficient matrix corresponding to the luminance component, the target transform coefficient matrix corresponding to the chrominance U component, and the target transform coefficient matrix corresponding to the chrominance V component. If the current block meets the third preset condition, the decoding end analyzes the secondary conversion flag bit of the brightness and the chroma from the coded bit stream of the current block. If the value of the luminance and chrominance secondary transformation flag bit is the first value, the decoding end determines that secondary inverse transformation is simultaneously carried out on a target transformation coefficient matrix corresponding to the luminance component, a target transformation coefficient matrix corresponding to the chrominance U component and a target transformation coefficient matrix corresponding to the chrominance V component of the current block. If the value of the luminance-chrominance quadratic transformation flag bit is the second value, the decoding end determines that the target transformation coefficient matrix corresponding to the luminance component, the target transformation coefficient matrix corresponding to the chrominance U component and the target transformation coefficient matrix corresponding to the chrominance V component of the current block are not subjected to quadratic inverse transformation.
In a possible implementation, the third preset condition may include at least: the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients. The transform coefficient flag bit is used for indicating that the final transform coefficient matrix contains a non-zero transform coefficient, and includes at least one of the following conditions: the luminance component transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient, for example, the value of the luminance component transform coefficient flag is the first value. The chroma U component transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient, for example, the value of the chroma U component transform coefficient flag is a first value. The chroma V component transform coefficient flag is used to indicate that the transform final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient, for example, the value of the chroma V component transform coefficient flag is the first value.
In summary, if it is determined that the prediction mode of the current block is the intra-frame prediction mode and the flag of the transform coefficient is used to indicate that the final transform coefficient matrix contains a non-zero transform coefficient (e.g., at least one of the flag of the luma component transform coefficient, the flag of the chroma U component transform coefficient, and the flag of the chroma V component transform coefficient is the first value), the decoding end determines that the current block satisfies the third predetermined condition. Otherwise, the decoding end determines that the current block does not satisfy the third preset condition.
In a possible embodiment, in addition to that the prediction mode of the current block is intra-prediction mode, the transform coefficient flag bit is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients, and the third predetermined condition may include, but is not limited to, at least one of the following: the current block does not use the intra prediction filtering mode; the current block does not use the DT splitting mode; the current block does not use the improved intra prediction mode; the current block adopts a transformation check (DCT 2 ) to carry out initial inverse transformation; the chroma intra-frame prediction mode of the current block meets the preset mode condition; the size of the current block meets a preset size condition; the control information allows the use of a quadratic inverse transform. For example, the third preset condition may include any combination of all the above conditions, and is not limited thereto.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, which can be referred to as embodiment 1, and will not be repeated herein. The size of the current block satisfies the predetermined size condition, which can be seen in embodiment 1, and will not be described again. The control information allows the use of the second inverse transform, which can be seen in embodiment 1 and will not be repeated herein.
In one possible embodiment, the decoding end parses the chroma secondary transform flag from the coded bitstream, which may include but is not limited to: a decoding end analyzes the secondary conversion flag bit of the brightness and the chroma from the coded bit stream by adopting a context-based binary arithmetic decoding mode; or, the decoding end adopts a bypass decoding mode to analyze the secondary conversion flag bit of the brightness and the chroma from the coded bit stream.
The decoding end analyzes the secondary luminance and chrominance transformation flag bit from the coded bit stream by using a context-based binary arithmetic decoding mode, which may include but is not limited to: and the decoding end selects a target context model from at least two pre-configured context models based on the chroma intra-frame prediction mode of the current block, and analyzes a luma secondary transformation flag from the coded bit stream based on the target context model. Alternatively, the decoding end selects a target context model from at least two context models configured in advance based on the size of the chrominance component, and parses a luminance secondary transform flag from the encoded bitstream based on the target context model.
Illustratively, if the luminance component, the chrominance U component, and the chrominance V component of the current block are subjected to inverse transform twice at the same time, the target transform coefficient matrix corresponding to the luminance component is subjected to inverse transform twice to obtain an initial transform coefficient matrix corresponding to the luminance component, the target transform coefficient matrix corresponding to the chrominance U component is subjected to inverse transform twice to obtain an initial transform coefficient matrix corresponding to the chrominance U component, and the target transform coefficient matrix corresponding to the chrominance V component is subjected to inverse transform twice to obtain an initial transform coefficient matrix corresponding to the chrominance V component. If the secondary inverse transformation is not performed on the luminance component, the chrominance U component and the chrominance V component of the current block, determining a target transformation coefficient matrix corresponding to the luminance component as an initial transformation coefficient matrix corresponding to the luminance component, determining a target transformation coefficient matrix corresponding to the chrominance U component as an initial transformation coefficient matrix corresponding to the chrominance U component, and determining a target transformation coefficient matrix corresponding to the chrominance V component as an initial transformation coefficient matrix corresponding to the chrominance V component.
In a possible implementation manner, a process of performing a secondary inverse transform on a target transform coefficient matrix corresponding to a chrominance component (e.g., a chrominance U component and a chrominance V component) to obtain an initial transform coefficient matrix corresponding to the chrominance component may refer to step 325, which is not described herein again. The process of performing inverse transformation on the target transform coefficient matrix corresponding to the luminance component twice to obtain the initial transform coefficient matrix corresponding to the luminance component may include, but is not limited to: if the width of the brightness component is larger than a preset threshold value or the height of the brightness component is larger than a preset threshold value, determining a coefficient matrix based on a transformation coefficient of a specified area positioned at the upper left corner in the target transformation coefficient matrix; performing horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; carrying out vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; and updating the transformation coefficient of the designated area positioned at the upper left corner in the target transformation coefficient matrix based on the vertical inverse transformation matrix to obtain the initial transformation coefficient matrix.
Or if the width of the brightness component is equal to a preset threshold and the height of the brightness component is equal to a preset threshold, performing vertical inverse transformation on the target transformation coefficient matrix to obtain a vertical inverse transformation matrix; performing horizontal inverse transformation on the vertical inverse transformation matrix to obtain a horizontal inverse transformation matrix; the initial transform coefficient matrix is determined based on the horizontal inverse transform matrix.
Exemplarily, the initial inverse transform may be performed on the initial transform coefficient matrix corresponding to the luminance component to obtain a residual coefficient matrix corresponding to the luminance component; performing initial inverse transformation on an initial transformation coefficient matrix corresponding to the chromaticity U component to obtain a residual error coefficient matrix corresponding to the chromaticity U component; and performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a residual error coefficient matrix corresponding to the chrominance V component. The description of the initial inverse transformation is not repeated herein.
For example, the reconstructed value of the luma component may be determined according to a residual coefficient matrix corresponding to the luma component, the reconstructed value of the chroma U component may be determined according to a residual coefficient matrix corresponding to the chroma U component, and the reconstructed value of the chroma V component may be determined according to a residual coefficient matrix corresponding to the chroma V component. To this end, the decoding end may determine the reconstructed value of the current block based on the reconstructed value of the luminance component, the reconstructed value of the chrominance U component, and the reconstructed value of the chrominance V component, that is, complete the decoding process of the current block.
According to the technical scheme, after the luminance component and the chrominance component of the current block are subjected to initial transformation, whether the luminance component and the chrominance component of the current block are subjected to secondary transformation can be determined, namely, the secondary transformation technology can be simultaneously applied to the luminance component and the chrominance component of the current block, and when the luminance component and the chrominance component have the problem of insufficient energy concentration after the luminance component and the chrominance component are subjected to initial transformation, the luminance component and the chrominance component can be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
Example 6: in a possible implementation manner, referring to fig. 5B, a flowchart of an encoding method provided in an embodiment of the present application is shown, where the encoding method may be applied to an encoding end, and the encoding method may include the following steps:
step 521, obtaining a residual coefficient matrix corresponding to the luminance component of the current block, a residual coefficient matrix corresponding to the chrominance U component of the current block, and a residual coefficient matrix corresponding to the chrominance V component of the current block.
522, performing initial transformation on the residual coefficient matrix corresponding to the brightness component to obtain an initial transformation coefficient matrix corresponding to the brightness component; carrying out initial transformation on a residual coefficient matrix corresponding to the chroma U component to obtain an initial transformation coefficient matrix corresponding to the chroma U component; and carrying out initial transformation on the residual coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component. The implementation of the initial transformation is not repeated here.
Step 523, if the current block satisfies the fourth preset condition, it is determined whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component of the current block, that is, perform secondary transformation simultaneously, or not perform secondary transformation.
For example, the encoding end may determine whether the current block satisfies a fourth preset condition, and if the current block does not satisfy the fourth preset condition, the encoding end may determine that no secondary transform is performed on the initial transform coefficient matrix corresponding to the luminance component, the initial transform coefficient matrix corresponding to the chrominance U component, and the initial transform coefficient matrix corresponding to the chrominance V component of the current block. If the current block meets the fourth preset condition, the encoding end may further determine whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component of the current block based on the cost value (e.g., rate-distortion cost value) of the current block.
In a possible implementation, the fourth preset condition may include at least: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix contains non-zero transformation coefficients. The initial transform coefficient matrix contains non-zero transform coefficients, and at least one of the following conditions is included: the transformation coefficient matrix corresponding to the brightness component contains non-zero transformation coefficients; the transformation coefficient matrix corresponding to the chroma U component contains non-zero transformation coefficients; the transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients. In summary, if it is determined that the prediction mode of the current block is the intra prediction mode and the initial transform coefficient matrix contains the non-zero transform coefficient, it is determined that the current block satisfies the fourth predetermined condition. And if the prediction mode of the current block is determined not to be the intra-frame prediction mode and/or the initial transformation coefficient matrix does not contain the non-zero transformation coefficient, determining that the current block does not meet the fourth preset condition.
In a possible embodiment, in addition to that the prediction mode of the current block is an intra prediction mode, and the initial transform coefficient matrix contains non-zero transform coefficients, the fourth predetermined condition may include, but is not limited to, at least one of the following: the current block does not use the intra prediction filtering mode; the current block does not use the DT splitting mode; the current block does not use the improved intra prediction mode; the current block adopts a transformation check (DCT 2 ) to carry out initial transformation; the chroma intra-frame prediction mode of the current block meets the preset mode condition; the size of the current block meets a preset size condition; the control information allows the use of quadratic transforms. For example, the fourth preset condition needs to match the third preset condition, for example, when the third preset condition includes that the current block does not use the intra prediction filtering mode, the fourth preset condition also includes that the current block does not use the intra prediction filtering mode. The third preset condition does not include that the current block does not use the intra prediction filtering mode, and the fourth preset condition does not include that the current block does not use the intra prediction filtering mode.
For example, the chroma intra prediction mode of the current block satisfies the preset mode condition, the size of the current block satisfies the preset size condition, and the control information allows the secondary transform to be used, which may be referred to as embodiment 3 and is not repeated herein.
Step 524, if it is determined that the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component are transformed secondarily, the initial transformation coefficient matrix corresponding to the luminance component is transformed secondarily to obtain a target transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component is transformed secondarily to obtain a target transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component is transformed secondarily to obtain a target transformation coefficient matrix corresponding to the chrominance V component. If the initial transformation coefficient matrix corresponding to the brightness component, the initial transformation coefficient matrix corresponding to the chroma U component and the initial transformation coefficient matrix corresponding to the chroma V component are determined not to be subjected to secondary transformation, the initial transformation coefficient matrix corresponding to the brightness component is determined as a target transformation coefficient matrix corresponding to the brightness component, the initial transformation coefficient matrix corresponding to the chroma U component is determined as a target transformation coefficient matrix corresponding to the chroma U component, and the initial transformation coefficient matrix corresponding to the chroma V component is determined as a target transformation coefficient matrix corresponding to the chroma V component.
For an exemplary process of performing secondary transformation on the initial transform coefficient matrix corresponding to the chrominance components (e.g., the chrominance U component and the chrominance V component) to obtain the target transform coefficient matrix corresponding to the chrominance components, refer to step 424, which is not described herein again. The process of performing secondary transformation on the initial transformation coefficient matrix corresponding to the luminance component to obtain the target transformation coefficient matrix corresponding to the luminance component may include, but is not limited to: if the width of the brightness component is larger than a preset threshold value, or the height of the brightness component is larger than a preset threshold value, determining a coefficient matrix based on the transformation coefficient of the designated area positioned at the upper left corner in the initial transformation coefficient matrix; performing vertical transformation on the coefficient matrix to obtain a vertical transformation matrix; horizontally converting the vertical conversion matrix to obtain a horizontal conversion matrix; and updating the transformation coefficient of the designated area positioned at the upper left corner in the initial transformation coefficient matrix based on the horizontal transformation matrix to obtain the target transformation coefficient matrix. Or, if the width of the brightness component is equal to a preset threshold and the height of the brightness component is equal to the preset threshold, performing horizontal transformation on the initial transformation coefficient matrix to obtain a horizontal transformation matrix; performing vertical transformation on the horizontal transformation matrix to obtain a vertical transformation matrix; the target transform coefficient matrix is determined based on the vertical transform matrix.
And step 525, quantizing the target transformation coefficient matrix corresponding to the brightness component to obtain a final transformation coefficient matrix corresponding to the brightness component, quantizing the target transformation coefficient matrix corresponding to the chromaticity U component to obtain a final transformation coefficient matrix corresponding to the chromaticity U component, and quantizing the target transformation coefficient matrix corresponding to the chromaticity V component to obtain a final transformation coefficient matrix corresponding to the chromaticity V component. And coding the final transformation coefficient matrix corresponding to the brightness component, the final transformation coefficient matrix corresponding to the chroma U component and the final transformation coefficient matrix corresponding to the chroma V component to obtain a coded bit stream. And encoding a luminance component transform coefficient flag, a chrominance U component transform coefficient flag, and a chrominance V component transform coefficient flag in the encoded bitstream. The luminance component transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to the luminance component contains a non-zero transformation coefficient or not, the chrominance U component transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to the chrominance U component contains a non-zero transformation coefficient or not, and the chrominance V component transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to the chrominance V component contains a non-zero transformation coefficient or not.
Step 526, encoding a luma secondary transform flag of a block level in the encoded bitstream of the current block, where the luma secondary transform flag is a secondary transform flag shared by the luma component and the chroma U component and the chroma V component.
Illustratively, when the value of the luminance-chrominance quadratic transformation flag is a first value, the flag is used to indicate that the luminance component, the chrominance U component and the chrominance V component are subjected to inverse transformation twice at the same time, or when the value of the luminance-chrominance quadratic transformation flag is a second value, the flag is used to indicate that neither the luminance component, the chrominance U component nor the chrominance V component are subjected to inverse transformation twice.
In step 523, a seventh cost value when only the luminance component, the chrominance U component, and the chrominance V component are initially transformed is determined, and an eighth cost value when the luminance component, the chrominance U component, and the chrominance V component are initially transformed and then secondarily transformed is determined. And if the eighth cost value is greater than the seventh cost value, determining that the secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component. If the eighth cost value is equal to the seventh cost value, determining that the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component are subjected to secondary transformation at the same time, or not performing secondary transformation on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component.
In step 526, if it is determined that the initial transform coefficient matrix corresponding to the luminance component, the initial transform coefficient matrix corresponding to the chrominance U component, and the initial transform coefficient matrix corresponding to the chrominance V component are transformed twice at the same time, a luminance and chrominance secondary transform flag is encoded in the encoded bitstream of the current block, and the value of the luminance and chrominance secondary transform flag is the first value. If the initial transformation coefficient matrix corresponding to the brightness component, the initial transformation coefficient matrix corresponding to the chroma U component and the initial transformation coefficient matrix corresponding to the chroma V component are determined not to be subjected to secondary transformation, a bright chroma secondary transformation zone bit is coded in the coded bit stream of the current block, and the value of the bright chroma secondary transformation zone bit is a second value.
In one possible implementation, the encoding end encodes the luma dct flag in the encoded bitstream of the current block, which may include but is not limited to: the encoding end encodes the secondary conversion zone bit of the brightness and the chroma by adopting a context-based binary arithmetic encoding mode; or, the encoding end adopts a bypass encoding mode to encode the secondary conversion zone bit of the brightness and the chroma.
The encoding end encodes the luma and chroma quadratic transform flag bits by using a context-based binary arithmetic coding method, which may include but is not limited to: the encoding end may select a target context model from at least two pre-configured context models based on the chroma intra prediction mode of the current block, and encode the luma secondary transform flag based on the target context model. Or, the encoding end may select a target context model from at least two pre-configured context models based on the size of the chroma component of the current block, and encode the luma secondary transform flag based on the target context model.
In a possible implementation manner, before step 526, it may be further determined whether the final transform coefficient matrix contains a non-zero transform coefficient, and if at least one of the final transform coefficient matrices includes a non-zero transform coefficient, the luminance component corresponding to the final transform coefficient matrix, the chrominance U component corresponding to the final transform coefficient matrix, and the chrominance V component corresponding to the final transform coefficient matrix, the bright chrominance secondary transform flag is encoded in the encoded bitstream of the current block. And if the final transform coefficient matrix corresponding to the brightness component, the final transform coefficient matrix corresponding to the chrominance U component and the final transform coefficient matrix corresponding to the chrominance V component do not contain non-zero transform coefficients, the secondary transform flag bit of the brightness and the chrominance is not coded in the coded bit stream of the current block.
According to the technical scheme, after the luminance component and the chrominance component of the current block are subjected to initial transformation, whether secondary transformation is performed on the luminance component and the chrominance component of the current block can be determined, namely, the secondary transformation technology can be simultaneously applied to the luminance component and the chrominance component of the current block, and when the luminance component and the chrominance component have the problem of insufficient energy concentration after the initial transformation, the luminance component and the chrominance component can be subjected to secondary transformation, so that the coding performance and the coding efficiency are improved.
In the above embodiments 5 and 6, 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.
Example 7: the embodiment of the application provides a quadratic transformation method, and a decoding process of a decoding end comprises the following steps: if the current block satisfies the parsing condition (i.e., the first predetermined condition), the secondary transform flag is parsed from the encoded bitstream of the current block. When the secondary transformation flag bit is equal to 0 (the second value is represented by 0), it indicates that the chroma component is not subjected to secondary inverse transformation, and when the secondary transformation flag bit is equal to 1 (the first value is represented by 1), it indicates that the chroma component is subjected to secondary inverse transformation. Illustratively, if the chroma component is subjected to secondary inverse transformation, secondary inverse transformation is performed on a region at the upper left corner 4 × 4 of a target transformation coefficient matrix of the chroma component, the transformation coefficient of the region at the upper left corner 4 × 4 is updated to obtain an initial transformation coefficient matrix, and then initial inverse transformation is performed on the initial transformation coefficient matrix to obtain a residual coefficient matrix. If the chroma component does not carry out secondary inverse transformation, the initial inverse transformation is directly carried out on the target transformation coefficient matrix (namely the target transformation coefficient matrix is used as the initial transformation coefficient matrix) to obtain a residual error coefficient matrix. Then, a reconstructed block is determined based on the residual coefficient matrix (i.e., the residual block), e.g., the residual block is added to the predicted block to obtain the reconstructed block.
Illustratively, the parsing conditions may include: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient. For example, ctp _ u is 1 or ctp _ v is 1.ctp _ U is a chroma U component transform coefficient flag, and ctp _ U is 1, which indicates that a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient. ctp _ V is a chroma V component transform coefficient flag, and ctp _ V is 1, which indicates that a final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient.
The encoding process of the encoding end comprises the following steps: if the current block meets the analysis condition (namely a second preset condition), the encoding end decides whether the chrominance component of the current block is subjected to secondary transformation or not through RDO, if the chrominance component is decided not to be subjected to secondary transformation, the initial transformation is directly performed on a residual coefficient matrix (namely a residual block) to obtain an initial transformation coefficient matrix, the initial transformation coefficient matrix is quantized to obtain a final transformation coefficient matrix, the final transformation coefficient matrix is encoded in the encoding bit stream of the current block, and a secondary transformation flag bit is encoded in the encoding bit stream to be equal to 0 so as to represent that no secondary transformation is performed. If the decision chrominance component is subjected to secondary transformation, the residual coefficient matrix is subjected to initial transformation to obtain an initial transformation coefficient matrix, the transformation coefficient of the upper left corner 4 x 4 of the initial transformation coefficient matrix is subjected to secondary transformation to obtain a target transformation coefficient matrix after secondary transformation, the target transformation coefficient matrix is quantized to obtain a final transformation coefficient matrix, the final transformation coefficient matrix is coded in the coded bit stream of the current block, and a secondary transformation flag bit is coded in the coded bit stream to be equal to 1 so as to represent that secondary transformation is carried out. Illustratively, the parsing conditions may include: the prediction mode of the current block is an intra-frame prediction mode, and a final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient.
Example 8: the chrominance U component and the chrominance V component share a secondary transformation flag bit, the secondary transformation flag bit can be a UV component shared secondary transformation flag bit, the UV component shared secondary transformation flag bit is marked as st _ chroma _ flag, and the st _ chroma _ flag can also be named as Stchroma flag.
The decoding flow of the decoding end comprises the following steps: if the current block satisfies the parsing condition 1 (i.e., a first preset condition), the st _ chroma _ flag is parsed from the encoded bitstream of the current block. And when the st _ chroma _ flag is equal to 0, the secondary inverse transformation is not carried out on the chroma U component and the chroma V component, and when the st _ chroma _ flag is equal to 1, the secondary inverse transformation is carried out on the chroma U component and the chroma V component at the same time. Illustratively, if the chrominance U component and the chrominance V component are subjected to secondary inverse transformation simultaneously, secondary inverse transformation is performed on a region 4 × 4 at the upper left corner of a target transformation coefficient matrix corresponding to the chrominance U component, and a transformation coefficient of the region 4 × 4 at the upper left corner is updated to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, and then initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain a residual error coefficient matrix corresponding to the chrominance U component. And performing secondary inverse transformation on a 4 x 4 region at the upper left corner of a target transformation coefficient matrix corresponding to the chromaticity V component, updating the transformation coefficient of the 4 x 4 region at the upper left corner to obtain an initial transformation coefficient matrix corresponding to the chromaticity V component, and performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chromaticity V component to obtain a residual error coefficient matrix corresponding to the chromaticity V component. And if the chrominance U component and the chrominance V component are not subjected to secondary inverse transformation, directly performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chrominance U component to obtain a residual error coefficient matrix corresponding to the chrominance U component, and performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chrominance V component to obtain a residual error coefficient matrix corresponding to the chrominance V component. Then, a reconstructed block is determined based on a residual coefficient matrix (i.e., a residual block) corresponding to the chrominance U component and a residual coefficient matrix corresponding to the chrominance V component, for example, a reconstructed block corresponding to the chrominance U component can be obtained by adding the residual block corresponding to the chrominance U component to the prediction block, and a reconstructed block corresponding to the chrominance V component can be obtained by adding the residual block corresponding to the chrominance V component to the prediction block.
For example, the analysis condition 1 may refer to the first preset condition of embodiment 1, and is not described herein again.
The encoding process of the encoding end comprises the following steps: if the current block meets the analysis condition 2, the encoding end does not perform secondary transformation on the chrominance U component and the chrominance V component of the current block through RDO decision, or performs secondary transformation on the chrominance U component and the chrominance V component of the current block at the same time. If the decision is made not to perform secondary transformation on the chrominance U component and the chrominance V component, the initial transformation is directly performed on a residual coefficient matrix (namely a residual block) corresponding to the chrominance U component to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance U component is quantized to obtain a final transformation coefficient matrix corresponding to the chrominance U component. And carrying out initial transformation on a residual coefficient matrix (namely a residual block) corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component, and quantizing the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a final transformation coefficient matrix corresponding to the chrominance V component. And coding a final transform coefficient matrix corresponding to the chroma U component and a final transform coefficient matrix corresponding to the chroma V component in the coded bit stream of the current block, wherein st _ chroma _ flag is coded to be equal to 0 in the coded bit stream.
If the chroma U component and the chroma V component are secondarily transformed at the same time, a residual coefficient matrix corresponding to the chroma U component is initially transformed to obtain an initial transformation coefficient matrix corresponding to the chroma U component, transformation coefficients of the upper left corner 4 x 4 of the initial transformation coefficient matrix corresponding to the chroma U component are secondarily transformed to obtain a target transformation coefficient matrix corresponding to the chroma U component, and the target transformation coefficient matrix corresponding to the chroma U component is quantized to obtain a final transformation coefficient matrix corresponding to the chroma U component. And carrying out secondary transformation on the transformation coefficient of 4 x 4 at the upper left corner of the initial transformation coefficient matrix corresponding to the chromaticity V component to obtain a target transformation coefficient matrix corresponding to the chromaticity V component, and quantizing the target transformation coefficient matrix corresponding to the chromaticity V component to obtain a final transformation coefficient matrix corresponding to the chromaticity V component. And coding a final transformation coefficient matrix corresponding to the chroma U component and a final transformation coefficient matrix corresponding to the chroma V component in the coded bit stream, wherein st _ chroma _ flag is equal to 1 in the coded bit stream.
For example, the resolving condition 2 may refer to the second preset condition of embodiment 3, and is not described herein again.
Example 9: the chroma U component and the chroma V component share a secondary transform flag, which may be a UV component shared secondary transform flag, and the UV component shared secondary transform flag is denoted as st _ chroma _ flag.
The decoding flow of the decoding end comprises the following steps: analyzing transform coefficient flag bits ctp _ U and ctp _ V of the current block, where ctp _ U indicates whether a final transform coefficient matrix corresponding to a chroma U component of the current block includes a non-zero transform coefficient, ctp _ V indicates whether a final transform coefficient matrix corresponding to a chroma V component of the current block includes a non-zero transform coefficient, e.g., ctp _ U =0 indicates that a final transform coefficient matrix corresponding to a chroma U component of the current block does not include a non-zero transform coefficient, ctp _ U =1 indicates that a final transform coefficient matrix corresponding to a chroma U component of the current block includes a non-zero transform coefficient, ctp _ V =0 indicates that a final transform coefficient matrix corresponding to a chroma V component of the current block does not include a non-zero transform coefficient, and ctp _ V =1 indicates that a final transform coefficient matrix corresponding to a chroma V component of the current block includes a non-zero transform coefficient. If the current block satisfies parsing condition 1 (a first preset condition), st _ chroma _ flag is parsed from the encoded bitstream. And when the st _ chroma _ flag is equal to 0, the secondary inverse transformation is not carried out on the chroma U component and the chroma V component, and when the st _ chroma _ flag is equal to 1, the secondary inverse transformation is carried out on the chroma U component and the chroma V component at the same time.
If the final transform coefficient matrix corresponding to the chrominance components (such as chrominance U components and/or chrominance V components) of the current block contains non-zero transform coefficients, the final transform coefficient matrix corresponding to the chrominance components of the current block is analyzed from the coded bit stream of the current block, and inverse quantization is performed on the final transform coefficient matrix corresponding to the chrominance components, so as to obtain a target transform coefficient matrix corresponding to the chrominance components.
Illustratively, if the chrominance U component and the chrominance V component are subjected to the secondary inverse transformation simultaneously, the secondary inverse transformation is performed on the upper left corner 4 × 4 region of the target transformation coefficient matrix corresponding to the chrominance U component, the transformation coefficient of the upper left corner 4 × 4 region is updated, an initial transformation coefficient matrix corresponding to the chrominance U component is obtained, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the chrominance U component, so as to obtain a residual error coefficient matrix corresponding to the chrominance U component. And performing secondary inverse transformation on a 4 x 4 region at the upper left corner of a target transformation coefficient matrix corresponding to the chromaticity V component, updating the transformation coefficient of the 4 x 4 region at the upper left corner to obtain an initial transformation coefficient matrix corresponding to the chromaticity V component, and performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chromaticity V component to obtain a residual error coefficient matrix corresponding to the chromaticity V component. And if the chrominance U component and the chrominance V component are not subjected to secondary inverse transformation, directly performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chrominance U component to obtain a residual error coefficient matrix corresponding to the chrominance U component, and performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chrominance V component to obtain a residual error coefficient matrix corresponding to the chrominance V component. Then, a reconstructed block is determined based on a residual coefficient matrix (i.e., a residual block) corresponding to the chrominance U component and a residual coefficient matrix corresponding to the chrominance V component, for example, the residual block corresponding to the chrominance U component is added to the prediction block to obtain a reconstructed block corresponding to the chrominance U component, and the residual block corresponding to the chrominance V component is added to the prediction block to obtain a reconstructed block corresponding to the chrominance V component.
For example, the analysis condition 1 may refer to the first preset condition in embodiment 1, and details are not repeated here.
The decoding side parsing st _ chroma _ flag syntax description may be one or more of the following descriptions:
grammar 1
Figure BDA0003287836460000333
Grammar 2
Figure BDA0003287836460000331
Grammar 3
Figure BDA0003287836460000332
In syntax 1, syntax 2, and syntax 3 above, syntax 1 indicates that the current block is a Chroma block, the prediction mode of the current block is an Intra prediction mode, the Chroma Intra prediction mode of the current block is not an Intra _ Chroma _ PCM mode, the current block does not use an Intra Prediction Filtering (IPF) mode, the current block does not use an Improved Intra Prediction (IIP) mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to a Chroma u or v component contains non-zero transform coefficients. Syntax 2 indicates that the current block is a Chroma block, and the prediction mode of the current block is an Intra prediction mode, the Chroma Intra prediction mode of the current block is not an Intra _ Chroma _ PCM mode, the current block does not use an Intra Prediction Filtering (IPF) mode, the current block does not use an Improved Intra Prediction (IIP) mode, a transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to a Chroma u or v component contains a non-zero transform coefficient, and control information stchroma enableflag allows the Chroma component to use a secondary inverse transform. Syntax 3 indicates that the current block is a chrominance block, and the prediction mode of the current block is an Intra prediction mode, the chrominance Intra prediction mode of the current block is not an Intra _ Chroma _ PCM mode, the current block does not use an Intra Prediction Filtering (IPF) mode, the current block does not use an Improved Intra Prediction (IIP) mode, a transform coefficient flag bit is used to indicate that a non-zero transform coefficient is contained in a final transform coefficient matrix corresponding to a chrominance u or v component, and control information EstEnableFlag allows the chrominance component to use a secondary inverse transform.
The encoding process of the encoding end comprises the following steps:
if the current block meets the analysis condition 2, the encoding end does not perform secondary transformation on the chrominance U component and the chrominance V component of the current block through RDO decision, or performs secondary transformation on the chrominance U component and the chrominance V component of the current block at the same time. If the decision is made not to perform secondary transformation on the chrominance U component and the chrominance V component, the initial transformation is directly performed on a residual coefficient matrix (namely a residual block) corresponding to the chrominance U component to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance U component is quantized to obtain a final transformation coefficient matrix corresponding to the chrominance U component. And carrying out initial transformation on a residual coefficient matrix (namely a residual block) corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component, and quantizing the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a final transformation coefficient matrix corresponding to the chrominance V component.
Coding a final transform coefficient matrix corresponding to a chroma U component and a final transform coefficient matrix corresponding to a chroma V component in a coded bit stream of a current block, coding transform coefficient flag bits ctp _ U and ctp _ V in the coded bit stream, wherein ctp _ U represents whether the final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient, ctp _ V represents whether the final transform coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transform coefficient, for example, ctp _ U =0 represents that the final transform coefficient matrix corresponding to the chroma U component of the current block does not contain a non-zero transform coefficient, ctp _ U =1 represents that the final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient, ctp _ V =0 represents that the final transform coefficient matrix corresponding to the chroma V component of the current block does not contain a non-zero transform coefficient, and ctp _ V =1 represents that the final transform coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transform coefficient.
If the final transform coefficient matrix corresponding to the chrominance U component and/or the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients, the st _ chroma _ flag is coded to be 0 in the coded bit stream, and the final transform coefficient matrix is coded in the coded bit stream.
If the chroma U component and the chroma V component are secondarily transformed at the same time, a residual coefficient matrix corresponding to the chroma U component is initially transformed to obtain an initial transformation coefficient matrix corresponding to the chroma U component, transformation coefficients of the upper left corner 4 x 4 of the initial transformation coefficient matrix corresponding to the chroma U component are secondarily transformed to obtain a target transformation coefficient matrix corresponding to the chroma U component, and the target transformation coefficient matrix corresponding to the chroma U component is quantized to obtain a final transformation coefficient matrix corresponding to the chroma U component. And carrying out secondary transformation on the transformation coefficient of 4 x 4 at the upper left corner of the initial transformation coefficient matrix corresponding to the chromaticity V component to obtain a target transformation coefficient matrix corresponding to the chromaticity V component, and quantizing the target transformation coefficient matrix corresponding to the chromaticity V component to obtain a final transformation coefficient matrix corresponding to the chromaticity V component.
Encoding a final transform coefficient matrix corresponding to a chrominance U component and a final transform coefficient matrix corresponding to a chrominance V component in an encoding bit stream of a current block, encoding transform coefficient flag bits ctp _ U and ctp _ V in the encoding bit stream, wherein ctp _ U represents whether the final transform coefficient matrix corresponding to the chrominance U component of the current block contains a non-zero transform coefficient, ctp _ V represents whether the final transform coefficient matrix corresponding to the chrominance V component of the current block contains a non-zero transform coefficient, for example, ctp _ U =0 represents that the final transform coefficient matrix corresponding to the chrominance U component of the current block does not contain a non-zero transform coefficient, ctp _ U =1 represents that the final transform coefficient matrix corresponding to the chrominance U component of the current block contains a non-zero transform coefficient, ctp _ V =0 represents that the final transform coefficient matrix corresponding to the chrominance V component of the current block does not contain a non-zero transform coefficient, and ctp _ V =1 represents that the final transform coefficient matrix corresponding to the chrominance V component of the current block contains a non-zero transform coefficient.
If the final transform coefficient matrix corresponding to the chrominance U component and/or the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients, the st _ chroma _ flag is coded to be 1 in the coded bit stream, and the final transform coefficient matrix is coded in the coded bit stream.
For example, the second preset condition in embodiment 3 may be referred to as the resolution condition 2, and details are not repeated here.
Example 10: on the basis of the st _ chroma _ flag in embodiment 8 or 9, the encoding end may encode the st _ chroma _ flag in a context-based binary arithmetic coding manner, and the decoding end may decode the st _ chroma _ flag in a context-based binary arithmetic decoding manner. Or, the encoding end adopts a bypass encoding mode to encode the st _ chroma _ flag, and the decoding end adopts a bypass decoding mode to decode the st _ chroma _ flag. If a context-based binary arithmetic coding scheme or a context-based binary arithmetic decoding scheme is adopted, a context model can be configured in advance, and the context model is explained as follows:
case 1, a single context model is pre-configured as a target context model for all chroma components. Based on this, for the encoding end, when the st _ chroma _ flag needs to be encoded, the encoding end may encode the st _ chroma _ flag based on the context model. For the decoding end, when it needs to decode st _ chroma _ flag, the decoding end can decode st _ chroma _ flag based on the context model.
Case 2, at least two context models based on the chroma intra prediction mode are pre-configured, and both of the context models are possible to be target context models. For an encoding end, when an st _ chroma _ flag needs to be encoded, the encoding end selects a target context model from at least two pre-configured context models based on a chroma intra-frame prediction mode of a current block, and encodes the st _ chroma _ flag based on the target context model. For a decoding end, when st _ chroma _ flag needs to be decoded, the decoding end firstly selects a target context model from at least two pre-configured context models based on a chroma intra-frame prediction mode of a current block, and decodes the st _ chroma _ flag based on the target context model.
For example, referring to table 5, two context models, namely context model 0 and context model 1, may be configured in advance. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 0-4 (DM, DC, HOR, VER, BI), the context model 0 is taken as the target context model, and st _ chroma _ flag is encoded based on the context model 0, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 0. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located in 5-16 (DM, DC, HOR, VER, and other modes except BI), the context model 1 is used as the target context model, and st _ chroma _ flag is encoded based on the context model 1, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 1.
TABLE 5
IntrachromaMode (chroma intra prediction mode) Context model (Context model)
0-4(DM、DC、HOR、VER、BI) 0
5-16(other modes) 1
For another example, referring to table 6, three context models, namely context model 0, context model 1, and context model 2, may be configured in advance. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 0-4 (DM, DC, HOR, VER, BI), the context model 0 is taken as the target context model, st _ chroma _ flag is encoded based on the context model 0, and the decoding end decodes st _ chroma _ flag based on the context model 0. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 5-7 (TSCPM, TSCPM _ L, TSCPM _ T), the context model 1 is taken as the target context model, the st _ chroma _ flag is encoded based on the context model 1, and the decoding end decodes the st _ chroma _ flag based on the context model 1. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 8-16 (PMC, PMC _ L, PMC _ T, EPMC _ L, EPMC _ T, EPMC2_ L, EPMC2_ T), the context model 2 is taken as the target context model, st _ chroma _ flag is encoded based on the context model 2, and the decoding end decodes st _ chroma _ flag based on the context model 2.
TABLE 6
Figure BDA0003287836460000351
Figure BDA0003287836460000361
For another example, referring to table 7, four context models, context model 0 to context model 3, may be configured in advance. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 0-4 (DM, DC, HOR, VER, BI), the decoding end uses the context model 0 as the target context model, encodes st _ chroma _ flag based on the context model 0, and decodes st _ chroma _ flag based on the context model 0. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 5-7 (TSCPM, TSCPM _ L, TSCPM _ T), the context model 1 is taken as the target context model, the st _ chroma _ flag is encoded based on the context model 1, and the decoding end decodes the st _ chroma _ flag based on the context model 1. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is located at 8-10 (PMC, PMC _ L, PMC _ T), the context model 2 is taken as a target context model, st _ chroma _ flag is encoded based on the context model 2, and the decoding end decodes st _ chroma _ flag based on the context model 2. For the encoding side, if the mode number of the chroma intra prediction mode of the current block is 11 to 16 (EPMC, EPMC _ L, EPMC _ T, EPMC2_ L, EPMC2_ T), the st _ chroma _ flag is encoded based on the context model 3 with the context model 3 as the target context model, and the decoding side decodes the st _ chroma _ flag based on the context model 3.
TABLE 7
Figure BDA0003287836460000362
Case 3, at least two context models based on the size of the chrominance component of the current block are pre-configured, and both of these context models may be target context models. For an encoding end, a target context model is selected from at least two pre-configured context models based on the size of the chrominance component of the current block, and st _ chroma _ flag is encoded based on the target context model. For a decoding end, firstly, based on the size of the chroma component of the current block, a target context model is selected from at least two context models which are configured in advance, and st _ chroma _ flag is decoded based on the target context model.
For example, at least two context models may be configured based on the width of the chroma component, at least two context models may be configured based on the height of the chroma component, at least two context models may be configured based on the maximum value of the width and the height of the chroma component, at least two context models may be configured based on the minimum value of the width and the height of the chroma component, and at least two context models may be configured based on the product of the width and the height of the chroma component.
For example, referring to table 8, two context models, context model 0 and context model 1, may be configured according to the product of the width and the height. For the encoding end, if the product of the width and the height of the chrominance component is greater than or equal to N, the context model 0 may be used as the target context model, and st _ chroma _ flag is encoded based on the context model 0, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 0. For the encoding end, if the product of the width and the height of the chrominance component is smaller than N, the context model 1 is used as the target context model, and st _ chroma _ flag is encoded based on the context model 1, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 1. Illustratively, N may be configured empirically, e.g., N may be set to 128.
TABLE 8
Size = width & height Context model (Context model)
Size>=N 0
Size<N 1
For another example, referring to table 9, two context models, namely context model 0 and context model 1, may be configured according to the minimum values of the width and the height. For the encoding end, if the minimum value of the width and the height of the chrominance component is greater than or equal to M, the context model 0 is taken as the target context model, and st _ chroma _ flag is encoded based on the context model 0, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 0. For the encoding end, if the minimum value of the width and the height of the chrominance component is smaller than M, the context model 1 is taken as the target context model, and st _ chroma _ flag is encoded based on the context model 1, and similarly, the decoding end decodes st _ chroma _ flag based on the context model 1. Illustratively, M may be configured empirically, e.g., M may be set to 4 or 8.
TABLE 9
Size = min (width, height) Context model (Context model)
Size>=M 0
Size<M 1
Example 11: on the basis of embodiment 8 or embodiment 9, for the secondary transformation process, from the encoding end, an initial transformation coefficient matrix is obtained through (DCT 2 ) transformation, then, the new transformation coefficient is obtained by multiplying the transformation coefficient of 4 × 4 at the upper left corner of the initial transformation coefficient matrix by the secondary transformation matrix, the new transformation coefficient is used to replace the transformation coefficient of 4 × 4 at the upper left corner of the initial transformation coefficient matrix, so as to obtain a target transformation coefficient matrix, and then, quantization is performed to obtain a final transformation coefficient matrix. From a decoding end, performing inverse quantization on a final transform coefficient matrix obtained by decoding a code stream entropy to obtain a target transform coefficient matrix, performing secondary inverse transform on a 4 x 4 region at the upper left corner of the target transform coefficient matrix to obtain a new transform coefficient, replacing the transform coefficient of 4 x 4 at the upper left corner of the target transform coefficient matrix with the new transform coefficient to obtain an initial transform coefficient matrix, and performing inverse transform on the initial transform coefficient matrix by using (DCT 2 ) to obtain a residual error coefficient.
For the chroma components (e.g., the chroma U component and the chroma V component), the decoding-side inverse transform process is as follows:
In case one, if the current block is a chroma intra prediction residual block (i.e. chroma component), the value of the width or height of the chroma component is greater than 4, and the value of the secondrytransformenableflag (i.e. the secondary transform enable flag) is equal to 1 (the value of the secondary transform enable flag is equal to 1, indicating that the secondary transform is allowed to be enabled at the sequence level or the frame level), and the value of StChromaFlag is equal to 1 (the value of StChromaFlag is equal to 1 indicating that the chroma component is transformed twice, it should be noted that, in other embodiments, stChromaFlag may also be denoted as st _ chroma _ flag, both meaning), the following operations are performed on the coefficient matrix:
1. and obtaining a coefficient matrix C of the upper left corner 4 x 4 from the transformation 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, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4 × 4 region located at the upper left corner in the target transform coefficient matrix.
2. The coefficient matrix C is subjected to the following horizontal inverse transform: c. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is the element of 4 by 4 matrix P, which is calculated as follows: p = C × S 4 ,S 4 Is 4 x 4 inverse transformation matrix, clip3 (-32768, 32767, (p) ij +2 6 )>>7) Is shown if c ij A value of-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, the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix.
3. And carrying out vertical inverse transformation on the horizontal inverse transformation matrix as follows: 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 S 4 Is a 4 x 4 inverse transform matrix. And obtaining a vertical inverse transformation moment after vertical inverse transformation is carried out on the horizontal inverse transformation matrix.
4. According to the verticalThe inverse transform moment modifies the values of the elements of the target transform coefficient matrix: coeff ij =c ij I =0 to 3, j =0 to 3. Namely, the transformation coefficients of the 4 x 4 area positioned at the upper left corner in the target transformation coefficient matrix are replaced based on the vertical inverse transformation matrix.
Case two, if the current block is a chroma intra prediction residual block, the values of the width and height of the chroma components are equal to 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the value of StChromaFlag is equal to 1, then:
1. and carrying out the following vertical inverse transformation on the transformation coefficient matrix 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 transform matrix D 4 The transpose matrix of (1), coeffMatrix being a transform coefficient. Illustratively, after the target transform coefficient matrix is subjected to vertical inverse transform, the obtained matrix K is a vertical inverse transform matrix.
2. And 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, after performing horizontal inverse transformation on the vertical inverse transformation matrix, the obtained matrix H is a horizontal inverse transformation matrix, and the initial transformation coefficient matrix may be determined based on the matrix H, that is, the matrix H is directly determined as the initial transformation coefficient matrix.
Illustratively, for 4 × 4 blocks, the initial inverse transform need not be performed after the second inverse transform is performed.
Example 12: on the basis of embodiments 8, 9 and 11, for chrominance components (such as chrominance U components and chrominance V components), in the secondary inverse transform process, it may be further determined whether to perform horizontal inverse transform and vertical inverse transform for the prediction mode based on the chrominance of the current block, and on this basis, the decoding side inverse transform process is as follows:
case one, if the current block is a chrominance intra prediction residual block, the value of the width or height of the chrominance component is greater than 4, and the value of SecondaryTransformEnableFlag is equal to 1, st \\ chroma_flag is equal to 1, the following operations are performed on the coefficient matrix:
1. And obtaining a coefficient matrix C of the upper left corner 4 x 4 from the transformation 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, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4 × 4 region located at the upper left corner in the target transform coefficient matrix.
2. If the value of IntraChromaPredMode is 0 to 2 or 4 to 6 or 8 to 9 or 11 to 12 or 14 to 15, the coefficient matrix C is subjected to the following horizontal inverse transform: c. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is the element of 4 by 4 matrix P, which is calculated as follows: p = C × S 4 ,S 4 Is a 4 x 4 inverse transform matrix. Illustratively, the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix. The IntraChromaPredMode has a value of 0 to 2, or 4 to 6, or 8 to 9, or 11 to 12, or 14 to 15, indicating that the mode number of the chroma intra prediction mode is within the first mode number interval.
3. If the value of IntraChromaPredMode is 0 to 1 or 3 to 5 or 7 to 8 or 10 to 11 or 13 to 14 or 16, the coefficient matrix is subjected to the following vertical inverse transform: 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 a 4 x 4 inverse transform matrix. The coefficient matrix is subjected to vertical inverse transformation to obtain a vertical inverse transformation moment, and the value of the IntraChromaPredMode is 0-1 or 3-5 or 7-8 or 10 to 11, 13 to 14, or 16, and the mode number indicating the chroma intra prediction mode is located in the second mode number section. For example, if the coefficient matrix C is not subjected to the horizontal inverse transform before step 3, the coefficient matrix C is directly subjected to the vertical inverse transform in step 3. If the coefficient matrix C has been subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix before step 3, then in step 3, vertical inverse transformation is performed on the horizontal inverse transformation matrix.
4. Modifying the values of the elements of the target transform coefficient matrix according to the coefficient matrix: coeff ij =c ij I =0 to 3, j =0 to 3. Illustratively, if only the coefficient matrix C is subjected to horizontal inverse transform to obtain a horizontal inverse transform matrix, and the horizontal inverse transform matrix is not subjected to vertical inverse transform, the values of the elements of the target transform coefficient matrix are modified using the horizontal inverse transform matrix. And if the vertical inverse transformation is only carried out on the coefficient matrix C to obtain a vertical inverse transformation matrix, and the horizontal inverse transformation is not carried out on the coefficient matrix C, modifying the values of the elements of the target transformation coefficient matrix by using the vertical inverse transformation matrix. If the horizontal inverse transformation is performed on the coefficient matrix C to obtain a horizontal inverse transformation matrix, then the vertical inverse transformation is performed on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix, and the value of the element of the target transformation coefficient matrix is modified by using the vertical inverse transformation matrix (namely, the matrix after the horizontal inverse transformation and the vertical inverse transformation).
Case two, if the current block is a chrominance intra prediction residual block, the values of the width and height of the chrominance components are equal to 4, and the value of the SecondaryTransformEnableFlag is equal to 1, and the value of the st _ chroma _ flag is equal to 1, then:
1. and carrying out the following vertical inverse transformation on the transformation coefficient matrix 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 transformation matrix D 4 The transpose matrix of (1), coeffMatrix being a transform coefficient. Illustratively, the coefficient matrix is transformed for the targetAfter vertical inverse transformation, the obtained matrix K is a vertical inverse transformation matrix.
2. And 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, after performing horizontal inverse transformation on the vertical inverse transformation matrix, the obtained matrix H is a horizontal inverse transformation matrix, and the initial transformation coefficient matrix may be determined based on the matrix H, that is, the matrix H is directly determined as the initial transformation coefficient matrix.
Illustratively, for 4 × 4 blocks, the initial inverse transform need not be performed after the second inverse transform is performed.
Example 13: the chroma U component and the chroma V component use different secondary transformation zone bits, the secondary transformation zone bit of the chroma U component is a U component secondary transformation zone bit, the U component secondary transformation zone bit is marked as st _ cb _ flag, the secondary transformation zone bit of the chroma V component is a V component secondary transformation zone bit, and the V component secondary transformation zone bit is marked as st _ cr _ flag. Illustratively, the st _ cb _ flag may also be named StCbFlag, and the st _ cr _ flag may also be named StCrFlag.
The decoding flow of the decoding end comprises the following steps: if the current block satisfies the parsing condition 3 (i.e., a first preset condition), the st _ cb _ flag is parsed from the encoded bitstream of the current block. And when the st _ cb _ flag is equal to 0, the chroma U component is not subjected to the secondary inverse transformation, and when the st _ cb _ flag is equal to 1, the chroma U component is subjected to the secondary inverse transformation. And if the chroma U component is subjected to secondary inverse transformation, carrying out secondary inverse transformation on a 4 x 4 area at the upper left corner of a target transformation coefficient matrix corresponding to the chroma U component, updating the transformation coefficient of the 4 x 4 area at the upper left corner to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and then carrying out initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma U component to obtain a residual error coefficient matrix corresponding to the chroma U component. And if the chroma U component does not undergo secondary inverse transformation, directly performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chroma U component to obtain a residual error coefficient matrix corresponding to the chroma U component. And obtaining a reconstruction block corresponding to the chroma U component based on the residual coefficient matrix corresponding to the chroma U component.
If the current block satisfies the parsing condition 4 (i.e., a first preset condition), the st _ cr _ flag is parsed from the encoded bitstream of the current block. When st _ cr _ flag is equal to 0, it means that the chrominance V component is not secondarily inverse-transformed, and when st _ cr _ flag is equal to 1, it means that the chrominance V component is secondarily inverse-transformed. And if the chroma V component is subjected to secondary inverse transformation, carrying out secondary inverse transformation on a region of the upper left corner 4 x 4 of the target transformation coefficient matrix corresponding to the chroma V component, updating the transformation coefficient of the region of the upper left corner 4 x 4 to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and then carrying out initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a residual error coefficient matrix corresponding to the chroma V component. And if the chroma V component is not subjected to secondary inverse transformation, directly performing initial inverse transformation on a target transformation coefficient matrix corresponding to the chroma V component to obtain a residual error coefficient matrix corresponding to the chroma V component. And obtaining a reconstruction block corresponding to the chroma V component based on a residual coefficient matrix (namely a residual block) corresponding to the chroma V component.
Illustratively, the parsing condition 3 may include: the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag bit is used to indicate that a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient, for example, ctp _ U is 1. The resolution condition 4 may include: the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient, e.g., ctp _ V is 1. The parsing conditions 3 and 4 may further include optional parsing conditions, which are referred to as the first preset conditions in embodiment 1 and are not described herein again.
The encoding process of the encoding end comprises the following steps: and if the current block meets the analysis condition 5, the encoding end does not carry out secondary transformation or carries out secondary transformation on the chrominance U component through RDO decision. And if the chroma U component is not subjected to secondary transformation, directly performing initial transformation on a residual coefficient matrix corresponding to the chroma U component to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and quantizing the initial transformation coefficient matrix corresponding to the chroma U component to obtain a final transformation coefficient matrix corresponding to the chroma U component. The final transform coefficient matrix corresponding to the chrominance U component is encoded in the encoded bitstream, and st _ cb _ flag is encoded in the encoded bitstream to be equal to 0. If the decision is made to carry out secondary transformation on the chrominance U component, carrying out primary transformation on a residual coefficient matrix corresponding to the chrominance U component to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, carrying out secondary transformation on a transformation coefficient of 4 x 4 at the upper left corner of the initial transformation coefficient matrix corresponding to the chrominance U component to obtain a target transformation coefficient matrix corresponding to the chrominance U component, quantizing the target transformation coefficient matrix corresponding to the chrominance U component to obtain a final transformation coefficient matrix corresponding to the chrominance U component, coding the final transformation coefficient matrix corresponding to the chrominance U component in a coding bit stream, and coding st _ cb _ flag in the coding bit stream to be equal to 1.
If the current block meets the analysis condition 6, the encoding end can also perform no secondary transformation or secondary transformation on the chroma V component through RDO decision. And if the secondary transformation is not carried out on the chrominance V component, directly carrying out initial transformation on the residual coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component, and quantizing the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a final transformation coefficient matrix corresponding to the chrominance V component. A final transform coefficient matrix corresponding to the chrominance V component is encoded in the encoded bitstream of the current block, and st _ cr _ flag is encoded in the encoded bitstream to be equal to 0. If the chroma V component is decided to be transformed secondarily, a residual coefficient matrix corresponding to the chroma V component is transformed primarily to obtain an initial transformation coefficient matrix corresponding to the chroma V component, transformation coefficients of the upper left corner 4 x 4 of the initial transformation coefficient matrix corresponding to the chroma V component are transformed secondarily to obtain a target transformation coefficient matrix corresponding to the chroma V component, the target transformation coefficient matrix corresponding to the chroma V component is quantized to obtain a final transformation coefficient matrix corresponding to the chroma V component, the final transformation coefficient matrix corresponding to the chroma V component is coded in a coding bit stream of the current block, and st _ cr _ flag is coded in the coding bit stream to be equal to 1.
Illustratively, the parsing condition 5 may include: the prediction mode of the current block is an intra-frame prediction mode, and a final transformation coefficient matrix corresponding to the chroma U component contains non-zero transformation coefficients. The resolution condition 6 may include: the prediction mode of the current block is an intra-frame prediction mode, and a final transformation coefficient matrix corresponding to the chrominance V component contains a non-zero transformation coefficient. The resolving conditions 5 and 6 may also include optional resolving conditions, which are referred to as second preset conditions of example 3.
Example 14: on the basis of the st _ cb _ flag in embodiment 13, the encoding end encodes the st _ cb _ flag in a context-based binary arithmetic coding manner, and the decoding end decodes the st _ cb _ flag in a context-based binary arithmetic decoding manner. Or, the encoding end adopts a bypass encoding mode to encode the st _ cb _ flag, and the decoding end adopts a bypass decoding mode to decode the st _ cb _ flag. If a context-based binary arithmetic coding mode or a context-based decoding mode is adopted, a context model can be configured in advance. For example, a single context model is pre-configured as a target context model for all chroma U components. As another example, at least two context models based on the chroma intra prediction mode are pre-configured, and both of the context models may be target context models. As another example, at least two context models based on the size of the chrominance component of the current block, which may each be the target context model, are pre-configured.
For example, regarding the configuration mode of the context model, and the encoding mode and the decoding mode of the st _ cb _ flag, see embodiment 10, it may be enough to replace the st _ chroma _ flag with the st _ cb _ flag, and details are not repeated in this embodiment 14.
On the basis of the st _ cr _ flag in embodiment 13, the encoding side encodes the st _ cr _ flag in a context-based binary arithmetic coding manner, and the decoding side decodes the st _ cr _ flag in a context-based binary arithmetic decoding manner. Or, the encoding end adopts a bypass encoding mode to encode the st _ cr _ flag, and the decoding end adopts a bypass decoding mode to decode the st _ cr _ flag. If a context-based binary arithmetic coding mode or a context-based decoding mode is adopted, a context model can be configured in advance. For example, a single context model is pre-configured as a target context model for all chrominance V components. As another example, at least two context models based on the chroma intra prediction mode are pre-configured, and both of the context models may be target context models. As another example, at least two context models based on the size of the chrominance component of the current block, which may each be the target context model, are pre-configured.
For example, regarding the configuration mode of the context model, and the encoding mode and the decoding mode of the st _ cr _ flag, see embodiment 10, it may be enough to replace the st _ chroma _ flag with the st _ cr _ flag, and details are not repeated in this embodiment 14.
Example 15: on the basis of embodiment 13, regarding the chroma U component, the inverse transform process at the decoding end is similar to the inverse transform process of embodiment 11 or embodiment 12, and the condition of the first case of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block (i.e., a chroma component), the value of the width or height of the chroma component is greater than 4, and the value of secondarytransformablefableflag is equal to 1, and the current chroma component is a chroma U component and the value of st _ cb _ flag is equal to 1", and the condition of the second case of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block, the values of the width and height of the chroma component are equal to 4, and the value of secondarytransformableflag is equal to 1, and the current chroma component is a chroma U component and the value of st _ cb _ st is equal to 1", and specific inverse transform process is not repeated with the first case and the second case of embodiment 11 or embodiment 12.
Similarly, on the basis of embodiment 13, regarding the chroma V component, the inverse transform process at the decoding end is similar to the inverse transform process of embodiment 11 or embodiment 12, and the condition of the first case of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block (i.e., a chroma component), the value of the width or height of the chroma component is greater than 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the current chroma component is a chroma V component and the value of st _ cr _ flag is equal to 1", and the condition of the second case of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block, the values of the width and height of the chroma component are equal to 4, and the value of secondarytransformflag is equal to 1, and the current chroma component is a chroma V component and the value of st _ cr _ flag is equal to 1", and specific details of the inverse transform process are not repeated.
Example 16: the luminance component, the chrominance U component and the chrominance V component share a secondary transformation flag bit, which may be a luminance and chrominance secondary transformation flag bit, and the luminance and chrominance secondary transformation flag bit is denoted as st _ tu _ flag. Illustratively, st _ tu _ flag may also be named StTuFlag.
The decoding flow of the decoding end comprises the following steps: if the current block satisfies the parsing condition 7 (i.e., a third preset condition), the st _ tu _ flag is parsed from the encoded bitstream of the current block. When st _ tu _ flag is equal to 0, it means that no secondary inverse transformation is performed on the luminance component, the chrominance U component, and the chrominance V component, and when st _ tu _ flag is equal to 1, it means that the luminance component, the chrominance U component, and the chrominance V component are simultaneously subjected to the secondary inverse transformation. Illustratively, if the luminance component, the chrominance U component, and the chrominance V component are simultaneously subjected to the secondary inverse transformation, the secondary inverse transformation is performed on the upper left 4 × 4 region of the target transformation coefficient matrix corresponding to the luminance component, the transformation coefficient of the upper left 4 × 4 region is updated, an initial transformation coefficient matrix corresponding to the luminance component is obtained, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the luminance component, so as to obtain a residual error coefficient matrix corresponding to the luminance component. Similarly, a residual coefficient matrix corresponding to the chrominance U component and a residual coefficient matrix corresponding to the chrominance V component can be obtained. If the luminance component, the chrominance U component and the chrominance V component are not subjected to secondary inverse transformation, the initial inverse transformation is directly performed on the target transformation coefficient matrix corresponding to the luminance component to obtain a residual error coefficient matrix corresponding to the luminance component, and similarly, a residual error coefficient matrix corresponding to the chrominance U component and a residual error coefficient matrix corresponding to the chrominance V component can be obtained. Then, a reconstructed block of the current block may be determined based on the residual coefficient matrix corresponding to the luminance component, the residual coefficient matrix corresponding to the chrominance U component, and the residual coefficient matrix corresponding to the chrominance V component.
Illustratively, the parsing condition 7 may include: the prediction mode of the current block is an intra prediction mode, and the flag bit of the transform coefficient is used to indicate that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient, and/or the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, for example, ctp _ y is 1, ctp _ u is 1, ctp_is 1, and ctp \/y is used to indicate that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient. The parsing condition 7 may further include optional parsing conditions, which are referred to as a third preset condition in embodiment 5 and are not repeated herein.
The encoding process of the encoding end comprises the following steps: if the current block meets the analysis condition 8 (i.e., a fourth preset condition), the encoding end does not perform secondary transformation on the luminance component, the chrominance U component and the chrominance V component of the current block through RDO decision, or performs secondary transformation on the luminance component, the chrominance U component and the chrominance V component of the current block at the same time. If the decision is made not to perform secondary transformation on the luminance component, the chrominance U component and the chrominance V component, the encoding end directly performs initial transformation on a residual coefficient matrix (namely a residual block) corresponding to the luminance component to obtain an initial transformation coefficient matrix corresponding to the luminance component, and quantizes the initial transformation coefficient matrix corresponding to the luminance component to obtain a final transformation coefficient matrix corresponding to the luminance component. Similarly, a final transform coefficient matrix corresponding to the chrominance U component and a final transform coefficient matrix corresponding to the chrominance V component can be obtained. The encoding end encodes a final transform coefficient matrix corresponding to a luminance component, a final transform coefficient matrix corresponding to a chrominance U component and a final transform coefficient matrix corresponding to a chrominance V component in an encoded bit stream of the current block, and encodes st _ tu _ flag equal to 0 in the encoded bit stream.
And if the decision is made to carry out secondary transformation on the brightness component, the chromaticity U component and the chromaticity V component at the same time, carrying out primary transformation on a residual coefficient matrix corresponding to the brightness component to obtain an initial transformation coefficient matrix corresponding to the brightness component, carrying out secondary transformation on transformation coefficients of 4 x 4 at the upper left corner of the initial transformation coefficient matrix corresponding to the brightness component to obtain a target transformation coefficient matrix corresponding to the brightness component, and quantizing the target transformation coefficient matrix corresponding to the brightness component to obtain a final transformation coefficient matrix corresponding to the brightness component. Similarly, a final transform coefficient matrix corresponding to the chrominance U component and a final transform coefficient matrix corresponding to the chrominance V component can be obtained. A final transform coefficient matrix corresponding to a luminance component, a final transform coefficient matrix corresponding to a chrominance U component, and a final transform coefficient matrix corresponding to a chrominance V component are encoded in the encoded bitstream, and st _ tu _ flag is encoded to be equal to 1 in the encoded bitstream.
Illustratively, the parsing condition 8 may include: the prediction mode of the current block is an intra-frame prediction mode, and an initial transformation coefficient matrix corresponding to the brightness component or an initial transformation coefficient matrix corresponding to the chroma U component or an initial transformation coefficient matrix corresponding to the chroma V component contains non-zero transformation coefficients. The parsing condition 8 may further include optional parsing conditions, which are referred to as fourth preset conditions in embodiment 6 and are not repeated herein.
Example 17: based on the st _ tu _ flag of embodiment 16, the encoding end may encode the st _ tu _ flag by using a context-based binary arithmetic coding method, and the decoding end decodes the st _ tu _ flag by using a context-based binary arithmetic decoding method. Or, the encoding end may encode the st _ tu _ flag in a bypass encoding manner, and the decoding end decodes the st _ tu _ flag in a bypass decoding manner. If a context-based binary arithmetic coding mode or a context-based decoding mode is adopted, a context model can be configured in advance. For example, a single context model may be pre-configured as a target context model for all luminance and chrominance components. For another example, at least two context models based on the size of the current block may be pre-configured, and these context models may each be a target context model.
Regarding the configuration of the context model, and the encoding and decoding of the st _ tu _ flag, reference may be made to embodiment 10, where st _ chroma _ flag may be replaced by st _ tu _ flag, and details of this embodiment 17 are not repeated.
Example 18: based on embodiment 11, for chrominance components (such as chrominance U component and chrominance V component), the inverse transform process at the decoding end is the same as the inverse transform process of embodiment 11, and for luminance component, the condition of the first case of embodiment 11 is replaced by "if the current block is an intra luminance prediction residual block, the value of the width or height of the current block is greater than 4, and the value of secondarytransformEnableflag is equal to 1, and the value of est _uflag is equal to 1", and the condition of the second case of embodiment 11 is replaced by "if it is an intra luminance prediction residual block, the values of the width and height of the current block are equal to 4, and the value of secondaryTransformEnableflag is equal to 1, and the value of secondaryTransformenFlag is equal to 1", and the specific transform process is the same as the first and second cases of embodiment 11, and the detailed description of the current block is not repeated here.
In one possible implementation, for the current block, the luma component and the chroma components (e.g., the chroma U component and the chroma V component) are included, in which case the decoding-side inverse transform process is as follows:
a) If the current block is an intra prediction residual block, M 1 Or M 2 Is greater than 4 and the value of SecondaryTransformEnableFlag is equal to 1, the following is performed on the CoeffMatrix:
1) A 4 × 4 matrix C is obtained from the transform coefficient matrix:
c ij =coeff ij ,i=0~3,j=0~3
in the formula c ij Is an element of the matrix C, coeff ij Are elements of a matrix of transform coefficients.
2) If the current block satisfies one of the following conditions:
condition 1, the current block is a luma prediction residual block, estEnableFlag is non-zero and the transformsipltituflag of the current block has a value of 0 and the EstTuFlag has a value equal to 1, or EstEnableFlag is 0 and the IntraLumaPredMode has a value of 0-2 or 13-32 or 44-65, and the reference sample with coordinates of (x 0-1, y0+ j-1) (j = 1-N) is "available";
condition 2, the current block is a chroma prediction residual block, and the value of StChromaFlag is equal to 1 (the value of StChromaFlag equal to 1 indicates that the chroma component is secondarily transformed).
Then: c. C ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3
In the formula p ij Are elements of a 4 x 4 matrix P. The matrix P is calculated as follows:
P=C×S 4
wherein S 4 Is a 4 x 4 inverse transform matrix.
3) If the current block satisfies one of the following conditions:
Condition 1, the current block is a luminance prediction residual block, if EstEnableFlag is non-zero and the transformshift direction of the current block has a value of 0 and the EstTuFlag has a value equal to 1, or EstEnableFlag has a value of 0 and IntraLumaPredMode has a value of 0 to 23 or 34 to 57, and a reference sample having coordinates of (x 0+ i-1, y0-1) (i =1 to M) is "available";
condition 2, the current block is a chroma prediction residual block, and the value of StChromaFlag is equal to 1 (the value of StChromaFlag equal to 1 indicates that the chroma component is secondarily transformed).
Then: c. C ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3
In the formula q ij Are elements of a 4 x 4 matrix Q. The matrix Q is calculated as follows:
Q=S 4 T ×C
in the formula S 4 T Is S 4 The transposing of (1).
4) Modifying the values of the elements of the transform coefficient matrix according to matrix C:
coeff ij =c ij ,i=0~3,j=0~3
b) And carrying out the following vertical inverse transformation on the transformation coefficient matrix to obtain a matrix K:
1) If the current block is an intra prediction residual block, M 1 And M 2 Equal to 4 and the value of SecondaryTransformEnableFlag is equal to 1, and one of the following conditions is satisfied:
condition 1, the current block is a luma prediction residual block, and EstEnableFlag is 0 or EstEnableFlag is non-zero and the value of EstTuFlag is equal to 1;
condition 2, the current block is a chroma prediction residual block, and the value of StChromaFlag is equal to 1 (the value of StChromaFlag equal to 1 indicates that the chroma component is secondarily transformed).
Then: k is a radical of ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
In the formula 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
in the formula D 4 T Is an inverse transform matrix D 4 The transposed matrix of (2).
2) Otherwise, judging the values of PbtCuFlag, sbtCuFlag, sbtDirFlag and SbtPosFlag,
first, if the value of PbtCuFlag is 1 and the sequence number of the transform block is 0, 1, 2, or 3:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
in the formula v ij Is an element of the matrix V, k ij Are elements of matrix K. The matrix V is calculated as follows:
if the sequence number of the transform block is 0 or 1: then the
V=DCT8 M2 T ×CoeffMatrix
DCT8 in the formula M2 T Is DCT8 M2 Transposed matrix of (1), DCT8 M2 Is M 2 ×M 2 And inversely transforming the matrix.
Otherwise, if the sequence number of the transform block is 2 or 3: then
V=DST7 M2 T ×CoeffMatrix
In the formula DST7 M2 T Is DST7 M2 Transposed matrix of (DST 7) M2 Is M 2 ×M 2 And (4) inversely transforming the matrix.
Second, otherwise, if the value of SbtCuFlag is 1 and the sequence number of the transform block is 0 and the width of the transform block is less than 64 and the height of the transform block is less than 32:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
in the formula v ij Is an element of the matrix V, k ij Are elements of matrix K. The matrix V is calculated as follows:
if sbtdireflag is 1 and SbtPosFlag is 0: then the
V=DCT8 M2 T ×CoeffMatrix
DCT8 in the formula M2 T Is DCT8 M2 Transposed matrix of (1), DCT8 M2 Is M 2 ×M 2 And (4) inversely transforming the matrix.
Otherwise:
V=DST7 M2 T ×CoeffMatrix
in the formula DST7 M2 T Is DST7 M2 Transposed matrix of (DST 7) M2 Is M 2 ×M 2 And (4) inversely transforming the matrix.
Thirdly, otherwise:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
in the formula v ij Is an element of the matrix V, k ij Are elements of matrix K. The matrix V is calculated as follows:
V=DCT2 M2 T ×CoeffMatrix
DCT2 in the formula M2 T Is DCT2 M2 Transposed matrix of (1), DCT2 M2 Is M 2 ×M 2 And inversely transforming the matrix.
c) And performing the following horizontal inverse transformation on the matrix K to obtain a matrix H:
1) If the current transform block is an intra prediction residual block, M 1 And M 2 Equal to 4 and the value of SecondaryTransformEnableFlag is equal to 1, and one of the following conditions is satisfied:
condition 1, the current block is a luma prediction residual block, and EstEnableFlag is 0 or EstEnableFlag is non-zero and the value of EstTuFlag is equal to 1;
condition 2, the current block is a chroma prediction residual block, and the value of StChromaFlag is equal to 1 (the value of StChromaFlag equal to 1 indicates that the chroma component is secondarily transformed).
Then:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1
in the formula 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. The matrix W is calculated as follows:
W=K×D 4
in the formula D 4 Is the inverse transform matrix.
2) Otherwise, judging the values of PbtCuFlag, sbtCuFlag, sbtDirFlag and SbtPosFlag,
first, if the value of PbtCuFlag is 1 and the sequence number of the transform block is 0, 1, 2, or 3:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1)i=0~M 1 -1,j=0~M 2 -1
in the formula w ij 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 20-BitDepth. The matrix W is calculated as follows:
If the sequence number of the transform block is 0 or 2: then
W=K×DCT8 M1
Otherwise, if the sequence number of the transform block is 1 or 3: then
W=K×DST7 M1
DCT8 in the formula M1 、DST7 M1 Is M 1 ×M 1 And inversely transforming the matrix.
Second, otherwise, if the value of SbtCuFlag is 1 and the sequence number of the transform block is 0 and the width of the transform block is less than 32 and the height of the transform block is less than 64:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1)i=0~M 1 -1,j=0~M 2 -1
in the formula w ij 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 20-BitDepth. The matrix W is calculated as follows:
if sbtdiflag is 0 and SbtPosFlag is 0: then
W=K×DCT8 M1
Otherwise:
W=K×DST7 M1
DCT8 in the formula M1 、DST7 M1 Is M 1 ×M 1 And inversely transforming the matrix.
Thirdly, otherwise:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1) i=0~M 1 -1,j=0~M 2 -1
in the formula w ij 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 20-BitDepth. The matrix W is calculated as follows:
W=K×DCT2 M1
DCT2 in the formula M1 Is M 1 ×M 1 And inversely transforming the matrix.
d) Taking the matrix H as a residual sample matrix ResidueMatrix directly, and ending the inverse transformation operation.
Example 19:
the decoding flow of the decoding end comprises the following steps: parsing the secondary transform enable flag bit SecondaryTransformEnableFlag from the code stream, the SecondaryTransformEnableFlag indicating whether the sequence-level control information allows the current sequence to use the secondary inverse transform, for example, a SecondaryTransformEnableFlag equal to a first value (e.g., 1) indicates that the sequence-level control information allows the current sequence to use the secondary inverse transform, and a SecondaryTransformEnableFlag equal to a second value (e.g., 0) indicates that the sequence-level control information does not allow the current sequence to use the secondary inverse transform. If the sequence-level control information allows the current sequence to use the second-order inverse transform, the chroma second-order transform enable flag bit st _ chroma _ enable _ flag may be further parsed, where st _ chroma _ enable _ flag indicates whether the sequence-level control information allows the chroma components (i.e., the chroma components of all image blocks of the current sequence) to use the second-order inverse transform, e.g., a first value of st _ chroma _ enable _ flag equals indicates that the sequence-level control information allows the chroma components to use the second-order inverse transform, and a second value of st _ chroma _ enable _ flag equals indicates that the sequence-level control information does not allow the chroma components to use the second-order inverse transform. The syntax of the above-described SecondaryTransformEnableFlag and st _ chroma _ enable _ flag is described as follows:
Figure BDA0003287836460000451
For example, the sequence level control information is only an example, and may also be picture parameter set level control information, picture header level control information, and slice header level control information, and the level of this control information is not limited.
The encoding process of the encoding end comprises the following steps: encoding a secondary transform enable flag bit SecondaryTransformEnablFlag into the bitstream, secondaryTransformEnablFlag indicating whether sequence level control information allows the current sequence to use secondary inverse transform, e.g., secondaryTransformEnablFlag equal to a first value indicates that sequence level control information allows the current sequence to use secondary inverse transform, secondaryTransformEnablFlag equal to a second value indicates that sequence level control information does not allow the current sequence to use secondary inverse transform. If the sequence-level control information allows the current sequence to use the second-order inverse transform, the chroma second-order transform enable flag bit st _ chroma _ enable _ flag is encoded, the st _ chroma _ enable _ flag indicating whether the sequence-level control information allows the chroma components (i.e., the chroma components of all image blocks of the current sequence) to use the second-order inverse transform, for example, a first value of st _ chroma _ enable _ flag being equal to the first value indicates that the sequence-level control information allows the chroma components to use the second-order inverse transform, and a second value of st _ chroma _ enable _ flag being equal to the second value indicates that the sequence-level control information does not allow the chroma components to use the second-order inverse transform.
For example, the above sequence level control information is only an example, and may also be picture parameter set level control information, picture header level control information, slice header level control information, and the level of this control information is not limited.
Example 20: for an Improved Intra Prediction (IIP) mode, if it is determined to perform IIP on a current block, performing IIP on a luminance component and a chrominance component of the current block, respectively, comprising:
1. if the prediction mode of the luminance component or the chrominance component of the current block is the angular intra prediction mode:
luminance component: an 8-tap interpolation filter is used to generate reference pixels for the sub-pixel points, and when MIPF is enabled, a class-3 8-tap filter is used, with the index value of the filter implicitly derived based on the size of the current block and the row-column index number. The index of the filter is derived using the following equation: filter _ idx = mipf _ enable _ flag? (j < 1. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current luminance component, respectively.
Chrominance components: an 8-tap interpolation filter is used to generate reference pixels for sub-pixels, when MIPF is enabled, a class 3 8-tap filter is used, and the index value of the filter is implicitly derived based on the size of the current block and the row and column index number. The index of the filter is derived using the following equation: filter _ idx = mipf _ enable _ flag? (j < 2. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current chrominance component, respectively.
2. If the prediction mode of the luma component or the chroma component of the current block is DC mode:
for the luma component and the chroma components, the following operations are performed: the pixels inside the current block and the pixels near the boundary have different prediction values, and the conventional DC value is still used for the inside pixels (not the pixels of the first two lines or the first two columns); for pixels near the boundary (pixels of the first two rows or columns), as shown in fig. 1G and 1H, the weighted average of (DC value and reference pixel value) is used as the final prediction value, and the luminance and chrominance have respective reference pixels.
For example, as shown in fig. 1G, if the current pixel point is located at the position a of the first row, the weighted average of the reference pixels A0, A1, A2 and DC is used as the predicted value of the position a; if the current pixel point is located at the position B of the first column, using the weighted average value of the reference pixels B0, B1, B2 and DC as the predicted value of the position B; and if the current pixel point is positioned at the position C at the upper left corner of the current block, using the weighted average value of the reference pixels C0, C1, C2, C3, C4 and DC as the predicted value of the position C. Referring to fig. 1H, if the current pixel point is located at the second row D, the weighted average of the reference pixel D and the DC is used as the predicted value of the position D; if the current pixel point is located at the E position of the second row, using the weighted average value of the reference pixel E and the DC as the predicted value of the E position; and if the current pixel point is positioned at the position F at the upper left corner of the current block, using the weighted average value of the reference pixels F0, F1 and DC as the predicted value of the position F.
The weights for the a, b, c, d, e, f positions are shown in table 4, and the last weight may be the weight of the DC value.
3. If the prediction mode of the luma component or the chroma component of the current block is Plane mode:
for the luma component and the chroma components, the following operations are performed: the pixels inside the current block and the pixels near the boundary have different predictors, and the plane predictor is still used for the inside pixels (not the pixels of the first two lines or the first two columns); for pixels close to the boundary (pixels of the first two rows or columns), a weighted average of (plane prediction value and reference pixel value) is used as the final prediction value. The luminance and chrominance have respective reference pixels, with specific weights consistent with the improved DC mode.
4. If the prediction mode of the luminance component or the chrominance component of the current block is the Bilinear mode:
for the luma component and the chroma components, the following operations are performed: replacing the original 1 reference pixel value with a weighted average of 5 reference pixels, wherein the weights of the 5 reference pixels are as follows: {82, 252, 356, 252, 82}. Luminance and chrominance have respective reference pixels. Then the bilinear prediction process is performed.
Of course, the above embodiments 1 to 20 may be implemented individually or in combination. For example, each embodiment may be implemented separately, embodiment 1 and embodiment 3 may be implemented in combination, embodiment 2 and embodiment 4 may be implemented in combination, embodiment 5 and embodiment 6 may be implemented in combination, embodiment 8 and embodiment 10 may be implemented in combination, embodiment 9 and embodiment 10 may be implemented in combination, embodiment 8 and embodiment 11 may be implemented in combination, embodiment 9 and embodiment 11 may be implemented in combination, embodiment 8 and embodiment 12 may be implemented in combination, embodiment 9 and embodiment 12 may be implemented in combination, embodiment 8, embodiment 10 and embodiment 11 may be implemented in combination, embodiment 8, embodiment 10 and embodiment 12 may be implemented in combination, embodiment 13 and embodiment 14 may be implemented in combination, embodiment 13 and embodiment 15 may be implemented in combination, embodiment 13, embodiment 14 and embodiment 15 may be implemented in combination, embodiment 16 and embodiment 17 may be implemented in combination, embodiment 16 and embodiment 18 may be implemented in combination, embodiment 16, embodiment 17 and embodiment 18 may be implemented in combination, and the like.
Of course, the above are only examples, and the combination manner of the embodiments is not limited.
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. 6A, which is a structural diagram of the apparatus, and the apparatus includes: an obtaining module 611, configured to obtain a coded bit stream of the current block; a decoding module 612, configured to parse a transform coefficient flag from the encoded bitstream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to a chroma component of the current block contains a non-zero transform coefficient; if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or the chrominance component is not subjected to secondary inverse transformation; wherein the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream; a processing module 613, configured to perform inverse quantization on the final transform coefficient matrix corresponding to the chroma component to obtain a target transform coefficient matrix corresponding to the chroma component; a determining module 614, configured to determine whether to perform secondary inverse transformation on the target transform coefficient matrix corresponding to the chroma component according to the secondary transform flag.
In a possible embodiment, the first preset condition further comprises at least one of: the current block does not use an intra prediction filtering mode; the current block does not use an improved intra prediction mode; the current block adopts a transformation check (DCT 2 ) to carry out initial inverse transformation; the chroma intra-frame prediction mode of the current block meets a preset mode condition; the size of the chrominance component of the current block meets a preset size condition; the control information allows the chroma components to use a quadratic inverse transform.
In one possible implementation, the transform coefficient flag includes a chrominance U component transform coefficient flag and a chrominance V component transform coefficient flag; when the value of the chroma U component transform coefficient flag bit is a first value, the chroma U component transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient; when the value of the chroma U component transformation coefficient flag bit is a second value, the chroma U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma U component does not contain a non-zero transformation coefficient; when the value of the chroma V component transformation coefficient flag bit is a first value, the chroma V component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transformation coefficient; when the value of the chroma V component transformation coefficient zone bit is a second value, the chroma V component transformation coefficient zone bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma V component does not contain a non-zero transformation coefficient; wherein, the transform coefficient flag bit is used to indicate that a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and includes: the value of the chroma U component transformation coefficient zone bit is a first value, and/or the value of the chroma V component transformation coefficient zone bit is a first value.
In a possible implementation, the chrominance components are chrominance U components and chrominance V components, and the quadratic transform flag bit is a common quadratic transform flag bit for the UV components; and when the value of the UV component sharing secondary transformation flag bit is a first value, the method is used for indicating that secondary inverse transformation is simultaneously carried out on the chromaticity U component and the chromaticity V component, or when the value of the UV component sharing secondary transformation flag bit is a second value, the method is used for indicating that secondary inverse transformation is not carried out on the chromaticity U component and the chromaticity V component. Or, the chrominance component is chrominance U component and chrominance V component, and the secondary transform flag bit includes U component secondary transform flag bit and V component secondary transform flag bit; when the value of the U component secondary transformation flag bit is a first value, the U component secondary transformation flag bit is used to indicate that the chroma U component is subjected to secondary inverse transformation, or when the value of the U component secondary transformation flag bit is a second value, the U component secondary transformation flag bit is used to indicate that the chroma U component is not subjected to secondary inverse transformation; and when the value of the V component quadratic transformation zone bit is a first value, the V component quadratic transformation zone bit is used for indicating that the chromaticity V component is subjected to quadratic inverse transformation, or when the value of the V component quadratic transformation zone bit is a second value, the V component quadratic transformation zone bit is used for indicating that the chromaticity V component is not subjected to quadratic inverse transformation.
In a possible implementation, the processing module 613 is further configured to: if the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chrominance component; if the target transformation coefficient matrix corresponding to the chrominance component is not subjected to secondary inverse transformation, determining the target transformation coefficient matrix corresponding to the chrominance component as an initial transformation coefficient matrix corresponding to the chrominance component; performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the chrominance component; and determining a reconstruction value of the chrominance component according to the residual coefficient matrix.
Based on the same application concept as the method, an embodiment of the present application further provides an encoding apparatus applied to an encoding end, as shown in fig. 6B, which is a structural diagram of the apparatus, and the apparatus includes: an obtaining module 621, configured to obtain a residual coefficient matrix corresponding to a chrominance component of a current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; a determining module 622, configured to determine whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component to obtain a target transformation coefficient matrix corresponding to the chroma component if the current block meets a second preset condition; the processing module 623 is configured to quantize the target transform coefficient matrix corresponding to the chroma component to obtain a final transform coefficient matrix corresponding to the chroma component; an encoding module 624, configured to encode a transform coefficient flag in the encoded bitstream for the current block, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient; coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed; wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
In a possible embodiment, the second preset condition comprises at least one of: the current block does not use an intra prediction filtering mode; the current block does not use an improved intra prediction mode; the current block is subjected to initial transformation by adopting a transformation check (DCT 2 ); the chroma intra-frame prediction mode of the current block meets a preset mode condition; the size of the chrominance component of the current block meets a preset size condition; the control information allows the chroma components to use a quadratic transform.
In a possible implementation, the chrominance components are chrominance U components and chrominance V components, and the secondary transform flag is a common secondary transform flag for the UV components; and when the value of the UV component sharing quadratic transformation zone bit is a first value, the method is used for indicating that the chromaticity U component and the chromaticity V component are subjected to quadratic transformation at the same time, or when the value of the UV component sharing quadratic transformation zone bit is a second value, the method is used for indicating that neither the chromaticity U component nor the chromaticity V component is subjected to quadratic transformation. Or, the chrominance components are chrominance U components and chrominance V components, and the secondary transformation flag bits comprise U component secondary transformation flag bits and V component secondary transformation flag bits; when the value of the U component secondary transformation flag bit is a first value, the U component secondary transformation flag bit is used to indicate that the chrominance U component is to be secondarily transformed, or when the value of the U component secondary transformation flag bit is a second value, the U component secondary transformation flag bit is used to indicate that the chrominance U component is not to be secondarily transformed; and when the value of the V component quadratic transformation zone bit is a first value, the V component quadratic transformation zone bit is used for indicating that the chroma V component is subjected to quadratic transformation, or when the value of the V component quadratic transformation zone bit is a second value, the V component quadratic transformation zone bit is used for indicating that the chroma V component is not subjected to quadratic transformation.
The processing module 623 is further configured to: if the secondary transformation is determined to be performed on the initial transformation coefficient matrix corresponding to the chrominance component, performing secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and if the initial transformation coefficient matrix corresponding to the chrominance component is determined not to be subjected to secondary transformation, determining the initial transformation coefficient matrix corresponding to the chrominance component as a target transformation coefficient matrix corresponding to the chrominance component.
As for the decoding-end device (the decoding-end device may be a video decoder) provided in the embodiment of the present application, in terms of a hardware level, a schematic diagram of a hardware architecture thereof 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: acquiring a coded bit stream of a current block, and analyzing a transform coefficient flag bit from the coded bit stream, wherein the transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transform coefficient; if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or the chrominance component is not subjected to secondary inverse transformation; wherein the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
In terms of hardware, the schematic diagram of the hardware architecture of the encoding end device (which may be a video encoder) provided in the embodiment of the present application 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 that are 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: obtaining a residual error coefficient matrix corresponding to the chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; if the current block meets a second preset condition, determining whether to carry out secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; quantizing the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encoding a transform coefficient flag bit in the encoded bit stream of the current block, wherein the transform coefficient flag bit is used for indicating whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed; wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients.
Based on the same application concept as the method, the embodiment of the present application further provides a camera device, and the camera device may include the encoding apparatus and/or the decoding apparatus in any of the embodiments.
Based on the same application concept as the method, embodiments of the present application further provide a machine-readable storage medium, where a plurality of computer instructions are stored on the machine-readable storage medium, and when the computer instructions are executed by a processor, the encoding and decoding methods disclosed in the above examples of the present application can be implemented. The machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: a RAM (random Access Memory), a volatile Memory, a non-volatile Memory, a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
Based on the same application concept as the method, the embodiment of the present application further provides a computer application program, and when the computer application program is executed by a processor, the computer application program can implement the encoding and decoding method disclosed in the above example of the present application.
The systems, apparatuses, modules or units described in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more pieces of software and/or hardware in the practice of the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. The present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (23)

1. A decoding method applied to a decoding end, the method comprising:
acquiring a coded bit stream of a current block, and analyzing a transform coefficient flag bit from the coded bit stream, wherein the transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transform coefficient;
if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or the chrominance component is not subjected to secondary inverse transformation; wherein the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
If the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component;
determining whether to perform secondary inverse transformation on a target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit;
the chrominance components are chrominance U components and chrominance V components, and the quadratic transformation zone bit is a UV component shared quadratic transformation zone bit; when the value of the UV component sharing secondary transformation flag bit is a first value, the UV component sharing secondary transformation flag bit is used to instruct that the chroma U component and the chroma V component are subjected to secondary inverse transformation at the same time, or when the value of the UV component sharing secondary transformation flag bit is a second value, the UV component sharing secondary transformation flag bit is used to instruct that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation;
wherein, the determining whether to perform the second inverse transform on the target transform coefficient matrix corresponding to the chrominance component according to the second transform flag bit includes: if the value of the UV component sharing secondary transformation zone bit is a first value, determining that secondary inverse transformation is simultaneously carried out on the target transformation coefficient matrixes corresponding to the chromaticity U component and the chromaticity V component; and if the value of the UV component sharing secondary transformation zone bit is a second value, determining that the secondary inverse transformation is not performed on the target transformation coefficient matrixes corresponding to the chromaticity U component and the chromaticity V component.
2. The method of claim 1, wherein after determining whether to perform inverse secondary transform on the target transform coefficient matrix corresponding to the chroma component according to the secondary transform flag, the method further comprises:
if the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chrominance component; if the target transformation coefficient matrix corresponding to the chrominance component is not subjected to secondary inverse transformation, determining the target transformation coefficient matrix corresponding to the chrominance component as an initial transformation coefficient matrix corresponding to the chrominance component;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the chrominance component;
and determining a reconstruction value of the chrominance component according to the residual coefficient matrix.
3. The method of claim 1,
the parsing of the quadratic transform flag of block-level chroma components from the encoded bitstream comprises:
and analyzing the secondary transformation zone bits from the coded bit stream by adopting a context-based binary arithmetic decoding mode.
4. The method of claim 3, wherein parsing the quadratic transform flag bits from the coded bitstream using context-based binary arithmetic decoding comprises:
parsing the quadratic transform flag from the coded bitstream based on a pre-configured separate context model.
5. An encoding method applied to an encoding end, the method comprising:
acquiring a residual error coefficient matrix corresponding to the chrominance component of the current block;
performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
if the current block meets a second preset condition, determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
quantizing the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encoding a transform coefficient flag bit in the encoded bit stream of the current block, wherein the transform coefficient flag bit is used for indicating whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
Coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate that the chrominance component is to be secondarily transformed or the chrominance component is not to be secondarily transformed;
wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and an initial transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
the chrominance components are chrominance U components and chrominance V components, and the secondary conversion zone bits are UV components sharing secondary conversion zone bits; and when the value of the UV component sharing quadratic transformation zone bit is a first value, the method is used for indicating that the chromaticity U component and the chromaticity V component are subjected to quadratic transformation at the same time, or when the value of the UV component sharing quadratic transformation zone bit is a second value, the method is used for indicating that neither the chromaticity U component nor the chromaticity V component is subjected to quadratic transformation.
6. The method of claim 5,
the determining whether to perform quadratic transform on the initial transform coefficient matrix corresponding to the chrominance component includes:
Determining a first cost value when only the chrominance U component and the chrominance V component are subjected to initial transformation;
determining a second generation value when the chroma U component and the chroma V component are subjected to initial transformation and then secondary transformation;
if the second generation value is smaller than the first generation value, determining that the initial transformation coefficient matrix corresponding to the chromaticity U component and the initial transformation coefficient matrix corresponding to the chromaticity V component are subjected to secondary transformation at the same time;
and if the second generation value is greater than the first generation value, determining that the secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chromaticity U component and the initial transformation coefficient matrix corresponding to the chromaticity V component.
7. The method of claim 5, wherein the determining whether to transform the initial transform coefficient matrix corresponding to the chroma component twice to obtain a target transform coefficient matrix corresponding to the chroma component comprises:
if so, carrying out secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; if not, determining the initial transformation coefficient matrix corresponding to the chrominance component as a target transformation coefficient matrix corresponding to the chrominance component.
8. The method of claim 5,
the secondary transform flag for encoding block-level chroma components in the encoded bit stream of the current block comprises:
and if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, encoding the secondary transform flag bit in the encoded bit stream of the current block.
9. The method according to claim 5 or 8,
the secondary transform flag for encoding block-level chroma components in the encoded bit stream of the current block comprises:
and coding the quadratic transformation zone bit by adopting a context-based binary arithmetic coding mode.
10. The method of claim 9,
the encoding the quadratic transformation flag bit by adopting a context-based binary arithmetic coding mode comprises the following steps:
and encoding the secondary transformation flag bit based on a single context model configured in advance.
11. A decoding apparatus, applied to a decoding side, the decoding apparatus comprising:
an obtaining module, configured to obtain a coded bit stream of a current block;
a decoding module, configured to parse a transform coefficient flag from the encoded bitstream, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to a chroma component of the current block contains a non-zero transform coefficient; if the current block meets a first preset condition, resolving a secondary transformation flag bit of a block-level chrominance component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that secondary inverse transformation is carried out on the chrominance component or not carrying out secondary inverse transformation on the chrominance component; wherein the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used for indicating that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chrominance component from the coded bit stream;
The processing module is used for carrying out inverse quantization on the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component;
a determining module, configured to determine whether to perform secondary inverse transformation on a target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation flag;
the chrominance components are chrominance U components and chrominance V components, and the secondary conversion zone bits are UV components sharing secondary conversion zone bits; when the value of the UV component sharing secondary transformation flag bit is a first value, the UV component sharing secondary transformation flag bit is used to instruct that the chroma U component and the chroma V component are subjected to secondary inverse transformation simultaneously, or when the value of the UV component sharing secondary transformation flag bit is a second value, the UV component sharing secondary transformation flag bit is used to instruct that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation;
the determining module is specifically configured to, when determining whether to perform inverse transform on the target transform coefficient matrix corresponding to the chroma component twice according to the secondary transform flag bit: if the value of the UV component sharing secondary transformation zone bit is a first value, determining that secondary inverse transformation is simultaneously carried out on the target transformation coefficient matrixes corresponding to the chromaticity U component and the chromaticity V component; and if the value of the UV component sharing secondary transformation zone bit is a second value, determining that the secondary inverse transformation is not performed on the target transformation coefficient matrixes corresponding to the chromaticity U component and the chromaticity V component.
12. The apparatus of claim 11,
the processing module is further configured to: if the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance component is subjected to secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chrominance component; if the target transformation coefficient matrix corresponding to the chrominance component is not subjected to secondary inverse transformation, determining the target transformation coefficient matrix corresponding to the chrominance component as an initial transformation coefficient matrix corresponding to the chrominance component;
performing initial inverse transformation on the initial transformation coefficient matrix to obtain a residual error coefficient matrix corresponding to the chrominance component;
and determining a reconstruction value of the chrominance component according to the residual coefficient matrix.
13. The apparatus of claim 11,
the decoding module is specifically configured to, when parsing the secondary transform flag of the block-level chroma component from the encoded bitstream:
and analyzing the secondary transformation zone bits from the coded bit stream by adopting a context-based binary arithmetic decoding mode.
14. The apparatus of claim 13, wherein the decoding module is configured to parse the dct flag from the coded bitstream using context-based binary arithmetic decoding, and is further configured to:
Parsing the quadratic transform flag from the coded bitstream based on a pre-configured separate context model.
15. An encoding apparatus applied to an encoding side, the encoding apparatus comprising:
the acquisition module is used for acquiring a residual coefficient matrix corresponding to the chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
a determining module, configured to determine whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component to obtain a target transformation coefficient matrix corresponding to the chroma component if the current block meets a second preset condition;
the processing module is used for quantizing the target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component;
an encoding module, configured to encode a transform coefficient flag in an encoded bitstream of the current block, where the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient;
coding a secondary transform flag of a block-level chroma component in the coded bit stream of the current block; wherein the secondary transform flag bit is used to indicate that the chrominance component is subjected to secondary transform or not subjected to secondary transform;
Wherein the second preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and an initial transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
the chrominance components are chrominance U components and chrominance V components, and the quadratic transformation zone bit is a UV component shared quadratic transformation zone bit; and when the value of the UV component sharing quadratic transformation zone bit is a first value, the method is used for indicating that the chromaticity U component and the chromaticity V component are subjected to quadratic transformation at the same time, or when the value of the UV component sharing quadratic transformation zone bit is a second value, the method is used for indicating that neither the chromaticity U component nor the chromaticity V component is subjected to quadratic transformation.
16. The apparatus of claim 15, wherein the determining module is configured to determine whether to perform the quadratic transform on the initial transform coefficient matrix corresponding to the chroma component specifically:
determining a first cost value when only the chrominance U component and the chrominance V component are subjected to initial transformation;
determining a second generation value when the chromaticity U component and the chromaticity V component are subjected to initial transformation and then secondary transformation;
if the second generation value is smaller than the first generation value, determining that the initial transformation coefficient matrix corresponding to the chromaticity U component and the initial transformation coefficient matrix corresponding to the chromaticity V component are subjected to secondary transformation simultaneously;
And if the second generation value is greater than the first generation value, determining that the secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chroma U component and the initial transformation coefficient matrix corresponding to the chroma V component.
17. The apparatus of claim 15,
the determining module determines whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component, and when obtaining the target transformation coefficient matrix corresponding to the chrominance component, the determining module is specifically configured to: if so, carrying out secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; if not, determining the initial transformation coefficient matrix corresponding to the chrominance component as a target transformation coefficient matrix corresponding to the chrominance component.
18. The apparatus of claim 15, wherein the encoding module, when encoding a secondary transform flag of a block-level chroma component in the encoded bitstream for the current block, is specifically configured to: and if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, encoding the secondary transform flag bit in the encoded bit stream of the current block.
19. The apparatus of claim 15 or 18,
the encoding module is specifically configured to, when the secondary transform flag of the chroma component at the encoding block level in the encoded bit stream of the current block is set: and coding the secondary transformation flag bit by adopting a context-based binary arithmetic coding mode.
20. The apparatus of claim 19,
the encoding module is specifically configured to, when encoding the quadratic transform flag bit in a context-based binary arithmetic coding manner: and encoding the secondary transformation flag bit based on a single context model configured in advance.
21. A decoding device, characterized by comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; wherein the content of the first and second substances,
the processor is configured to execute the machine-executable instructions to implement the method of any of claims 1-4.
22. An encoding device, characterized by comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; wherein the content of the first and second substances,
The processor is configured to execute the machine executable instructions to implement the method of any of claims 5-10.
23. A machine-readable storage medium having stored thereon machine-executable instructions executable by a processor; wherein the processor is configured to execute the machine-executable instructions to implement the method of any one of claims 1 to 4 or to implement the method of any one of claims 5 to 10.
CN202111153185.6A 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment Active CN113709481B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111153185.6A CN113709481B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011455990.XA CN114630119B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment
CN202111153185.6A CN113709481B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202011455990.XA Division CN114630119B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Publications (2)

Publication Number Publication Date
CN113709481A CN113709481A (en) 2021-11-26
CN113709481B true CN113709481B (en) 2022-12-23

Family

ID=78668984

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202111153132.4A Active CN113709480B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment
CN202111153185.6A Active CN113709481B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment
CN202011455990.XA Active CN114630119B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202111153132.4A Active CN113709480B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202011455990.XA Active CN114630119B (en) 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment

Country Status (1)

Country Link
CN (3) CN113709480B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114630119A (en) * 2020-12-10 2022-06-14 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114222132A (en) * 2022-01-13 2022-03-22 北京达佳互联信息技术有限公司 Video decoding inverse transformation method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107257460B (en) * 2011-10-19 2019-08-16 株式会社Kt The method of decoding video signal
KR20190013611A (en) * 2017-07-28 2019-02-11 한국전자통신연구원 A method of video processing, a method and appratus for encoding/decoding video using the processing
US10819979B2 (en) * 2018-09-06 2020-10-27 Tencent America LLC Coupled primary and secondary transform
US20200304794A1 (en) * 2019-03-21 2020-09-24 Mediatek Inc. Method and Apparatus of the Quantization Matrix Computation and Representation for Video Coding
WO2020233514A1 (en) * 2019-05-17 2020-11-26 Beijing Bytedance Network Technology Co., Ltd. Signaling of syntax elements according to chroma format
CN113709480B (en) * 2020-12-10 2022-12-23 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114630119A (en) * 2020-12-10 2022-06-14 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Also Published As

Publication number Publication date
CN114630119B (en) 2023-04-25
CN113709480B (en) 2022-12-23
CN114630119A (en) 2022-06-14
CN113709480A (en) 2021-11-26
CN113709481A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
US11902509B2 (en) Method and device for encoding/decoding image, and recording medium storing bit stream
US9832464B2 (en) Method and apparatus for encoding/decoding image using transform skip flag
CA3029042C (en) Enhanced intra-prediction coding using planar representations
JP5833250B2 (en) Second-order boundary filtering for video coding
KR101818997B1 (en) Methods of encoding and decoding using multi-level prediction and apparatuses for using the same
CN113709481B (en) Encoding and decoding method, device and equipment
CN114598871A (en) Encoding and decoding method, device and equipment
AU2019210553A1 (en) Enhanced intra-prediction coding using planar representations
CN112911312B (en) Encoding and decoding method, device and equipment
CN113473129B (en) Encoding and decoding method and device
AU2015203228B2 (en) Enhanced intra-prediction coding using planar representations
KR20240047943A (en) Video encoding and decoding device and method
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