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

Encoding and decoding method, device and equipment Download PDF

Info

Publication number
CN113709481A
CN113709481A CN202111153185.6A CN202111153185A CN113709481A CN 113709481 A CN113709481 A CN 113709481A CN 202111153185 A CN202111153185 A CN 202111153185A CN 113709481 A CN113709481 A CN 113709481A
Authority
CN
China
Prior art keywords
component
transformation
coefficient matrix
chrominance
chroma
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111153185.6A
Other languages
Chinese (zh)
Other versions
CN113709481B (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

Landscapes

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

Abstract

The application provides a coding method, a decoding method, a device and equipment thereof, wherein the 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 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 coding performance is improved through the application.

Description

Encoding and decoding method, device and equipment
Technical Field
The present application relates to the field of encoding and decoding technologies, and in particular, to an encoding method, an encoding device, a decoding device, and an encoding apparatus.
Background
In order to save space, video images are transmitted after being encoded, and the complete video encoding method may include processes of prediction, transformation, quantization, entropy encoding, filtering, and the like. Predictive coding may include intra-coding and inter-coding. Inter-frame coding uses the correlation of video time domain and uses the pixel of adjacent coded image to predict the pixel of current image so as to remove the redundancy of video time domain. In the intra-frame coding, strong spatial correlation between adjacent blocks is considered, pixels which are reconstructed around are used as reference pixels to predict a current uncoded block, and only the subsequent coding processing is needed to be carried out on a residual value instead of the original value, so that the redundancy on a spatial domain is effectively removed, and the compression efficiency is greatly improved.
In video coding, transform refers to converting an image described in the form of pixels in the spatial domain into an image in the transform domain and representing it in the form of transform coefficients. Most images contain more flat areas and slowly-changing areas, so that the image energy can be distributed in a spatial domain in a dispersed manner in a proper conversion process and converted into relatively concentrated distribution in a conversion domain, thereby removing the frequency domain correlation among signals and effectively compressing a code stream in cooperation with a quantization process.
For the transformation process, a quadratic transformation technique is proposed in the related art. The quadratic transformation technique is as follows: firstly, initial transformation is carried out to obtain a transformation coefficient after the initial transformation. And then, carrying out secondary transformation on the transformation coefficient after the initial transformation to obtain a new transformation coefficient. Then, the new transform coefficients are quantized and entropy encoded. However, 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 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 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 transform coefficient matrix corresponding to the chrominance component to obtain a target transform 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 zone bit.
The application provides a coding device, is applied to the code end, the device includes: the acquisition module is used for acquiring a residual coefficient matrix corresponding to the 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 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 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 partition 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 configuration diagram of a decoding-side device according to an embodiment of the present application;
fig. 7B is a hardware structure 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 in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information can also be referred to as second information, and similarly, second information can also be referred to as first information, depending on the context, without departing from the scope of the application, and further, the use of the word "if" can be interpreted as "at … …," or "at … …," or "in response to a determination.
In order to make the technical solutions of the present application better understood by those skilled in the art, the following briefly describes technical terms.
Prediction pixel (Prediction Signal): the method is characterized in that residual errors are obtained through the difference between original pixels and predicted pixels according to pixel values derived from pixels which are coded and decoded, and then processes such as residual error transformation, quantization, coefficient coding and the like are carried out.
Intra Prediction (Intra Prediction): refers to a prediction mode for predicting a prediction value of a current block by reconstructed pixel values of a peripheral decoded area. Common ways include copying pixels in the angular direction and deriving the prediction values according to a certain gradient principle. Illustratively, intra prediction removes the spatial correlation of the video/image.
Transform kernel: in video coding, Transform is an essential stage for realizing data compression, and the Transform can make the energy of a signal more concentrated, and a Transform technique based on Discrete Cosine Transform (DCT)/Discrete Sine Transform (DST) has been a mainstream Transform technique for video coding. DCT and DST are further classified into a plurality of transformation kernels according to the difference of basis functions, and three transformation kernels are shown, as shown in table 1.
TABLE 1
Figure 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·ATFormula (1)
In equation (1), M denotes the width of the residual block (i.e., the block of residual coefficients), N denotes the height of the residual block, F denotes the original residual signal in dimensions N × M, F denotes the frequency domain signal in dimensions N × M (i.e., the frequency domain signal after conversion), a and B denote the transform matrices in dimensions M × M and N × N, and both a and B satisfy the orthogonality, as the transform kernel shown in table 1.
The inverse transformation (also called inverse transformation) is the inverse process of the forward transformation, i.e. the frequency domain signal F is converted into a time domain residual signal F by an orthogonal transformation matrix a and an orthogonal transformation matrix B. For example, the inverse transformation process may be represented by a matrix form of equation (2).
f=BTF. A formula (2)
Horizontal transformation (Horizental transform) and Vertical transformation (Vertical transform): in the encoding conversion stage, a two-dimensional residual signal is input, and X is set to be A.fTIf F is equal to B.XTFor example, by a matrix form of formula (3).
F=B·f·AT=B·(A·fT)TFormula (3)
In summary, it can be seen that the forward transformation of the two-dimensional signal can be implemented by two times of one-dimensional forward transformations, and after the first forward transformation, an M × N signal X is obtained, and the correlation between the horizontal pixels of the two-dimensional residual signal is removed, so that the first forward transformation is called horizontal transformation, and is called a horizontal transformation matrix. The second forward transform is called vertical transform, and B is called a vertical transform matrix, because the signal F is obtained after the second forward transform, and the correlation between the pixels in the vertical direction of the two-dimensional residual signal is removed.
Transform pair (Transform pair): also called transformation kernels, M is not necessarily equal to N, the dimensions of a and B are not necessarily equal in order to support matrix blocks, and it is also possible to support transformation matrices that a and B are not produced by the same kind of transformation kernels, so that there is a transformation pair { H, V } in the transformation that consists of transformation kernels corresponding to a and B, H being called a horizontal transformation kernel and V being called a vertical transformation kernel.
Rate-Distortion principle (RDO, Rate-Distoretion Optimized): there are two major indicators for evaluating coding efficiency: code rate and PSNR (Peak Signal to Noise Ratio). The smaller the bitstream, the larger the compression rate; the larger the PSNR, the better the reconstructed image quality. In the mode selection, the discriminant formula is essentially a comprehensive evaluation of the two.
Cost values corresponding to the modes are as follows: j (mode) ═ D + λ R. Illustratively, D represents the distorsion, which is usually measured by using an SSE index, wherein SSE is the sum of the mean square of the difference values of the reconstructed block and the source image; λ is the Lagrangian multiplier; r is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residual, etc. When selecting the mode, if the RDO principle is used to make a comparison decision on the coding mode, the best coding performance can be ensured.
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 shows no partitioning when the derived mode flag is 0 and shows the use of derived modes when the derived mode flag is 1, and the derived modes are specifically divided into horizontal derived modes (2N × hN, 2N × nU, 2N × nD) and vertical derived 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 higher than 1/4 of the height 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 for 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: the 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 luminance intra prediction modes, the mode number of the original angle mode is not changed, and the mode number of the newly added angle mode is increased from 34 to 65.
Chroma intra prediction mode of AVS 3: in AVS3, there are 18 Chroma Intra prediction modes, and the 18 Chroma Intra prediction modes include 5 conventional Chroma Intra prediction modes (DM, DC, HOR, VER, BI), 12 special Chroma 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, 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 neighboring block pixels into 3 cases, the parameter α and the parameter β are calculated from 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 enhancing 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).
Except that the colour is predicted by the luminance componentIn addition to the metric component, AVS3 also supports the prediction of the Cr component, i.e., the PMC mode, from the Y component and the Cb component, and the prediction process of the PMC mode can be expressed by the following two equations: IPred is A. RecY+B,FPredCr=IPred′-ReccbX k. In the above equation, 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 predicted value obtained finally. The parameters A and B in this equation are set to (α)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 transmits one more flag bit, one determined from 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 both horizontal and vertical directions.
P' (x, y) ═ f (x), P (-1, y) + (1-f (x), P (x, y) equation (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) formula (6)
For the luminance component, a filter is selected from the intra prediction modes 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 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 this pixel are obtained by looking up the intra prediction boundary filter coefficient table by M, i and N, j, respectively, 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 filled, 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? (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 relation to 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 on 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) are all "available", then:
Figure BDA0003287836460000081
Figure BDA0003287836460000082
if r [ i ]](i 1-M) "available", c [ j](j ═ 1 to N) "unusable",
Figure BDA0003287836460000083
Figure BDA0003287836460000084
otherwise, if cj](j ═ 1 to N) "available", r [ i](i is 1 to M) "not available", then
Figure BDA0003287836460000085
Otherwise, predMatrix [ x ]][y]2BitDepth-1(x is 0 to M-1, y is 0 to N-1; BitDepth is the coding sample precision).
For the improved DC mode: a conventional DC mode, in which all pixels of the current block have the same predictor, while for the modified DC mode, pixels inside the current block and pixels near the boundary have different predictors, the conventional DC value is still used for the inside pixels (not the pixels of the first two lines or columns); for pixels near the boundary (pixels of the first two rows or the first two 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, referring to 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 B position in the first column, the weighted average of the reference pixels B0, B1, B2 and DC can be used as the predicted value of the B position; if the current pixel point is located at the C position at the upper left corner of the current block, the weighted average of the reference pixels C0, C1, C2, C3, C4 and DC may be used as the predicted value of the C position. 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 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 F position 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 prediction value of the F position. 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 is 0 to M-1, and y is 0 to N-1). Exemplary, ia ═ r [ M ═ 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.
Illustratively, orgPredMatrix [ x ] [ y ] (((((ia-c [ y +1]) × (x +1)) < < log (N)) + ((ib-r [ x +1]) × (y +1)) < < log (M)) + ((r [ x +1] + c [ y +1]) < (log (M)) + log (N)) + ((ic < <1) -ia-ib) × x × y + (1< (M)) + log (N)))) > (log (M)) + log (N)) +1), (x ═ 0 to M-1, y ═ 0 to N-1). predMatrix [ x ] [ y ] (x is 0 to M-1, and y is 0 to N-1) Clip1(orgPredMatrix [ x ] [ y ]). ia ═ r [ M ], ib ═ c [ N ], if M is equal to N, then ic ═ 1 (ia + ib +1) >; otherwise, ic ═ (((ia < < Log (M)) + (ib < < Log (N)))) × weight + (1< (shift +5))) > (shift +6), shift ═ Log (Min (M, N)), weight ═ bilinearWeight [ Log (Max (M, N)/Min (M, N)) -1], and bilinearWeight [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 four reference pixels in different positions, and if the current pixel is located in the first two rows or columns, the weighted average weight used is {10,216}, otherwise, the weighted average weight used is {13,204 }. In summary, the IIP mode includes the five point improvement above, for the IIP mode, 1 flag 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, transformation, quantization, inverse transformation, inverse quantization, entropy encoder, etc. At the encoding end, the processing flow of the encoding end can be realized through the cooperation of the modules, and at the decoding end, the processing flow of the decoding end can be realized through the cooperation of the modules.
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-changing areas, so that the image energy can be distributed in a spatial domain in a dispersed manner in a proper conversion process and converted into relatively concentrated distribution in a conversion domain, thereby removing the frequency domain correlation among signals and effectively compressing a code stream in cooperation with a quantization process.
For example, entropy coding refers to a method of lossless coding according to the principle of information entropy, and is performed in a last processing module of video compression to convert a series of element symbols used for representing a video sequence into a binary code stream for transmission or storage, where the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, and the like, and the output data of the entropy coding module is the final code stream of the original video compression. Entropy coding can effectively remove the statistical redundancy of the video element symbols, and is one of the important tools for ensuring the compression efficiency of video coding.
And (3) secondary transformation: 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 encoding are carried out. For a decoding end, after inverse quantization is carried out on a transform coefficient obtained by entropy decoding of a code stream, secondary inverse transform is carried out on a 4 x 4 area at the upper left corner to obtain a new transform coefficient, and then inverse transform is carried out on the whole transform block by using (DCT 2) to obtain a residual coefficient. The specific decoding end inverse transformation process of the secondary transformation is as follows:
case one, if the current transform block is a luma intra prediction residual block, the value of the width or height is greater than 4, and the value of the quadratic transform enable flag (SecondaryTransformEnableFlag) is equal to 1, the following is performed on the coefficient matrix:
firstly, a coefficient matrix C of the upper left corner 4 × 4 is obtained from the transform coefficient matrix: c. Cij=coeffijI is 0 to 3 and j is 0 to 3, and in the above formula, c isijIs an element of the matrix C, coeffijAre elements of a matrix of transform coefficients. If the value of intra prediction mode (IntraLumaPredMode) is 0 ~ 2, or 13 ~ 32, or 44 ~ 65, and the reference sample outside the current block to the left is "available", then: c. C ij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pijIs the element of 4 x 4 matrix P, which is calculated as follows: p ═ CxS4,S4Is a 4 x 4 inverse transformation matrix, Clip3(-32768, 32767, (p)ij+26)>>7) Is shown if cijIs between-32768 and 32767, then cijHas a value of (p)ij+26)>>7 if cijA value of less than-32768, then cijHas a value of-32768, if cijIf the value of (3) is greater than 32767, then cijHas a value of 32767. If the value of intra prediction mode (IntraLumaPredMode) is 0 ~ 23, or 34 ~ 57, and the reference samples on the outside and above the current block are "available", then: c. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qijIs an element of a 4 x 4 matrix Q, which is calculated as follows: q ═ S4 T×C,S4 TIs S4Transposed matrix of (1), S4Is a 4 x 4 inverse transform matrix.
The values of the elements of the transform coefficient matrix are then modified according to matrix C: coeffij=cij,i=0~3,j=0~3。
Then, the matrix coeff is initially inverse transformed.
Case two, if the current transform block is a luma intra prediction residual block, the values of width and height are equal to 4, and the value of the quadratic transform enable flag (SecondaryTransformEnableFlag) is equal to 1, the following operations are performed on the coefficient matrix:
firstly, the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k is a radical ofij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows: v ═ D4 T×CoeffMatrix,D4 TIs an inverse transformation matrix D 4The transpose matrix of (1), CoeffMatrix being a transform coefficient.
Then, performing the following horizontal inverse transformation on the matrix K to obtain a matrix H: h isij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 22-BitDepth, matrix W: w ═ KXD4,D4Is an inverse transform matrix.
For example, for 4 × 4 blocks, the initial inverse transform is not needed after the inverse transform of the second transform is performed.
Referring to the above embodiments, the quadratic transformation technique refers to: firstly, 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 (DCT 2) is performed by default, and for the chrominance component, there is also a problem that energy may not be sufficiently concentrated after the initial transform. In view of the above findings, in the embodiment of the present application, the chroma components may be transformed twice, 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 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 chroma component of the current block is a chroma U component and a chroma V component, and the transform coefficient flag comprises a chroma U component transform coefficient flag and a chroma V component transform coefficient flag. 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 method 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 method 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 of the block-level chrominance component is parsed from the encoded bitstream, where the secondary transform flag is used to indicate that the chrominance component is to be inversely transformed twice or not to be inversely transformed twice. 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 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 encoded 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 second inverse transform is not performed on the target transform coefficient matrix corresponding to the chroma component of the current block. If the current block satisfies the first predetermined condition, the decoding end may further parse a secondary transform flag (abbreviated as a secondary transform flag) of the block-level chrominance component from the encoded bit stream of the current block. And if the secondary transformation zone bit is used for indicating the secondary inverse transformation of the target transformation coefficient matrix corresponding to the chrominance component, the decoding end determines to perform the secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone 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 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 transform coefficient flag 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 transform coefficient flag bit and the chroma V component transform coefficient flag bit are both the 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 intra-prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains non-zero transform coefficients, and the first preset 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 is subjected to initial inverse transformation by adopting a transformation check (DCT2 ); 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 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, and the current block carries out initial inverse transformation by adopting a transformation check (DCT2 ).
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 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, and the current block carries out initial inverse transformation by adopting a transformation check (DCT2 ).
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 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 carries out initial inverse transformation by adopting a transformation check (DCT 2), and the chrominance 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 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 carries out initial inverse transformation by adopting a transformation check (DCT 2), 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 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 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, 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 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 current block carries out initial inverse 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 chroma component of the current block meets a preset size 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 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 carries out initial inverse transformation by adopting a transformation check (DCT 2), the chrominance intra-frame prediction mode of the current block meets a 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 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 carries out initial inverse transformation by adopting a transformation check (DCT 2), and the chrominance 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 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 n 2. 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 n 2. 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 n 4. 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 n 4. The product of the width and height of the chrominance components is greater than or equal to n 5. The product of the width and height of the chrominance components is less than or equal to n 6.
For example, any combination of the above-mentioned preset size conditions may be: the width of the chrominance component is equal to or greater than n3 and equal to or less than n1, and the height of the chrominance component is equal to or greater than n4 and equal to or less than n 2. For example, the width of the chrominance component is n3 or more and n1 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 n 5. 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 n 6.
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 may be other values, such as 256.
In the above embodiments, 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, the secondary _ transform _ enable _ flag is 1, which indicates that the secondary inverse transform is allowed to be used for the chroma component by the sequence level control information, and 0, which indicates that the secondary inverse transform is not allowed to be used for the chroma component by the sequence level control information.
For another example, est _ enable _ flag is 1, which indicates that the sequence level control information allows the enhancement quadratic inverse transform, and est _ enable _ flag is 1, which indicates that the sequence level control information allows the chroma components to use the quadratic inverse transform. The est _ enable _ flag is 0, which indicates that the sequence level control information does not allow the enhancement quadratic inverse transform to be used, and the est _ enable _ flag is 0, which indicates that the sequence level control information does not allow the chroma component to use the quadratic inverse transform. The est _ enable _ flag may also be denoted as EstEnablFlag.
For another example, st _ chroma _ enable _ flag is equal to 1, which indicates that the sequence-level control information allows the chroma components to use the second-order inverse transform, and st _ chroma _ enable _ flag is equal to 0, which indicates that the sequence-level control information does not allow the chroma components to use the second-order inverse transform. st _ chroma _ enable _ flag may also be denoted as stchroma enableflag.
For another example, if the second _ transform _ enable _ flag is 1 and the est _ enable _ flag is 1, it indicates that the second inverse transform is allowed to be used for the chroma components in the sequence level control information, and if the second _ transform _ enable _ flag is 1 and the est _ enable _ flag is 0, it indicates that the second inverse transform is not allowed to be used for the chroma components in the sequence level control information. If secondary _ transform _ enable _ flag is equal to 0, it is not necessary to decode est _ enable _ flag, and it may 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 the second _ transform _ enable _ flag is 1 and the st _ chroma _ enable _ flag is 1, it indicates that the sequence-level control information allows the chroma components to use the second inverse transform, and if the second _ transform _ enable _ flag is 1 and the st _ chroma _ enable _ flag is 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 is equal to 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.
A Picture Parameter Set (PPS) has a flag bit that determines 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, then the corresponding tool (method) is allowed to be started 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 may include a U-component secondary transform flag and a V-component secondary transform flag; 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; 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 chrominance 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 chrominance 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 secondary inverse transformation is not performed 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 analyzes the quadratic transform flag bit from the coded bit stream by using a context-based binary arithmetic decoding method, 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, 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 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 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 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 chroma U component, performing secondary inverse transformation on a target transformation coefficient matrix corresponding to the chroma U component to obtain an initial transformation coefficient matrix corresponding to the chroma 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 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. 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 4 × 4 sub-region 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 mode number section includes mode numbers 0-2, 4-6, 8-9, 11-12, and 14-15, and the second mode number section includes mode numbers 0-1, 3-5, 7-8, 10-11, 13-14, and 16. If the mode number of the chroma intra prediction mode of the current block is 0-2, 4-6, 8-9, 11-12, 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, 3-5, 7-8, 10-11, 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, the coefficient matrix is subjected to horizontal inverse transformation and then vertical inverse transformation, so that the transformation coefficient of the designated 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 to obtain an initial transformation coefficient matrix.
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 at the upper left corner 4 × 4 is subjected to the secondary inverse transformation, and if the value 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 initial inverse transformation process, if the encoding end performs initial transformation on the residual coefficient matrix corresponding to the chrominance components by using a transformation check (DCT 2) to obtain an initial transformation coefficient matrix, the decoding end may perform initial inverse transformation on the initial transformation coefficient matrix by using a transformation check (DCT 2) to obtain a 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.
Step 326, determining the reconstructed value of the chrominance component according to the residual coefficient matrix corresponding to the chrominance 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:
step 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 an initial transformation on the residual coefficient matrix corresponding to the chrominance component (e.g., the chrominance U component or the 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 be used to perform the initial transformation, and the process of the 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 secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chrominance component of the current block. 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, where 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, the initial transform coefficient matrix corresponding to the chroma component contains non-zero transform coefficients, and the second predetermined condition may include, but is not limited to, at least one of: 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 initially transformed by a transform check (DCT2 ); 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.
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 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.
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 component is equal to or less than n1, and the height of the chrominance component is equal to or less than n 2. 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 n 2. 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 n 4. 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 n 4. The product of the width and height of the chrominance components is greater than or equal to n 5. The product of the width and height of the chrominance components is less than or equal to n 6.
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 subsequent steps and is not described herein again.
Step 414, 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.
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 on the chrominance U component 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 performed 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 and the secondary transformation are carried out on the chrominance V component. If the sixth cost value is smaller than the fifth cost value, determining to perform quadratic transformation on the 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 pre-configured context models based on the size of the chroma component of the current block, and encode the secondary transform flag based on the target context model.
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 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.
And 422, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
Step 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 component to obtain a target transformation coefficient matrix corresponding to the chrominance component.
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 secondarily, 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 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. 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 4 × 4 sub-region 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 comprises mode numbers 0-2, 4-6, 8-9, 11-12 and 14-15, and the second mode number section comprises mode numbers 0-1, 3-5, 7-8, 10-11, 13-14 and 16. If the mode number of the chroma intra prediction mode is 0-2, 4-6, 8-9, 11-12, 14-15, the mode number of the chroma intra prediction mode is within the first mode number interval. If the mode number of the chroma intra prediction mode is 0-1, 3-5, 7-8, 10-11, 13-14, or 16, the mode number of the chroma intra prediction mode 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 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 and the height of the chrominance component is equal to a 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.
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 upper left corner, in the process of performing secondary transformation on the chrominance components, if the value of the width or height of the initial transformation coefficient matrix is greater than 4, performing secondary transformation on the coefficient matrix of 4 × 4 at the upper left corner, and if the values of the width and height of the initial transformation coefficient matrix are both 4, performing secondary transformation on the initial transformation coefficient matrix, which is not described again in this secondary transformation process.
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 obtaining the final transform coefficient matrix corresponding to the chroma component, the final transform coefficient matrix corresponding to the chroma component may also be encoded in the encoded bitstream of the current block, and the encoding process is not limited.
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. And if the final transform coefficient matrix corresponding to the chroma U component does not contain the non-zero transform coefficient and the final transform coefficient matrix corresponding to the chroma V component does not contain the non-zero transform coefficient, the UV component is not coded in the coded bit stream and shares the secondary transform zone bit.
For example, in an application scenario in which a U component secondary transform flag and a V component secondary transform flag are applied, if a non-zero transform coefficient is included in a final transform coefficient matrix corresponding to a chrominance U component, the U component secondary transform flag is encoded in an encoded bitstream, and if a non-zero transform coefficient is not included in a final transform coefficient matrix corresponding to a 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, 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 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 chroma U component transformation coefficient zone bit is the first value, determining that the final transformation coefficient matrix corresponding to the chroma 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 chroma V component transformation coefficient zone bit is the second value, determining that the final transformation coefficient matrix corresponding to the chroma 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-chrominance secondary transformation flag from the coded bit stream, where the luminance-chrominance secondary transformation flag is a luminance component, and a chrominance U component and a chrominance V component share the secondary transformation flag, and when the luminance-chrominance secondary transformation flag takes a first value, indicating that a luminance component, a chrominance U component and a chrominance V component are subjected to secondary inverse transformation simultaneously, or when the luminance-chrominance secondary transformation flag takes a second value, indicating that neither the luminance component nor the chrominance U component nor the chrominance V component is subjected to secondary inverse transformation.
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 carrying out 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, carrying out inverse quantization on the final transformation coefficient matrix corresponding to the chroma U component to obtain a target transformation coefficient matrix corresponding to the chroma U component, and carrying out inverse quantization on the final transformation coefficient matrix corresponding to the chroma V component to obtain a target transformation coefficient matrix corresponding to the chroma 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 bright chroma transformation flag bit from the coded bit stream of the current block. If the value of the secondary luminance and chrominance transform flag bit is the first value, the decoding end determines that the secondary inverse transform is simultaneously 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 of the current block. And if the value of the secondary luminance and chrominance conversion flag bit is the second value, the decoding end determines that the secondary inverse conversion is not carried out on the target conversion coefficient matrix corresponding to the luminance component, the target conversion coefficient matrix corresponding to the chrominance U component and the target conversion coefficient matrix corresponding to the chrominance V component of the current block.
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 non-zero transform coefficients, and comprises 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 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 is subjected to initial inverse transformation by adopting a transformation check (DCT2 ); the chroma intra-frame prediction mode of the current block meets a 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 luma dct 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 analyzes the secondary conversion flag bit of the brightness and the chroma from the coded bit stream by adopting a bypass decoding mode.
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: 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 bright chroma 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 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 secondary transform at the same time, the target transform coefficient matrix corresponding to the luminance component is subjected to inverse secondary transform 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 secondary transform 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 secondary transform 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 transformation 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 the second inverse transformation on the target transform coefficient matrix corresponding to the luminance component 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 designated 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 chrominance U component to obtain a residual error coefficient matrix corresponding to the chrominance 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 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.
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 will not be repeated herein.
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 comprises at least one of the following conditions: 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 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 is initially transformed by a transform check (DCT2 ); the chroma intra-frame prediction mode of the current block meets a 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 transformation coefficient matrix corresponding to the chrominance component (e.g., the chrominance U component and the chrominance V component) to obtain the target transformation coefficient matrix corresponding to the chrominance component, 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 transform coefficient matrix corresponding to the luminance component to obtain a final transform coefficient matrix corresponding to the luminance component, quantizing the target transform coefficient matrix corresponding to the chrominance U component to obtain a final transform coefficient matrix corresponding to the chrominance U component, and quantizing the target transform coefficient matrix corresponding to the chrominance V component to obtain a final transform coefficient matrix corresponding to the chrominance 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, 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, 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.
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, the value of the luma and chroma quadratic transformation flag is a first value for indicating that the inverse transformation is performed on the luma component, the chroma U component and the chroma V component at the same time, or the value of the luma and chroma quadratic transformation flag is a second value for indicating that the inverse transformation is not performed on the luma component, the chroma U component and the chroma V component at the same time.
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 brightness component, the initial transformation coefficient matrix corresponding to the chromaticity U component and the initial transformation coefficient matrix corresponding to the chromaticity 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 quadratic transform flag is encoded in the encoded bitstream of the current block, and a value of the luminance and chrominance quadratic transform flag is a 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 secondary luminance and chrominance 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 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 represents 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 represents 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 and is equal to 1 to indicate 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 chroma U component and the chroma V component share a secondary transformation flag bit, which may be a UV component sharing secondary transformation flag bit, and the UV component sharing secondary transformation flag bit is denoted as st _ chroma _ flag, which may also be named as StChromaFlag.
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 at the upper left corner 4 × 4 of a target transformation coefficient matrix corresponding to the chrominance U component, the transformation coefficient of the region at the upper left corner 4 × 4 is updated, an initial transformation coefficient matrix corresponding to the chrominance U component is obtained, and then 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 region of the upper left corner 4 x 4 of a target transformation coefficient matrix corresponding to the chromaticity 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 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 encoding 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 encoding bit stream of the current block, wherein st _ chroma _ flag is equal to 0 in the encoding bit stream.
If the decision is made to carry out secondary transformation on the chrominance U component and the chrominance V component at the same time, 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, and 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. 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, wherein ctp _ U indicates whether a final transform coefficient matrix corresponding to a chroma U component of the current block contains a non-zero transform coefficient, ctp _ V indicates whether a final transform coefficient matrix corresponding to a chroma V component of the current block contains a non-zero transform coefficient, for example, ctp _ U-0 indicates 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 indicates 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 indicates 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 indicates that the final transform coefficient matrix corresponding to the chroma V component of the current block contains 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 component (such as chrominance U component and/or chrominance V component) of the current block contains a non-zero transform coefficient, the final transform coefficient matrix corresponding to the chrominance component 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 component, so that a target transform coefficient matrix corresponding to the chrominance component is obtained.
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 at the upper left corner 4 × 4 of a target transformation coefficient matrix corresponding to the chrominance U component, the transformation coefficient of the region at the upper left corner 4 × 4 is updated, an initial transformation coefficient matrix corresponding to the chrominance U component is obtained, and then 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 region of the upper left corner 4 x 4 of a target transformation coefficient matrix corresponding to the chromaticity 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 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 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 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, 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 EstEnableFlag allows the Chroma 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.
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 encoded bitstream of the current block, encoding transform coefficient flag bits ctp _ U and ctp _ V in an encoded bitstream, ctp _ U indicating whether a final transform coefficient matrix corresponding to a chrominance U component of a current block contains a non-zero transform coefficient, ctp _ V indicating whether a final transform coefficient matrix corresponding to a chrominance V component of the current block contains a non-zero transform coefficient, for example, ctp _ U-0 indicates that the final transform coefficient matrix corresponding to the chroma U component of the current block does not include a non-zero transform coefficient, ctp _ U-1 indicates that the final transform coefficient matrix corresponding to the chroma U component of the current block includes a non-zero transform coefficient, ctp _ V-0 indicates that the final transform coefficient matrix corresponding to the chroma V component of the current block does not include a non-zero transform coefficient, and ctp _ V-1 indicates that the final transform coefficient matrix corresponding to the chroma V component of the current block includes 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 a non-zero transform coefficient, 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 decision is made to carry out secondary transformation on the chrominance U component and the chrominance V component at the same time, 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, and 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. 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 encoded bitstream of the current block, encoding transform coefficient flag bits ctp _ U and ctp _ V in an encoded bitstream, ctp _ U indicating whether a final transform coefficient matrix corresponding to a chrominance U component of a current block contains a non-zero transform coefficient, ctp _ V indicating whether a final transform coefficient matrix corresponding to a chrominance V component of the current block contains a non-zero transform coefficient, for example, ctp _ U-0 indicates that the final transform coefficient matrix corresponding to the chroma U component of the current block does not include a non-zero transform coefficient, ctp _ U-1 indicates that the final transform coefficient matrix corresponding to the chroma U component of the current block includes a non-zero transform coefficient, ctp _ V-0 indicates that the final transform coefficient matrix corresponding to the chroma V component of the current block does not include a non-zero transform coefficient, and ctp _ V-1 indicates that the final transform coefficient matrix corresponding to the chroma V component of the current block includes 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 a non-zero transform coefficient, 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 resolving condition 2 may refer to the second preset condition of embodiment 3, and is not described herein again.
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 the context-based binary arithmetic coding method or the context-based decoding method 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 it needs to encode the st _ chroma _ flag, 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 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-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 encoding end uses the context model 1 as the target context model, encodes the st _ chroma _ flag 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, 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 the 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 encoding end uses the context model 1 as the target context model, encodes the st _ chroma _ flag 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 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. For the encoding side, if the mode number of the chroma intra prediction mode of the current block is located at 11-16(EPMC, EPMC _ L, EPMC _ T, EPMC2, 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 pre-configured context models, 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 value 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 after transformation is performed by (DCT 2), then, 4 × 4 transformation coefficients at the upper left corner of the initial transformation coefficient matrix are multiplied by the secondary transformation matrix to obtain new transformation coefficients, the new transformation coefficients are used for replacing 4 × 4 transformation coefficients at the upper left corner of the initial transformation coefficient matrix 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 entropy decoding of a code stream 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 4 x 4 transform coefficient 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 DCT residual coefficients.
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. Cij=coeffijI is 0 to 3 and j is 0 to 3, and in the above formula, c isijIs an element of the matrix C, coeffijAre elements of a matrix of transform coefficients. Illustratively, 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. Cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pijElements of a matrix P of 4 x 4, calculation of the matrix PThe method is as follows: p ═ CxS4,S4Is a 4 x 4 inverse transformation matrix, Clip3(-32768, 32767, (p)ij+26)>>7) Is shown if c ijIs between-32768 and 32767, then cijHas a value of (p)ij+26)>>7 if cijA value of less than-32768, then cijHas a value of-32768, if cijIf the value of (3) is greater than 32767, then cijHas a value of 32767. Illustratively, 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. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qijIs an element of a 4 x 4 matrix Q, which is calculated as follows: q ═ S4 T×C,S4 TIs S4Transposed matrix of (1), S4Is a 4 x 4 inverse transform matrix. And obtaining a vertical inverse transformation moment after vertical inverse transformation is carried out on the horizontal inverse transformation matrix.
4. Modifying values of elements of the target transform coefficient matrix according to the vertical inverse transform moment: coeffij=cijI is 0 to 3, and j is 0 to 3. Namely, the transformation coefficients of the 4 x 4 region 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 ofij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows: v ═ D 4 T×CoeffMatrix,D4 TIs an inverse transformation matrix D4The transpose matrix of (1), CoeffMatrix being a transform coefficient. Illustratively, the vertical inverse transform is performed on the target transform coefficient matrixThe resulting matrix K is then the vertical inverse transform matrix.
2. And performing the following horizontal inverse transformation on the matrix K to obtain a matrix H: h isij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 22-BitDepth, matrix W: w ═ KXD4,D4Is an inverse transform matrix. For example, 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 again after the second inverse transform is performed.
Example 12: in addition to embodiments 8, 9 and 11, regarding the chrominance components (such as the chrominance U component and the chrominance V component), in the secondary inverse transform process, it may be determined whether to perform the horizontal inverse transform and the 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. Cij=coeffijI is 0 to 3 and j is 0 to 3, and in the above formula, c isijIs an element of the matrix C, coeffijAre elements of a matrix of transform coefficients. Illustratively, 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 IntracchromaPredMode is 0-2, 4-6, 8-9, 11-12, 14-15, the coefficient matrix C is subjected to the following horizontal inverse transformation: c. Cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pijIs the element of 4 x 4 matrix P, which is calculated as follows: p ═ CxS4,S4Is a 4 x 4 inverse transform matrix. Illustratively, the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix. The value of IntraChromaPredMode is 0-2, 4-6, 8-9, 11-12, 14-15, which indicates that the mode number of the chroma intra prediction mode is in the first mode number interval.
3. If the value of IntracchromaPredMode is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, the following vertical inverse transformation is performed on the coefficient matrix: c. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qijIs an element of a 4 x 4 matrix Q, which is calculated as follows: q ═ S4 T×C,S4 TIs S4Transposed matrix of (1), S4Is a 4 x 4 inverse transform matrix. And obtaining a vertical inverse transformation moment after vertical inverse transformation is carried out on the coefficient matrix, wherein the value of the IntraChromaPredMode is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, and the mode number of the chroma intra-frame prediction mode is in a second mode number interval. For example, if the coefficient matrix C is not subjected to horizontal inverse transformation before step 3, then in step 3, the coefficient matrix C is directly subjected to vertical inverse transformation. 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: coeffij=cijI is 0 to 3, and j is 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 coefficients are aligned firstAnd the matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix, then the horizontal inverse transformation matrix is subjected to vertical inverse transformation 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 subjected to 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 SecondaryTransformEnableFlag is equal to 1, and the value of 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,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows: v ═ D4 T×CoeffMatrix,D4 TIs an inverse transformation matrix D4The transpose matrix of (1), CoeffMatrix being a transform coefficient. 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 isij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 22-BitDepth, matrix W: w ═ KXD4,D4Is an inverse transform matrix. For example, 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 again 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, st _ cb _ flag may also be named StCbFlag, and 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 region 4 x 4 at the upper left corner of a target transformation coefficient matrix corresponding to the chroma U component, updating the transformation coefficient of the region 4 x 4 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 subjected to the secondary inverse transform, and when st _ cr _ flag is equal to 1, it means that the chrominance V component is subjected to the secondary inverse transform. And if the chroma V component is subjected to secondary inverse transformation, carrying out secondary inverse transformation on a region 4 x 4 at the upper left corner of a target transformation coefficient matrix corresponding to the chroma V component, updating the transformation coefficient of the region 4 x 4 at the upper left corner 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 is used to indicate that a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient, e.g., ctp _ U is 1. The resolving 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 condition 3 and the parsing condition 4 may further include optional parsing conditions, and these optional parsing conditions 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 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 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 chrominance 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 decision is made to carry out secondary transformation on the chrominance V component, carrying out primary transformation on a residual coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V 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 V component to obtain a target transformation coefficient matrix corresponding to the chrominance V component, quantizing the target transformation coefficient matrix corresponding to the chrominance V component to obtain a final transformation coefficient matrix corresponding to the chrominance V component, coding the final transformation coefficient matrix corresponding to the chrominance V component in the coding bit stream of the current block, and coding st _ cr _ flag 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 resolving 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, and the context model serves 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. For another example, at least two context models based on the size of the chroma component of the current block are pre-configured, and may each be a target context model.
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. For another example, at least two context models based on the size of the chroma component of the current block are pre-configured, and may each be a target context model.
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, the inverse transform process at the decoding side is similar to the inverse transform process of embodiment 11 or embodiment 12 with respect to the chroma U component, it suffices to replace the condition of the case one of embodiment 11 or embodiment 12 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 secondarytransformableflag 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 to replace the condition of the case two of embodiment 11 or embodiment 12 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 the specific inverse transform process is the same as the case one and case two of embodiment 11 or embodiment 12, and will not be repeated herein.
Similarly, on the basis of embodiment 13, regarding the chroma V component, the inverse transform process at the decoding side is similar to the inverse transform process of embodiment 11 or embodiment 12, replacing the condition of the case one of embodiment 11 or embodiment 12 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", replacing the condition of the case two of embodiment 11 or embodiment 12 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 secondarytransformenflag 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 specific inverse transform process is the same as the case one and the case two of embodiment 11 or embodiment 12, and will not be repeated herein.
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 secondary inverse transformation, secondary inverse transformation is performed on an upper left corner 4 × 4 region of a target transformation coefficient matrix corresponding to the luminance component, the transformation coefficient of the upper left corner 4 × 4 region is updated, an initial transformation coefficient matrix corresponding to the luminance component is obtained, and then initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the luminance component, so that a residual error coefficient matrix corresponding to the luminance component is obtained. 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 _ v is 1, and ctp _ y is 1, which 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 a transformation coefficient 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 mode of the context model, and the encoding mode and the decoding mode of the st _ tu _ flag, refer to embodiment 10, and it is sufficient to replace the st _ chroma _ flag with the st _ tu _ flag, which is not repeated in this embodiment 17.
Example 18: in 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 components, the condition of the first case of embodiment 11 is replaced by "if the current block is an intra-frame luminance prediction residual block, the value of the width or height of the current block is greater than 4, and the value of the secondryformenableflag is equal to 1, and the value of the est _ tu _ flag is equal to 1", and the condition of the second case of embodiment 11 is replaced by "if the current block is an intra-frame luminance prediction residual block, the values of the width and height of the current block are equal to 4, and the value of the secondrormenableflag is equal to 1, and the value of the est _ tu _ flag is equal to 1", and the specific inverse transform process is the same as the first case and the second case of embodiment 11, and will not be 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, M1Or M2Is 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:
cij=coeffij,i=0~3,j=0~3
in the formula cijIs an element of the matrix C, coeffijAre 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 transformemplication 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 the IntraLumaPredMode has a value of 0-2 or 13-32 or 44-65, and a reference sample with coordinates (x0-1, y0+ j-1) (j ═ 1-N) "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. Cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3
In the formula pijAre elements of a 4 x 4 matrix P. The matrix P is calculated as follows:
P=C×S4
wherein S4Is 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 luma prediction residual block, if EstEnableFlag is non-zero and the transformemplication 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 ~ 23 or 34 ~ 57, and a reference sample with coordinates of (x0+ i-1, y0-1) (i ═ 1 ~ M) "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. Cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3
In the formula qijAre elements of a 4 x 4 matrix Q. The matrix Q is calculated as follows:
Q=S4 T×C
in the formula S4 TIs S4The transposing of (1).
4) Modifying the values of the elements of the transform coefficient matrix according to matrix C:
coeffij=cij,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, M1And M2Equal 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 ofij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1
In the formula vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows:
V=D4 T×CoeffMatrix
in the formula D4 TIs an inverse transformation matrix D4The 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:
kij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1
in the formula vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows:
if the sequence number of the transform block is 0 or 1: then
V=DCT8M2 T×CoeffMatrix
DCT8 in formulaM2 TIs DCT8M2The transposed matrix of (DCT 8)M2Is M2×M2And inversely transforming the matrix.
Otherwise, if the sequence number of the transform block is 2 or 3: then
V=DST7M2 T×CoeffMatrix
Wherein DST7M2 TIs DST7M2Transposed matrix of (DST 7)M2Is M2×M2And 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:
kij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1
in the formula vijIs an element of the matrix V, kijAre elements of matrix K. The matrix V is calculated as follows:
if sbtdiflag is 1 and SbtPosFlag is 0: then
V=DCT8M2 T×CoeffMatrix
DCT8 in formulaM2 TIs DCT8M2The transposed matrix of (DCT 8)M2Is M2×M2And inversely transforming the matrix.
Otherwise:
V=DST7M2 T×CoeffMatrix
wherein DST7M2 TIs DST7M2Transposed matrix of (DST 7)M2Is M2×M2And inversely transforming the matrix.
Thirdly, otherwise:
kij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1
in the formula vijIs an element of the matrix V, k ijAre elements of matrix K. The matrix V is calculated as follows:
V=DCT2M2 T×CoeffMatrix
DCT2 in formulaM2 TIs DCT2M2The transposed matrix of (DCT 2)M2Is M2×M2And 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, M1And M2Equal 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:
hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1
in the formula wi,jIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal 22-BitDepth. The matrix W is calculated as follows:
W=K×D4
in the formula D4Is an 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:
hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1)i=0~M1-1,j=0~M2-1
in the formula wijIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal 20-BitDepth. The matrix W is calculated as follows:
If the sequence number of the transform block is 0 or 2: then
W=K×DCT8M1
Otherwise, if the sequence number of the transform block is 1 or 3: then
W=K×DST7M1
DCT8 in formulaM1、DST7M1Is M1×M1And 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:
hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1)i=0~M1-1,j=0~M2-1
in the formula wijIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal 20-BitDepth. The matrix W is calculated as follows:
if sbtdiflag is 0 and SbtPosFlag is 0: then
W=K×DCT8M1
Otherwise:
W=K×DST7M1
DCT8 in formulaM1、DST7M1Is M1×M1And inversely transforming the matrix.
Thirdly, otherwise:
hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1) i=0~M1-1,j=0~M2-1
in the formula wijIs an element of the matrix W, hijAre elements of the matrix H. MaxValue has a value of (1)<<BitDepth) -1, shift1 equal to 20-BitDepth (th). The matrix W is calculated as follows:
W=K×DCT2M1
DCT2 in formulaM1Is M1×M1And 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 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.
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? (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 the sub-pixel points, and 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? (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 those near the boundary have different prediction values, the conventional DC value is still used for the inside pixels (not the pixels of the first two lines or 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, referring to 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 is used as the predicted value of the a position; 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 located 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 individually, 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 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; 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 is subjected to initial inverse transformation by adopting a transformation check (DCT2 ); 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 is used to indicate that a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and the method 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 secondary transform flag is a common secondary transform flag for the UV components; and when the value of the UV component sharing secondary transformation zone bit is a first value, the method is used for indicating that secondary inverse transformation is simultaneously carried out on the chrominance U component and the chrominance V component, or when the value of the UV component sharing secondary transformation zone bit is a second value, the method is used for indicating that secondary inverse transformation is not carried out on the chrominance U component and the chrominance 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 chroma 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 chroma 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; a processing module 623, 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 initially transformed using a transform kernel (DCT2 ); 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 component is a chrominance U component and a chrominance V component, and the secondary transformation flag bit includes a U component secondary transformation flag bit and a V component secondary transformation 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 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.
In terms of hardware, the schematic diagram of the hardware architecture of the decoding-side device (the decoding-side device may be a video decoder) provided in the embodiment of the present application 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 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.
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 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 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.
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, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with certain functionality. A typical implementation is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. The present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (15)

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 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;
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 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 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,
parsing, from the encoded bitstream, quadratic transform flags for block-level chroma components, comprising:
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 encoded bitstream based on a pre-configured separate context model.
5. An encoding method applied to an encoding end, the method comprising:
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 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 secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component includes:
Determining a first cost value when only the initial transformation is performed on the chrominance U component and the chrominance V component;
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.
7. The method of claim 5, wherein the determining whether to perform secondary transformation on the initial transform coefficient matrix corresponding to the chroma component 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 device is characterized in that, applied to a decoding end,
the decoding apparatus comprises means for implementing the method of any one of claims 1-4.
12. An encoding device, which is applied to an encoding end,
The encoding apparatus comprises means for implementing the method of any one of claims 5-10.
13. 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.
14. 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.
15. 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 true CN113709481A (en) 2021-11-26
CN113709481B 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709480B (en) * 2020-12-10 2022-12-23 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment
CN114222132B (en) * 2022-01-13 2024-05-14 北京达佳互联信息技术有限公司 Video decoding inverse transformation method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277514A (en) * 2011-10-19 2017-10-20 株式会社Kt The method of decoding video signal
CN110881127A (en) * 2018-09-06 2020-03-13 腾讯美国有限责任公司 Method, apparatus, computer device and storage medium for controlling residual coding
CN110999304A (en) * 2017-07-28 2020-04-10 韩国电子通信研究院 Image processing method and image encoding/decoding method and apparatus using the same
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

Family Cites Families (1)

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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277514A (en) * 2011-10-19 2017-10-20 株式会社Kt The method of decoding video signal
CN110999304A (en) * 2017-07-28 2020-04-10 韩国电子通信研究院 Image processing method and image encoding/decoding method and apparatus using the same
CN110881127A (en) * 2018-09-06 2020-03-13 腾讯美国有限责任公司 Method, apparatus, computer device and storage medium for controlling residual coding
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

Also Published As

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

Similar Documents

Publication Publication Date Title
US11902509B2 (en) Method and device for encoding/decoding image, and recording medium storing bit stream
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
CN112911312B (en) Encoding and decoding method, device and equipment
AU2019210553A1 (en) Enhanced intra-prediction coding using planar representations
CN113473129B (en) Encoding and decoding method and device
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