[go: up one dir, main page]

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

Encoding and decoding method, device and equipment Download PDF

Info

Publication number
CN114630119B
CN114630119B CN202011455990.XA CN202011455990A CN114630119B CN 114630119 B CN114630119 B CN 114630119B CN 202011455990 A CN202011455990 A CN 202011455990A CN 114630119 B CN114630119 B CN 114630119B
Authority
CN
China
Prior art keywords
component
transformation
chroma
transformation coefficient
matrix corresponding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011455990.XA
Other languages
Chinese (zh)
Other versions
CN114630119A (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
Priority to CN202011455990.XA priority patent/CN114630119B/en
Priority to CN202111153132.4A priority patent/CN113709480B/en
Publication of CN114630119A publication Critical patent/CN114630119A/en
Application granted granted Critical
Publication of CN114630119B publication Critical patent/CN114630119B/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 an encoding and 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, analyzing a secondary transformation zone bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation zone bit is used for indicating to perform secondary inverse transformation on the chroma component or not performing secondary inverse transformation on the chroma component; if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit. The coding performance is improved by the present application.

Description

Encoding and decoding method, device and equipment
Technical Field
The present disclosure relates to the field of coding and decoding technologies, and in particular, to a coding and decoding method, apparatus, and device thereof.
Background
For space saving purposes, video images are encoded before transmission, and the complete video encoding method may include prediction, transformation, quantization, entropy encoding, filtering, and the like. Predictive coding may include intra-coding and inter-coding. Inter-frame coding is to use the correlation of video time domain and the pixels adjacent to the coded image to predict the pixels of the current image, so as to achieve the purpose of removing the video time domain redundancy. In the intra-frame coding, the fact that strong spatial correlation exists between adjacent blocks is considered, surrounding reconstructed pixels are used as reference pixels, the current uncoded block is predicted, the residual error value is only required to be subjected to subsequent coding processing instead of the original value, redundancy in the spatial domain is effectively removed, and compression efficiency is greatly improved.
In video coding, transformation refers to converting an image described in the form of pixels in the spatial domain into an image in the transform domain and is represented in the form of transform coefficients. Because most images contain more flat areas and areas which change slowly, the proper transformation process can lead the image energy to be distributed in a scattered way in a space domain and be converted into relatively concentrated way in a transformation domain, thereby removing the frequency domain correlation among signals and effectively compressing the code stream by matching with the quantization process.
For the transformation process, a secondary transformation technique is proposed in the related art. The secondary transformation technique refers to: firstly, initial transformation is carried out to obtain transformation coefficients after the initial transformation. Then, the transformed coefficient after the initial transformation is subjected to secondary transformation to obtain a new transformed coefficient. Then, quantization, entropy coding, and the like are performed on the new transform coefficients. However, how to perform secondary transformation on the luminance component and the chrominance component of the current block has no effective implementation at present, and has the problem of poor coding performance.
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 transformation coefficient flag bit from the coded bit stream, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transformation coefficient or not;
if the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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;
If the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
The application provides an encoding method, which is applied to an encoding end, and comprises the following steps: acquiring a residual coefficient matrix corresponding to a 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 an initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; quantizing a target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component, and coding a transformation coefficient flag bit in a coded bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient; coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component; wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
The application provides a decoding device, is applied to the decoding end, the device includes: an acquisition module, configured to acquire a coded bitstream of a current block; a decoding module, configured to parse a transform coefficient flag bit from the encoded bitstream, where the transform coefficient flag bit 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, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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; if the final transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream; the processing module is used for carrying out inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and the determining module is used for determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
The application provides a coding device, is applied to the coding end, the device includes: the acquisition module is used for acquiring a residual coefficient matrix corresponding to the chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; the determining module is used for determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component if the current block meets a second preset condition, so as to obtain a target transformation coefficient matrix corresponding to the chrominance component; the processing module is used for quantizing the target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component; the coding module is used for coding a transformation coefficient flag bit in the coding bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient or not; coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component; wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
The application provides a decoding end device, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine-executable instructions to perform the steps of:
acquiring a coded bit stream of a current block, and analyzing a transformation coefficient flag bit from the coded bit stream, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transformation coefficient or not;
if the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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;
if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
The 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:
acquiring a residual coefficient matrix corresponding to a 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 an initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
quantizing a target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component, and coding a transformation coefficient flag bit in a coded bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient;
coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component;
Wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
As can be seen from the above technical solutions, in the embodiments of the present application, after performing initial transformation on a chrominance component of a current block, whether to perform secondary transformation on the chrominance component of the current block can be determined, if yes, the secondary transformation can be performed on the chrominance component of the current block, that is, the secondary transformation technique can also be applied to the chrominance component of the current block, and when the chrominance component has a problem of insufficient energy concentration after the initial transformation, the secondary transformation can also be performed on the chrominance component, thereby improving coding performance and coding efficiency.
Drawings
FIGS. 1A-1C are schematic diagrams of DT partitioning patterns in one embodiment of the present application;
FIG. 1D is a schematic diagram of a luminance intra prediction mode in one embodiment of the present application;
FIGS. 1E-1L are diagrams illustrating application of intra prediction filtering in one embodiment of the present application;
FIG. 2 is a schematic diagram of a video encoding framework in one embodiment of the present application;
FIGS. 3A and 3B are flowcharts of a decoding method in one embodiment of the present application;
FIGS. 4A and 4B are flowcharts 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 in one embodiment of the present application;
FIG. 6B is a block diagram of an encoding device in one embodiment of the present application;
FIG. 7A is a hardware configuration diagram of a decoding side device in an embodiment of the present application;
fig. 7B is a hardware configuration diagram of an encoding end device in an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the 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 herein, 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 refers to any or all possible combinations including one or more of the associated listed items. It should be understood that although the terms first, second, third, etc. may be used in embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly the second information may also be referred to as first information, depending on context, and furthermore, the word "if" used may be interpreted as "at … …", or "when … …", or "in response to a determination", without departing from the scope of the present application.
In order to enable those skilled in the art to better understand the technical solutions of the present application, technical terms are briefly described below.
Predicted pixel (Prediction Signal): the method is characterized in that pixel values derived from encoded and decoded pixels are subjected to residual transformation, quantization, coefficient coding and other processes by obtaining residual errors through differences between original pixels and predicted pixels.
Intra Prediction (Intra Prediction): refers to a prediction mode in which a prediction value of a current block is predicted by reconstructed pixel values of a surrounding decoded region. Common ways include copying pixels in angular direction and deriving predictions in accordance with a certain gradient principle. Illustratively, intra prediction removes spatial correlation of video/images.
Transform kernel: in video coding, transformation is an indispensable stage for realizing data compression, transformation can make the energy of a signal more concentrated, and a transformation technique based on discrete cosine transformation (DCT, discrete Cosine Transform)/discrete sine transformation (DST, discrete Sine Transform) has been a transformation technique of the mainstream of video coding. The DCT and DST are further specifically divided into a plurality of transform kernels according to the difference of the basis functions, and three transform kernels are shown, see Table 1.
TABLE 1
Figure BDA0002828877170000041
Forward transform (forward transform) and inverse transform (inverse transform): in video coding, a forward transform, also called forward transform, and an inverse transform, also called reverse transform, are involved. For example, the forward transform is to convert a two-dimensional residual coefficient (which may also be referred to as residual signal) into a two-dimensional transform coefficient (which may also be referred to as spectrum signal) with more concentrated energy, and the transform coefficient is further subjected to quantization and other processes, so that the high-frequency component can be effectively removed, and the middle-low frequency component is reserved, thereby playing a role in compression. For example, the forward transform process may be represented by a matrix form of formula (1).
F=B·f·A T Formula (1)
In formula (1), M represents the width of a residual block (i.e., a block of residual coefficients), N represents the height of the residual block, F represents an original residual signal in dimension n×m, F represents a frequency domain signal in dimension n×m (i.e., a converted frequency domain signal), a and B represent transform matrices in dimensions m×m and n×n, and both a and B satisfy orthogonality, as the transform kernels shown in table 1.
The inverse transform (also called inverse transform) is the inverse of the forward transform, i.e. the frequency domain signal F is converted into a time domain residual signal F by means of an orthogonal transform matrix a and an orthogonal transform matrix B. For example, the inverse transformation process may be represented by a matrix form of formula (2).
f=B T F.A formula (2)
Horizontal transform (Horizental transform) and vertical transform (Vertical transform): in the code conversion stage, a two-dimensional residual signal is input, and x=a·f is set T F=b·x T For example, the expression is represented by a matrix form of formula (3).
F=B·f·A T =B·(A·f T ) T Formula (3)
In summary, it can be seen that the positive transformation of the two-dimensional signal can be implemented by two one-dimensional positive transformations, and a signal X of m×n is obtained after the first positive transformation, so as to remove the correlation between pixels in the horizontal direction of the two-dimensional residual signal, so that the first positive transformation is called horizontal transformation, and a is called horizontal transformation matrix. The signal F is obtained after the second positive transform, and the correlation between the pixels in the vertical direction of the two-dimensional residual signal is removed, and therefore, the second positive transform is called a vertical transform, and B is called a vertical transform matrix.
Transform pair (Transform pair): also called transform collation, M is not necessarily equal to N, a and B in dimension is not necessarily equal to each other in order to support a matrix block, and it is also possible to support a transform matrix in which a and B are not produced by the same type of transform core, and therefore, there is a transform pair { H, V } composed of transform cores corresponding to a and B in the transform, H is called a horizontal transform core, and V is called a vertical transform core.
Rate distortion principle (RDO, rate-Distortion Optimized): there are two major indicators for evaluating coding efficiency: code rate and PSNR (Peak Signal to Noise Ratio ). The smaller the bit stream, the greater the compression rate; the greater the PSNR, the better the reconstructed image quality. In mode selection, the discrimination formula is essentially an integrated evaluation of both.
Cost value corresponding to pattern: j (mode) =d+λ×r. Illustratively, D represents the disfigurement, typically measured using an SSE index, which refers to the sum of the mean squares of the differences between the reconstructed block and the source image; lambda is the Lagrangian multiplier; r is the actual number of bits required for coding an image block in this mode, including the sum of bits required for coding mode information, motion information, residuals, etc. In the mode selection, if the RDO principle is used to make a comparison decision on the coding mode, the best coding performance can be generally ensured.
Derivative Tree (DT) partition mode: the DT division pattern is a new division pattern, and a new division shape is generated, so that performance gain can be further obtained. Referring to fig. 1A, a schematic diagram of qtbt+eqt+dt is shown, and when the derivative mode flag is 0, it indicates that no division is performed, and when the derivative mode flag is 1, it indicates that the derivative mode is used, and the derivative modes are specifically divided into a horizontal derivative mode (2n×hn, 2n×nu, 2n×nd) and a vertical derivative mode (hn× N, nL × N, nR ×2n). For a CU that does not use DT, its PU mode is 2n×2n, where 2 '2N's represent widths and heights are not necessarily equal, the first '2N' represents the width of the PU and CU, and the second '2N' represents the height of the PU and CU. For 2NxhN, '2N' means that the width of the PU is equal to the CU, and 'hN' means that the height of the PU is equal to 1/4 of the height of the CU.
The derived modes may be grown on leaf nodes of a quadtree or binary tree, as shown in fig. 1B, and the derived modes may be used for intra prediction generated prediction and transform blocks by merging partition boundaries continuously for coding units to obtain different PU partitions (2nxhn, 2nxnu, 2nxnd, hnx 2N, nL x 2N, nR x 2N) of the derived modes.
The derived mode can be matched with QTBT and EQT to generate richer block division, so that more performances are obtained.
Referring to fig. 1C, for Intra mode (i.e., intra prediction mode), a coding unit that predicts using a derived mode may use 4 non-blocks for transform quantization, and no new transform kernel needs to be introduced.
Luminance intra prediction mode of AVS 3: AVS2 has a total of 33 luminance intra prediction modes, including 30 angle modes and 3 special modes (DC, plane, and Bilinear). To support finer angle prediction, AVS3 proposes to extend the angle modes to 62, plus 3 special modes, for a total of 65 modes. Referring to fig. 1D, for a schematic view of the intra-frame prediction mode of luminance, the mode number of the original angle mode is unchanged, 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 total 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, tscpm_ L, TSCPM _t, etc.) and a PMC mode (e.g., PMC, pmc_ L, PMC _ T, EPMC, 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 the Luma PCM mode (or named Luma ipdm or Intra Luma PCM) and the Chroma prediction mode of the current block is the DM mode, the Chroma prediction mode of the current block is the Chroma PCM mode (or named Chroma ipdm or Intra Chroma PCM).
The TSCPM mode is a technology for predicting components, removes inter-component redundancy by exploring a linear relation between different components, and can be divided into two steps, firstly, a Co-localized 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 predicted value of a chroma component.
For example, 4 available pixel point pairs can be obtained according to the availability of the pixels of the adjacent block in 3 cases, the parameter alpha and the parameter beta are calculated through the 4 available pixel point pairs, and after the parameter alpha and the parameter beta are obtained, a chromaticity predicted value is obtained through the luminance reconstruction pixel according to the linear relation between the luminance and the chromaticity. When selecting 4 pairs of available pixel points, the availability of the upper side pixel and the left side pixel can be considered, and the following 3 cases are classified: 1. if both the right upper and right left pixels of the current block are "available", 2 pixel pairs are selected from the upper side and 2 pixel pairs are selected from the left side. 2. If only the upper side of the current block is available, 4 pixel point pairs are all selected from the right upper side, and the selected position width is: 0/4,1/4,2/4,3/4. 3. If only left pixels are available for the current block, 4 pixel point pairs are all selected from the positive left side, and the selected position height is: 0/4,1/4,2/4,3/4. For case 1, enhanced TSCPM proposes two enhancement modes, tscpm_t and tscpm_l, respectively: that is, the 4 pixel pairs come from just the upper side (tscpm_t) and the 4 pixel pairs come from just the left side (tscpm_l).
In addition to predicting the chrominance components by the luminance component, AVS3 also supports predicting the Cr component by the Y component and the Cb component, i.e., PMC mode, the prediction process of which can be expressed by the following two equations: ipred=a·rec Y +B,FPred Cr =IPred′-Rec Cb X 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 downsampling IPred, and FPredCr is a final Cr component prediction value. The parameters a and B in this equation are set to (α 0 ×k+α 1 ,β 0 ×k+β 1 ),(α 0 ,β 0 ) And (alpha) 1 ,β 1 ) For the parameters α (i.e., alpha) and β (i.e., beta) of Cb and Cr in TSCPM, k is 0.5, 1 or 2, which are jointly determined by the picture level flag bit and the CU level flag bit. For example, the image head may transmit a flag bit, and if the flag bit of the image head is equal to 0, k of the image is 1 or 2; if the picture header flag bit is 1, then k of the present picture is 1 or 0.5. Each CU using EPMC mode retransmits a flag bit, one of the two k values of the present image.
For example, the intra-mode stream flag schemes of TSCPM and PMC may be as shown in table 2.
TABLE 2
Figure BDA0002828877170000061
Figure BDA0002828877170000071
Intra prediction filtering (Intra Prediction Filter, IPF): in the intra-frame prediction process, the relevance between some reference pixel points and the current prediction unit is 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, and the current intra prediction block generated mainly uses the reference pixel point of MRB, so that the left side of the prediction sample block has poor prediction effect because the correlation with URB is not considered.
To address this problem, IPF filters the intra prediction block using reference pixels in the URB. The filters in the IPF include three types, which are a horizontal 2-tap filter (see formula (4)) and a vertical 2-tap filter (see formula (5)) and a 3-tap filter (see formula (6)) that filters both the horizontal and vertical directions, respectively.
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) equation (5)
P' (x, y) =f (x) ·P (-1, y) +f (y) ·P (x, -1) + (1-f (x) -f (y))·P (x, y) equation (6)
For the luminance component, a filter is selected from among the luminance component and the current prediction value is filtered according to the intra prediction mode. 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 lower right diagonal mode. For the chrominance component, when the chrominance intra-frame prediction mode is horizontal or TSCPM_L, filtering a prediction value by adopting a vertical 2-tap filter; when the chroma intra prediction mode is vertical or tscpm_t, the prediction value is filtered using a horizontal 2-tap filter.
If the current intra prediction block size is m×n, for a pixel with coordinates (i, j) in the block, the filter coefficients f [ i ] and f [ j ] corresponding to the 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 Table 3
Figure BDA0002828877170000072
Improved intra prediction (Improved Intra Prediction, IIP) mode: IIP improves four aspects of intra-luminance prediction compared to a conventional intra-luminance prediction mode, and improvement of intra-luminance prediction in the IIP mode in the present application is described below.
Wherein an improvement with respect to the angular pattern. To get a more accurate predicted pixel, the original 4-tap interpolation filter can be replaced with an 8-tap interpolation filter to generate the reference pixel of the sub-pixel point, 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 which is implicitly derived based on the size of the current block and the rank index number, and the index of which is derived using the following formula: filter_idx=mipf_enable_flag? (j < 1. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current block, respectively.
Among other things, improvements with respect to DC mode. For the traditional DC mode: for a luma block, the reference samples above the current block are denoted as ri]The reference sample to the left of the current block is denoted c [ j ]],r[0]Equal to c0]If i is greater than 2M, r [ i ]]=r[2M]If j is greater than 2N, c [ j ]]=c[2N]. If r [ i ]]、c[j](i=1 to M, j=1 to N) are all "available", then: predMatrix [ x ]][y]=
Figure BDA0002828877170000081
If r [ i ]](i=1 to M) "available", c [ j ]](j=1 to N) "unavailable", -in>
Figure BDA0002828877170000082
Figure BDA0002828877170000083
Otherwise, if c [ j ]](j=1 to N) "available", r [ i ]](i=1 to M) "unavailable", then
Figure BDA0002828877170000084
Otherwise, predMatrix [ x][y]=2 BitDepth-1 (x=0 to M-1, y=0 to N-1; bitDepth is the encoded sample precision).
For the improved DC mode: while the conventional DC mode has the same predicted value for all pixels of the current block, for the modified DC mode, the pixels inside the current block and the pixels near the boundary have different predicted values, the conventional DC value is still used for the inside pixels (not the pixels of the first two rows or columns); for pixels close to the boundary (pixels of the first two rows or columns), as shown in fig. 1G and 1H, a weighted average of (DC value and reference pixel value) is used as the final predicted value.
For example, referring to fig. 1G, if the current pixel point is located at the first row a position, a weighted average of the reference pixels A0, A1, A2 and DC may be used as the prediction value of the a position; if the current pixel point is located at the B position of the first column, a weighted average of the reference pixels B0, B1, B2 and DC may be used as a predicted value of the B position; if the current pixel point is located at the upper left corner C position of the current block, a 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 position, a weighted average of the reference pixels D and DC may be used as a predicted value of the D position; if the current pixel point is located at the second column E position, a weighted average value of the reference pixel E and DC can be used as a predicted value of the E position; if the current pixel point is located at the upper left corner F position of the current block, a weighted average of the reference pixels F0, F1 and DC may be used as a predictor of the F position. Illustratively, the weights for the a, b, c, d, e, f positions may be as shown in table 4, and the last weight may be the weight of the DC value.
TABLE 4 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 regarding the Plane mode. For the traditional plane intra prediction process: orgPredMatrix [ x ]][y]=(ia+(x-((M>>1)-1))×ib+(y-((N>>1)-1))×ic+16)>>5(x=0~M-1,y=0~N-1)。predMatrix[x][y]=Clip1(orgPredMatrix[x][y]) (x=0 to M-1, y=0 to N-1). Illustratively, ia= (r [ M ]]+c[N])<<4,ib=((ih<<5)×imh+(1<<(ish-1)))>>ish,ic=((iv<<5)×imv+(1<<(isv-1)))>>isv,ibMult[5]={13,17,5,11,23},ibShift[5]={7,10,11,15,19},imh=ibMult[Log(M)-2],ish=ibShift[Log(M)-2],imv=ibMult[Log(N)-2],isv=ibShift[Log(N)-2],
Figure BDA0002828877170000091
Figure BDA0002828877170000092
For the modified plane mode: similar to the modified DC prediction process, the modified plane prediction process also uses the same operations, except that the object to be processed is the reference pixel value and the plane value, and a weighted average method is used for the first two rows or the first two columns of the current block to obtain a new predicted value, where specific weights are shown in table 4, and detailed descriptions are not repeated here.
Among them, improvement regarding the Bilinear mode. Traditional Bilinear mode prediction process: referring to fig. 1I, a predicted value of a lower right corner C position (weighted average of an upper right corner reference pixel a and a lower left corner reference pixel B) is generated, a predicted value of a right boundary AC position (weighted average of an upper right corner reference pixel a and a lower right corner C position predicted value), similarly, a predicted value of a lower boundary BC position (weighted average of a lower left corner reference pixel B and a lower right corner C position predicted value) is generated, and predicted values of remaining other interior 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 a weighted average of the predicted values of the left corresponding position reference pixel L and the right boundary AC position; the vertical linear prediction model generates a predicted value that is a weighted average of the predicted values of the upper corresponding position reference pixel T and the lower boundary BC position.
Exemplary, 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) xx y+ (1 < < (Log (M) +Log (N))) > > (Log (M) +Log (N) +1), (x=0 to M-1, y=0 to N-1). predMatrix [ x ] [ y ] =clip 1 (orgPredMatrix [ x ] [ y ]), (x=0 to M-1, y=0 to N-1). ia=r [ M ], ib=c [ N ], if M equals N, ic= (ia+ib+1) > >1; otherwise ic= ((ia < < Log (M)) + (ib < < Log (N))) ×weight+ (1 < < < (ishift+5)) > > (ishift+6), ishift=log (Min (M, N)), weight=bilinearweight [ Log (Max (M, N)/Min (M, N)) -1], bilinearWeight [3] = {21,13,7}.
Improved Bilinear prediction process: the number of the used reference pixels is improved, the original 1 reference pixel value is replaced by using the weighted average value of 5 reference pixels, and the weights of the 5 reference pixels are as follows: {82,252,356,252,82}, see fig. 1J.
And (3) a predicted value correction process: the predicted pixel is further modified based on the modified angular, DC, plane, bilinear mode by using the current block reference pixel, as shown in fig. 1K and 1L, for the first row or column of pixels X, the reference pixel used is labeled "D1", otherwise the reference pixel used is labeled "D2", D1 and D2 contain four different positions of reference pixels, and if the current pixel is in the first two rows or columns, the weighted average weight used is {10,216}, otherwise the weight used is {13,204}. In summary, the IIP mode includes the above five improvements, and 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.
Video coding framework applicable to the application: referring to fig. 2, the encoding-side processing flow of the embodiments of the present application may be implemented using a video encoding framework, and the schematic diagram of the video decoding framework is similar to that of fig. 2, and the description thereof will not be repeated here. In the video encoding framework and video decoding framework, may include, but is not limited to: intra prediction, motion estimation/motion compensation, reference image buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy coder, etc. At the encoding end, the processing flow of the encoding end can be realized through the coordination among the modules, and at the decoding end, the processing flow of the decoding end can be realized through the coordination among the modules.
For example, prediction is divided into intra-frame prediction and inter-frame prediction, and intra-frame prediction considers that there is strong spatial correlation between adjacent blocks in an image, and the current uncoded block can be predicted by using surrounding reconstructed pixels as reference pixels, so that residual signals (original signals-predicted signals) are only required to be subjected to subsequent coding processing, instead of the original signals, redundancy in spatial domain is effectively removed, and compression efficiency of video signals is greatly improved. Inter prediction refers to the use of the correlation in the time domain of video signals to predict the pixels of the current image using the pixels of neighboring encoded images, thereby achieving the purpose of removing video temporal redundancy.
Illustratively, in video coding, transformation refers to converting an image described in terms of pixels in the spatial domain into an image in the transform domain and is represented in terms of transform coefficients. Because most images contain more flat areas and areas which change slowly, the proper transformation process can lead the image energy to be distributed in a scattered way in a space domain and be converted into relatively concentrated way in a transformation domain, thereby removing the frequency domain correlation among signals and effectively compressing the code stream by matching with the quantization process.
By way of example, entropy coding refers to a manner of performing lossless coding according to the principle of information entropy, and is located 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 used 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 output data of the entropy coding module is a final code stream after the original video is compressed. Entropy coding can effectively remove statistical redundancy of the video element symbols, and is one of important tools for guaranteeing video coding compression efficiency.
And (3) secondary transformation: different quadratic transformation matrices are used for 4*4 blocks and non-4*4 blocks. For the coding end, transform coefficients are obtained after (DCT 2 ) transformation, the transform coefficients of 4*4 blocks at the upper left corner are multiplied by a secondary transform matrix to obtain new transform coefficients, and then quantization and entropy coding are carried out. For a decoding end, after inverse quantization is performed on a transformation coefficient obtained by entropy decoding of a code stream, a 4*4 area at the upper left corner is subjected to secondary inverse transformation to obtain a new transformation coefficient, and then the whole transformation block is subjected to inverse transformation by using (DCT 2 ) to obtain a residual coefficient. The reverse transformation process of the secondary transformation specific decoding end is as follows:
in 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 a secondary transform enable flag (secondary transform enable flag) is equal to 1, the following operation is performed on the coefficient matrix:
first, the coefficient matrix C of the upper left corner 4*4 is obtained from the transform coefficient matrix: c ij =coeff ij I=0 to 3, j=0 to 3, and c in the above formula ij Is an element of matrix C, coeff ij Is an element of the transform coefficient matrix. If the value of the intra prediction mode (intra predmode) is 0-2, or 13-32, or 44-65, and the reference sample on the left outside of the current block is "available", then: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is an element of a matrix P of 4*4, and the matrix P is calculated as follows: p=c×s 4 ,S 4 Is 4*4 inverse transformation matrix, clip3 (-32768, 32767, (p) ij +2 6 )>>7) If c is expressed as ij The value of c lies between-32768 and 32767 ij Has a value of (p) ij +2 6 )>>7, if c ij The value of c is smaller than-32768 ij The value of (C) is-32768, if C ij Is greater than 32767, then c ij Is 32767. If the value of the intra prediction mode (intra predmode) is 0 to 23, or 34 to 57, and the reference sample on the outer top of the current block is "available", then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3。q ij Is an element of a 4 x 4 matrix Q, which is calculated as follows: q=s 4 T ×C,S 4 T Is S 4 Transposed matrix of S 4 Is the 4*4 inverse transform matrix.
Then, the values of the elements of the transformation coefficient matrix are modified according to the matrix C: coeff ij =c ij ,i=0~3,j=0~3。
Then, the matrix coeff is subjected to an initial inverse transformation.
In 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 a secondary transform enable flag (secondary transform enable flag) is equal to 1, the following operations are performed on the coefficient matrix:
first of all,the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k (k) ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1,v ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows: v=d 4 T ×CoeffMatrix,D 4 T Is an inverse transformation matrix D 4 Is the transposed matrix of CoeffMatrix, is the transform coefficient.
Then, the matrix K is subjected to the following horizontal inverse transformation to obtain a matrix H: h is a ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1,w i,j Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 22-BitDepth, matrix W is: w=k×d 4 ,D 4 Is an inverse transform matrix.
Illustratively, for blocks of 4*4, no further initial inverse transforms are required after the inverse transforms of the secondary transforms are performed.
Referring to the above embodiment, the secondary 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 processes such as quantization, entropy coding and the like on the new transformation coefficient. In the related art, the secondary transform is performed with respect to the luminance component of the current block. However, the secondary transform is used only for the luminance component and not for the chrominance component, and the initial transform is performed only (DCT 2 ) by default for the chrominance component of the current block, and there is a problem that energy may not be concentrated enough for the chrominance component after the initial transform. In view of the above findings, in the embodiments of the present application, the chrominance components may be subjected to secondary transformation, thereby improving the encoding performance.
In one possible implementation, for the encoding end, it is determined by rate-distortion cost (RDO) whether the chroma components are secondarily transformed, and a secondary transform flag bit is explicitly encoded to indicate whether the chroma components of the current block use secondary transforms, and the chroma U components and the chroma V components share the same secondary transform flag bit, that is, the secondary transform flag bit indicates that the chroma U components and the chroma V components are secondarily transformed at the same time, or that neither the chroma U components nor the chroma V components are secondarily transformed.
In another possible implementation, for the encoding end, it is decided whether the chrominance components are secondarily transformed by rate-distortion cost value (RDO), and the secondary transform flag bit is explicitly encoded to indicate whether the chrominance components of the current block use secondary transform, and the chrominance U-component and the chrominance V-component use separate secondary transform flag bits, respectively. That is, one secondary transform flag bit indicates that the chroma U component is secondarily transformed or that the chroma U component is not secondarily transformed. Another secondary transform flag bit indicates that the chroma V component is secondarily transformed or that the chroma V component is not secondarily transformed.
In another possible implementation, for the encoding end, it is decided whether the luminance component and the chrominance component are secondarily transformed by rate-distortion cost value (RDO), and the secondary transform flag bit is explicitly encoded to indicate whether the luminance component and the chrominance component of the current block are secondarily transformed, and the luminance component and the chrominance component (chrominance U component and chrominance V component) share the same secondary transform flag bit, that is, the secondary transform flag bit indicates that the luminance component, the chrominance U component and the chrominance V component are secondarily transformed at the same time, or that the luminance component, the chrominance U component and the chrominance V component are not secondarily transformed.
The following describes the encoding method and decoding method according to the embodiments of the present application in detail with reference to several specific embodiments.
Example 1: in a possible implementation manner, referring to fig. 3A, a schematic flow chart of a decoding method set forth in an embodiment of the present application is shown, where the decoding method may be applied to a decoding end, and the decoding method may include the following steps:
step 311, obtaining the coded bit stream of the current block, and parsing the transform coefficient flag bit from the coded bit stream, where the transform coefficient flag bit is used to indicate whether the final transform coefficient matrix corresponding to the chroma component of the current block contains a non-zero transform coefficient.
For example, if the transform coefficient flag bit is the first value, the transform coefficient flag bit may 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 bit is the second value, the transform coefficient flag bit 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, in the encoded bitstream of the current block, a final transform coefficient matrix corresponding to the chroma component of the current block, where the final transform coefficient matrix may or may not contain non-zero transform coefficients, for a specific encoding process, see the following embodiments. When the encoding end transmits the encoded bit stream to the decoding end, the encoding end may encode a transform coefficient flag bit in the encoded bit stream, where the transform coefficient flag bit is used to indicate whether a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient. In summary, after the decoding end obtains the encoded bitstream, the transform coefficient flag bit may be parsed from the encoded bitstream, where the transform coefficient flag bit is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
The chrominance components of the current block are a chrominance U component and a chrominance V component, and the transform coefficient flag bit comprises a chrominance U component transform coefficient flag bit and a chrominance V component transform coefficient flag bit. When the value of the color U component transformation coefficient flag bit is the first value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color U component of the current block contains a non-zero transformation coefficient; and when the value of the transformation coefficient flag bit of the chroma U component is the second value, the transformation coefficient flag bit is used for indicating that the final transformation coefficient matrix corresponding to the chroma U component of the current block does not contain non-zero transformation coefficients. When the value of the chroma V component transformation coefficient flag bit is the 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; and when the value of the chroma V component transformation coefficient flag bit is the second value, the flag bit is used for indicating that a 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 transform coefficient flag bit is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, and includes: the value of the color U component transformation coefficient flag bit is the first value, and/or the value of the color V component transformation coefficient flag bit is the first value.
In summary, the decoding end may parse the chroma U component transform coefficient flag bit and the chroma V component transform coefficient flag bit from the encoded bitstream of the current block. If the value of the transform coefficient flag bit of the chroma U component is the first value, the decoding end may determine that the final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient. If the value of the transform coefficient flag bit of the chroma U component is the second value, the decoding end may determine that the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient. If the value of the transform coefficient flag bit of the chrominance V component 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 transform coefficient flag bit of the chrominance V component 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.
If the current block meets the first preset condition, the secondary transform flag bit of the block-level chroma component is parsed from the encoded bitstream, where the secondary transform flag bit is used to indicate that the chroma component is subjected to secondary inverse transform or that the chroma component is not subjected to secondary inverse transform. The first preset condition may at least 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 non-zero transform coefficients.
The secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chrominance component when the value of the secondary transformation flag bit is a first value, and is used for indicating that the secondary inverse transformation is not performed on the chrominance component when the value of the secondary transformation flag bit is a second value.
For example, the first value is 1, and the second value is 0.
Step 313, if the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, analyzing the final transform coefficient matrix corresponding to the chroma component of the current block from the coded bit stream of the current block, performing inverse quantization on the final transform coefficient matrix corresponding to the chroma component to obtain a target transform coefficient matrix corresponding to the chroma component, and determining whether to perform secondary inverse transform on the target transform coefficient matrix corresponding to the chroma component according to the secondary transform flag bit.
For example, if the transform coefficient flag bit is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, the decoding end determines that the final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, parses the final transform coefficient matrix corresponding to the chroma component of the current block from the encoded bitstream of the current block, and dequantizes the final transform coefficient matrix corresponding to the chroma component to obtain the target transform coefficient matrix corresponding to the chroma component.
For example, the decoding end may determine whether the current block meets the first preset condition, and if the current block does not meet the first preset condition, the decoding end determines that the target transform coefficient matrix corresponding to the chroma component of the current block is not subjected to the secondary inverse transform. If the current block meets the first preset condition, the decoding end may further parse a secondary transformation flag bit (simply referred to as a secondary transformation flag bit) of the block-level chroma component from the encoded bitstream of the current block. If the secondary transformation flag bit is used for indicating to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component, the decoding end determines to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation flag bit. If the secondary transformation flag bit is used for indicating that the target transformation coefficient matrix corresponding to the chroma component is not subjected to secondary inverse transformation, the decoding end determines that the target transformation coefficient matrix corresponding to the chroma component is not subjected to secondary inverse transformation according to the secondary transformation flag bit.
In one possible embodiment, the first preset condition may at least 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 of the current block contains non-zero transform coefficients. In summary, if it is determined that the prediction mode of the current block is the intra-frame prediction mode and the transform coefficient flag bit is the first value, the decoding end may determine that the current block meets the first preset condition. If it is determined that the prediction mode of the current block is not the intra-frame prediction mode and/or the transform coefficient flag bit is the second value, the decoding end may determine that the current block does not meet the first preset condition.
Referring to the above embodiment, the transform coefficient flag bit includes a chroma U component transform coefficient flag bit and a chroma V component transform coefficient flag bit, based on which, if the prediction mode of the current block is an intra prediction mode, and the chroma U component transform coefficient flag bit is a first value and/or the chroma V component transform coefficient flag bit is a first value, the decoding end determines that the current block meets a first preset condition. If the prediction mode of the current block is not the intra-frame prediction mode and/or the chroma U component transformation coefficient flag bit and the chroma V component transformation coefficient flag bit are both second values, the decoding end determines that the current block does not meet the first preset condition.
In one possible implementation, in addition to the prediction mode of the current block being an intra prediction mode, the transform coefficient flag bit is used to indicate that a final transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and the first preset condition may further 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 modified intra prediction mode; the current block adopts a transformation check (DCT 2 ) to perform initial inverse transformation; the chroma intra 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 chrominance components to use a quadratic inverse transformation.
For example, the first preset condition 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 chroma component contains a non-zero transform coefficient, and the current block does not use an intra-frame prediction filtering mode (IPF mode).
For another example, the first preset condition 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 chroma component contains a non-zero transform coefficient, and the current block does not use an improved intra-frame 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, and the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients, and the current block adopts transformation check (DCT 2 ) to perform initial inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, and 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 the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, and 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 size of the chroma component of the current block meets the 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 chrominance component contains non-zero transformation coefficients, and the control information allows the chrominance component to use secondary inverse transformation.
For example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, and the current block does not use an improved intra-frame prediction mode.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the 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 current block adopts transformation check (DCT 2 ) to perform initial 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, and the chroma intra-frame prediction mode of the current block meets the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the size of the chroma component of the current block meets the preset size condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the control information allows the chroma component to use secondary inverse transformation.
For example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the 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 adopts transformation check (DCT 2 ) to perform initial inverse transformation, and the chroma intra-frame prediction mode of the current block meets the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, the current block adopts transformation check (DCT 2 ) to perform initial inverse transformation, and the size of the chroma component of the current block meets the 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, the current block adopts transformation check (DCT 2 ) to perform initial inverse transformation, 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, a 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 current block adopts a transformation check (DCT 2 ) to perform initial inverse transformation, 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 control information allows the chroma component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the 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 adopts a transformation check (DCT 2 ) to perform initial inverse transformation, the chroma intra-frame prediction mode of the current block meets a preset mode condition, and control information allows the chroma component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the 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 the preset mode condition, and the control information allows the chroma component to use secondary inverse transformation.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the 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 adopts transformation check (DCT 2 ) to perform initial inverse transformation, and the chroma intra-frame prediction mode of the current block meets the preset mode condition.
For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient, the current block does not use an intra-frame prediction filtering mode, the current block does not use an improved intra-frame prediction mode, and the chroma intra-frame prediction mode of the current block meets the preset mode condition.
Of course, the above is only a few examples, and the first preset condition may include any combination of the above conditions without limitation thereto.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, and may include, but is not limited to, at least one of the following: the chroma intra prediction mode of the current block is not a TSCPM mode; the chroma intra prediction mode of the current block is not PMC mode; the mode numbers of the chroma intra prediction modes of the current block are mode numbers 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 intra-chroma prediction mode of the current block is not the TSCPM mode, or the intra-chroma prediction mode of the current block is not the PMC mode, or the intra-chroma prediction mode of the current block has a mode number from 0 to 4, it may be determined that the intra-chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra Chroma prediction mode of the current block is not intra_chroma_pcm mode (or ipd_ipcm mode), or the Intra Chroma prediction mode of the current block is not DM mode, it may be determined that the Intra Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Chroma prediction mode of the current block is not intra_chroma_pcm mode and the Intra-Chroma prediction mode of the current block is not TSCPM mode, it may be determined that the Intra-Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra Chroma prediction mode of the current block is not intra_chroma_pcm mode (or named Chroma ipd_ipcm mode), it may be determined that the Intra Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma ipd_ipcm mode), or the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma prediction mode of the current block satisfies a preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma IPD IPCM mode) and the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma IPD IPCM mode) and/or the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma prediction mode of the current block satisfies the preset mode condition.
In the above embodiment, the size of the chrominance component of the current block satisfies the preset size condition, and may include, but is not limited to, at least one of the following: the width of the chrominance component is less than or equal to n1, and the height of the chrominance component is less than or equal to n2. The width of the chrominance component is less than or equal to n1, or the height of the chrominance component is less than or equal to n2. The width of the chrominance component is equal to or greater than n3, and the height of the chrominance component is equal to or greater than n4. The width of the chrominance component is greater than or equal to n3, or the height of the chrominance component is greater than or equal to n4. The product of the width and the height of the chrominance components is n5 or more. The product of the width and the height of the chrominance components is n6 or less.
For example, regarding any combination of the above-mentioned preset size conditions, it 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 n2. For another example, the width of the chrominance component is n3 or more and n1 or less, or the height of the chrominance component is n4 or more and n2 or less. For another example, the width of the chrominance component is equal to or less than n1, the height of the chrominance component is equal to or less than n2, and the product of the width and the height of the chrominance component is equal to or greater than n5. For another example, the width of the chrominance component is equal to or less than n1, the height of the chrominance component is equal to or less than n2, and the product of the width and the height of the chrominance component is equal to or less than n6.
Of course, the above is only an example of the preset size condition, and the preset size condition may be any combination of the above conditions.
Illustratively, n1 and n2 may be empirically configured, and n1 and n2 may be the same or different, for example, n1=n2=32. Of course, 32 is merely exemplary, and other values, such as 64, etc., are also 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 only an example, and other values, such as 8, etc., are also possible. n5 and n6 may be empirically configured, and n5 and n6 may be the same or different, for example, n5=n6=128. Of course, 128 is merely exemplary, and other values, such as 256, etc., are also possible.
In the above-described embodiments, the control information allows the chrominance components to use a quadratic inverse transform, which may include, but is not limited to, one of the following: the sequence level control information allows the chrominance components to use a quadratic inverse transform. The image parameter set level control information allows the chrominance components to use a quadratic inverse transform. The picture header level control information allows the chrominance components to use a quadratic inverse transform. The slice header level control information allows the chrominance components to use a quadratic inverse transform. Of course, the above are just a few examples of control information, and the level of the control information is not limited.
The sequence level parameter set (SPS, sequence parameter set) has a flag bit that determines whether certain tool (method) switches are allowed in the entire video sequence (i.e., multi-frame video images), 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 chrominance components may be allowed to use the secondary inverse transform by the sequence-level control information, or the chrominance components may not be allowed to use the secondary inverse transform by the sequence-level control information. For example, secondary_transform_enable_flag=1 indicates that the sequence-level control information allows the chroma component to use the secondary inverse transform, secondary_transform_enable_flag=0 indicates that the sequence-level control information does not allow the chroma component to use the secondary inverse transform, and secondary_transform_enable_flag may also be denoted as secondary transform enable flag.
For another example, est_enable_flag=1 indicates that the sequence-level control information allows the use of enhanced secondary inverse transform, and it may be indicated by est_enable_flag=1 that the sequence-level control information allows the use of secondary inverse transform for the chrominance components. est_enable_flag=0, indicating that the sequence-level control information does not allow the use of enhanced secondary inverse transform, and it may be indicated by est_enable_flag=0 that the sequence-level control information does not allow the use of secondary inverse transform for the chrominance components. est_enable_flag may also be denoted as EstEnableFlag.
For another example, st_chroma_enable_flag=1 indicates that the sequence-level control information allows the chroma components to use the secondary inverse transform, and st_chroma_enable_flag=0 indicates that the sequence-level control information does not allow the chroma components to use the secondary inverse transform. The st_chroma_enable_flag may also be denoted as stchromaenable flag.
For another example, if secondary_transform_enable_flag=1 and est_enable_flag=1, the sequence-level control information allows the chrominance component to use the secondary inverse transform, and if secondary_transform_enable_flag=1 and est_enable_flag=0, the sequence-level control information does not allow the chrominance component to use the secondary inverse transform. If secondary_transform_enable_flag=0, it is not necessary to decode est_enable_flag, and it may be directly indicated that the sequence level control information does not allow the chrominance component to use the secondary inverse transform.
For another example, if secondary_transform_enable_flag=1 and st_chroma_enable_flag=1, the sequence-level control information allows the chroma component to use the secondary inverse transform, and if secondary_transform_enable_flag=1 and st_chroma_enable_flag=0, the sequence-level control information does not allow the chroma component to use the secondary inverse transform. If secondary_transform_enable_flag=0, it is not necessary to decode st_chroma_enable_flag, and it may be directly indicated that the sequence level control information does not allow the chroma component to use the secondary inverse transform.
Of course, the above are just a few examples of allowing the chrominance components to use the secondary inverse transform and not allowing the chrominance components to use the secondary inverse transform through the sequence-level control information, which is not limited.
The picture parameter set (PPS, picture parameter set) has flag bits that determine whether certain tool (method) switches are allowed in a certain picture. If the flag bit is 1, enabling the corresponding tool (method) in the image; otherwise, the tool (method) cannot be enabled during the encoding of the image. Based on this, the chrominance components are allowed to use the secondary inverse transform by the image parameter set level control information, or the chrominance components are not allowed to use the secondary inverse transform by the image parameter set level control information.
Picture header (picture header): common information for a certain frame of image is stored in the image header only for the current image, unlike the image parameter set (which can be used by different images). For example, when the current image contains multiple slices, the multiple slices may share information in the image header. The image header has a flag bit that determines 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 enabled; 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 secondary inverse transform through the image header level control information, or the chrominance components may not be allowed to use the secondary inverse transform through the image 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 that determines whether certain tool (method) switches are allowed in the slice. If the flag bit is 1, enabling the corresponding tool (method) in slice; otherwise, the tool (method) cannot be enabled during the encoding of the slice. Based on this, the chrominance components may be allowed to use the secondary inverse transform through the slice-header level control information, or the chrominance components may not be allowed to use the secondary inverse transform through the slice-header level control information.
In one possible implementation manner, the chroma component of the current block is a chroma U component and a chroma V component, and the secondary transform flag bit may be a UV component common secondary transform flag bit, which is used to indicate that the chroma U component and the chroma V component are subjected to secondary inverse transform at the same time when the value of the UV component common secondary transform flag bit is a first value, or is used to indicate that the chroma U component and the chroma V component are not subjected to secondary inverse transform when the value of the UV component common secondary transform flag bit is a second value. Based on this, in step 313, if the value of the analyzed UV component sharing secondary transformation flag bit is the first value, it is determined that the chromaticity U component and the chromaticity V component are subjected to the secondary inverse transformation at the same time, and if the value of the analyzed UV component sharing secondary transformation flag bit is the second value, it is determined that neither the chromaticity U component nor the chromaticity V component is subjected to the secondary inverse transformation.
In another possible implementation manner, the chroma components of the current block are a chroma U component and a chroma V component, and the secondary transform flag bits may include a U component secondary transform flag bit and a V component secondary transform flag bit; when the value of the U component secondary transformation zone bit is a first value, the method is used for indicating that the chroma U component is subjected to secondary inverse transformation, or when the value of the U component secondary transformation zone bit is a second value, the method is used for indicating that the chroma U component is not subjected to secondary inverse transformation; and when the value of the V component secondary transformation zone bit is the first value, the method is used for indicating that the chroma V component is subjected to secondary inverse transformation, or when the value of the V component secondary transformation zone bit is the second value, the method is used for indicating that the chroma V component is not subjected to secondary inverse transformation. Based on this, in step 313, if the parsed U component secondary transform flag bit is the first value, it is determined to perform secondary inverse transform on the chroma U component; and if the analyzed U component secondary transformation flag bit is a second value, determining that the chroma U component is not subjected to secondary inverse transformation. If the analyzed V component secondary transformation flag bit is a first value, determining to perform secondary inverse transformation on the chroma V component; and if the analyzed V component secondary transformation flag bit is a second value, determining that the chrominance V component is not subjected to secondary inverse transformation.
In one possible implementation, the decoding end parses the secondary transform flag bits from the encoded bitstream, which may include, but is not limited to: the decoding end adopts a binary arithmetic decoding mode based on context to analyze the secondary transformation zone bit from the coded bit stream; or the decoding end adopts a bypass decoding mode to analyze the secondary transformation zone bit from the coded bit stream.
Illustratively, the decoding end adopts a binary arithmetic decoding mode based on context to analyze the secondary transformation flag bit from the coded bit stream, which can include but is not limited to: the decoding end selects a target context model from at least two pre-configured context models based on a chroma intra 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 that are pre-configured based on the size of the chrominance component, and parses the secondary transform flag bits from the encoded bitstream based on the target context model.
As can be seen from the above technical solutions, in the embodiments of the present application, after performing initial transformation on a chrominance component of a current block, whether to perform secondary transformation on the chrominance component of the current block can be determined, if yes, the secondary transformation can be performed on the chrominance component of the current block, that is, the secondary transformation technique can also be applied to the chrominance component of the current block, and when the chrominance component has a problem of insufficient energy concentration after the initial transformation, the secondary transformation can also be performed on the chrominance component, thereby improving coding performance and coding efficiency.
Example 2: in a possible implementation manner, referring to fig. 3B, a schematic flow chart of a decoding method set forth in an embodiment of the present application is shown, where the decoding method may be applied to a decoding end, and the decoding method may include the following steps:
step 321, obtaining the coded bit stream of the current block, and analyzing a transform coefficient flag bit from the coded bit stream, where the transform coefficient flag bit 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.
And step 322, if the current block meets the first preset condition, analyzing a secondary transformation flag bit of the block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or that the secondary inverse transformation is not performed on the chroma component. The first preset condition may at least 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 non-zero transform coefficients.
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 example, the implementation procedure of step 321 to step 323 can be referred to embodiment 1, and the detailed description is not repeated here.
Step 324, if the target transformation coefficient matrix corresponding to the chrominance component is subjected to the secondary inverse transformation, so as 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 an 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, on the basis of which:
if the secondary transformation flag bit is a secondary transformation flag bit shared by the UV components, and the secondary transformation flag 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 at the same time, the target transformation coefficient matrix corresponding to the chromaticity U component is subjected to secondary inverse transformation, and an initial transformation coefficient matrix corresponding to the chromaticity U component is obtained. And performing secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component. If the UV component shares the secondary transformation flag bit to indicate that no secondary inverse transformation is performed on both the chrominance U component and the chrominance V component, determining the target transformation coefficient matrix corresponding to the chrominance U component as the initial transformation coefficient matrix corresponding to the chrominance U component, and determining the target transformation coefficient matrix corresponding to the chrominance V component as the initial transformation coefficient matrix corresponding to the chrominance V component.
If the secondary transformation flag bit is a U-component secondary transformation flag bit and a V-component secondary transformation flag bit, if the U-component secondary transformation flag bit is used for indicating to perform secondary inverse transformation on the chroma U-component, performing secondary inverse transformation on a target transformation coefficient matrix corresponding to the chroma U-component, and obtaining an initial transformation coefficient matrix corresponding to the chroma U-component. And if the U component secondary transformation flag bit is used for indicating that the secondary inverse transformation is not performed on the chroma U component, determining a target transformation coefficient matrix corresponding to the chroma U component as an initial transformation coefficient matrix corresponding to the chroma U component. And if the V component secondary transformation flag bit is used for indicating the secondary inverse transformation of the chroma V component, performing the secondary inverse transformation of the target transformation coefficient matrix corresponding to the chroma V component to obtain the initial transformation coefficient matrix corresponding to the chroma V component. And if the V component secondary transformation flag bit is used for indicating that secondary inverse transformation is not performed on the chroma V component, determining a target transformation coefficient matrix corresponding to the chroma V component as an initial transformation coefficient matrix corresponding to the chroma V component.
In one possible implementation, in step 324, the second inverse transform is performed on the target transform coefficient matrix to obtain an initial transform coefficient matrix corresponding to the chroma component (e.g., the second inverse transform is performed on the target transform coefficient matrix corresponding to the chroma U component to obtain an initial transform coefficient matrix corresponding to the chroma U component, or the second inverse transform is performed on the target transform coefficient matrix corresponding to the chroma V component to obtain an initial transform coefficient matrix corresponding to the chroma V component), which may include, but is not limited to:
In the first case, 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, determining a coefficient matrix based on the transform coefficient of a designated area positioned at the upper left corner in the target transform coefficient matrix; performing horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; performing vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; and updating the transformation coefficient of the appointed 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. Illustratively, the preset threshold may be empirically configured, such as 4, and the designated region in the upper left corner may be empirically configured, such as the sub-region of 4*4 in the target transform coefficient matrix that is located in the upper left corner.
If the width of the chrominance component is larger than a preset threshold value or the height of the chrominance component is larger than the preset threshold value, determining a coefficient matrix based on the transformation coefficient of a designated area positioned at the upper left corner in the target transformation coefficient matrix; if the mode number of the intra-chroma prediction mode of the current block is positioned in the first mode number interval, carrying out horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; if the mode number of the intra-chroma prediction mode of the current block is 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 coefficient matrix is subjected to horizontal inverse transformation, updating the transformation coefficient of the appointed 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. If only the coefficient matrix is subjected to vertical inverse transformation, updating the transformation coefficient of the appointed 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 mode number section and the second mode number section may be empirically configured, and the first mode number section and the second mode number section are not limited, and may not have a repetitive mode number, and may also have a repetitive mode number. For example, the first pattern number section includes pattern numbers 0 to 2, pattern numbers 4 to 6, pattern numbers 8 to 9, pattern numbers 11 to 12, and pattern numbers 14 to 15, and the second pattern number section includes pattern numbers 0 to 1, pattern numbers 3 to 5, pattern numbers 7 to 8, pattern numbers 10 to 11, pattern numbers 13 to 14, and pattern number 16. If the mode number of the chroma intra prediction mode of the current block is 0-2 or 4-6 or 8-9 or 11-12 or 14-15, the mode number of the chroma intra prediction mode of the current block is located in the first mode number section. If the mode number of the chroma intra prediction mode of the current block is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, the mode number of the chroma intra prediction mode of the current block is located in the second mode number section.
For example, if the mode number of the intra-chroma prediction mode of the current block is located in the first mode number interval and the second mode number interval, the coefficient matrix may be subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix, and then the horizontal inverse transformation matrix is subjected to vertical inverse transformation to obtain a vertical inverse transformation matrix. On the basis, the coefficient matrix is firstly subjected to horizontal inverse transformation and then to vertical inverse transformation, so that the transformation coefficient of a designated area positioned at the upper left corner in the target transformation coefficient matrix can be updated based on the vertical inverse transformation matrix subjected to the vertical inverse transformation, and an initial transformation coefficient matrix can be obtained.
Thirdly, 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 area is the sub-area of 4*4 in the upper left corner, in the process of performing the second inverse transformation on the chrominance component, if the value of the width or the height of the target transformation coefficient matrix is greater than 4, the second inverse transformation is performed on the coefficient matrix in the upper left corner 4*4, and if the values of the width and the height of the target transformation coefficient matrix are both 4, the second inverse transformation is performed on the target transformation coefficient matrix, and the second inverse transformation process is not repeated.
In summary, in step 324, an initial transform coefficient matrix corresponding to the chroma component, that is, an initial transform coefficient matrix corresponding to the chroma U component and an initial transform coefficient matrix corresponding to the chroma V component, may be obtained.
Step 325, performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance component to obtain a residual coefficient matrix corresponding to the chrominance component. Illustratively, the decoding end may perform initial inverse transformation on the initial transform coefficient matrix corresponding to the chroma U component to obtain a residual coefficient matrix corresponding to the chroma U component, and the decoding end may perform initial inverse transformation on the initial transform coefficient matrix corresponding to the chroma V component to obtain a residual coefficient matrix corresponding to the chroma 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 component by using the 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 the transformation check (DCT 2 ) to obtain a residual coefficient matrix corresponding to the chrominance component.
Of course, when the encoding end adopts other transformation checks to perform initial transformation, the decoding end also adopts the same transformation check to perform initial inverse transformation, namely the initial inverse transformation is the inverse process of the initial transformation, and the initial inverse transformation process is not repeated.
And 326, determining a reconstruction value of the chrominance component according to the residual coefficient matrix corresponding to the chrominance component.
Illustratively, the decoding end may determine the reconstructed value of the chroma U component according to the residual coefficient matrix corresponding to the chroma U component, and the decoding end may determine the reconstructed value of the chroma V component according to the residual coefficient matrix corresponding to the chroma V component.
For example, a reference block corresponding to a chrominance component may be determined, for each pixel point of the chrominance component, a reference point corresponding to the pixel point is determined from the reference block, and a residual coefficient value corresponding to the pixel point is determined from a residual coefficient matrix. And obtaining a reconstruction value of the pixel point according to the pixel value of the reference point and the residual coefficient value. The reconstructed values corresponding to all the pixels of the chrominance component can be formed into the reconstructed value of the chrominance component. Of course, the above manner is merely an example, and is not limited thereto.
As can be seen from the above technical solutions, in the embodiments of the present application, after performing initial transformation on a chrominance component of a current block, whether to perform secondary transformation on the chrominance component of the current block can be determined, if yes, the secondary transformation can be performed on the chrominance component of the current block, that is, the secondary transformation technique can also be applied to the chrominance component of the current block, and when the chrominance component has a problem of insufficient energy concentration after the initial transformation, the secondary transformation can also be performed on the chrominance component, thereby improving coding performance and coding efficiency.
Example 3: in a possible implementation manner, referring to fig. 4A, a schematic flow chart of an encoding method set forth 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 411, acquiring a residual coefficient matrix corresponding to the chrominance component of the current block.
For example, a reference block corresponding to a chrominance component of a current block may be determined, and for each pixel point of the chrominance component, a reference point corresponding to the pixel point may be 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 component form a residual coefficient matrix corresponding to the chrominance component of the current block. Of course, the above manner is merely an example, and is not limited thereto.
Step 412, performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
For example, the chroma component of the current block includes a chroma U component and a chroma V component, and the encoding end may perform initial transformation on the residual coefficient matrix corresponding to the chroma U component to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and perform initial transformation on the residual coefficient matrix corresponding to the chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component.
For example, the encoding end may perform initial transformation on the residual coefficient matrix corresponding to the chrominance component (such as the chrominance U component or the chrominance V component) by using a transformation check (DCT 2 ) 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 initial transformation process will not be described again.
Step 413, 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, so as to obtain the target transformation coefficient matrix corresponding to the chrominance component.
For example, the encoding end may determine whether the current block meets the second preset condition, and if the current block does not meet the second preset condition, the encoding end determines that the initial transform coefficient matrix corresponding to the chrominance component of the current block is not secondarily transformed. 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 mode refers to the subsequent embodiment.
In one possible embodiment, the second preset condition may at least include: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients. In summary, if it is determined that the prediction mode of the current block is the intra-frame prediction mode and the initial transform coefficient matrix corresponding to the chroma component contains the non-zero transform coefficient, it is determined that the current block meets the second preset condition. 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 corresponding to the chroma component does not contain a non-zero transformation coefficient, determining that the current block does not meet a second preset condition.
For example, since the chrominance component of the current block includes the chrominance U component and the chrominance V component, if the prediction mode of the current block is the intra 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 the non-zero transform coefficient, it is determined that the current block satisfies the second preset condition. If the prediction mode of the current block is not the intra-frame prediction mode and/or the initial transformation coefficient matrix corresponding to the chroma U component and the initial transformation coefficient matrix corresponding to the chroma V component do not contain non-zero transformation coefficients, determining that the current block does not meet a second preset condition.
Illustratively, in addition to the prediction mode of the current block being an intra prediction mode, the initial transform coefficient matrix corresponding to the chroma component contains a non-zero transform coefficient, and the second preset condition may further include, but is not limited to, at least one of the following: the current block does not use an intra prediction filtering mode (IPF mode); the current block does not use an improved intra prediction mode (IIP mode); the current block adopts a transformation check (DCT 2 ) to perform initial transformation; the chroma intra 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 chrominance components to use a secondary transform.
For example, the combination of the conditions in the second preset condition may be referred to as the combination of the conditions in the first preset condition in embodiment 1, and the description thereof will not be repeated here. Illustratively, the second preset condition needs to be matched with the first preset condition, for example, when the first preset condition includes that the current block does not use the intra prediction filtering mode, the second preset condition also includes that the current block does not use the intra prediction filtering mode. When 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 so on.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, and may include, but is not limited to, at least one of the following: the chroma intra prediction mode of the current block is not a TSCPM mode; the chroma intra prediction mode of the current block is not PMC mode; the mode numbers of the chroma intra prediction modes of the current block are mode numbers 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 intra-chroma prediction mode of the current block is not the TSCPM mode, or the intra-chroma prediction mode of the current block is not the PMC mode, or the intra-chroma prediction mode of the current block has a mode number from 0 to 4, it may be determined that the intra-chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra Chroma prediction mode of the current block is not intra_chroma_pcm mode (or ipd_ipcm mode), or the Intra Chroma prediction mode of the current block is not DM mode, it may be determined that the Intra Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Chroma prediction mode of the current block is not intra_chroma_pcm mode and the Intra-Chroma prediction mode of the current block is not TSCPM mode, it may be determined that the Intra-Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra Chroma prediction mode of the current block is not intra_chroma_pcm mode (or named Chroma ipd_ipcm mode), it may be determined that the Intra Chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma ipd_ipcm mode), or the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma prediction mode of the current block satisfies a preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma IPD IPCM mode) and the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma prediction mode of the current block satisfies the preset mode condition.
For another example, if the Intra-Luma prediction mode of the current block is not Intra-Luma PCM mode (or named Luma IPD IPCM mode) and/or the Intra-chroma prediction mode of the current block is not DM mode, it may be determined that the Intra-chroma 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, which can be also seen in that the chroma intra prediction mode of the current block in embodiment 1 satisfies the preset mode condition, and the detailed description is not repeated here.
In the above embodiment, the size of the chrominance component of the current block satisfies the preset size condition, and may include, but is not limited to, at least one of the following: the width of the chrominance component is less than or equal to n1, and the height of the chrominance component is less than or equal to n2. The width of the chrominance component is less than or equal to n1, or the height of the chrominance component is less than or equal to n2. The width of the chrominance component is equal to or greater than n3, and the height of the chrominance component is equal to or greater than n4. The width of the chrominance component is greater than or equal to n3, or the height of the chrominance component is greater than or equal to n4. The product of the width and the height of the chrominance components is n5 or more. The product of the width and the height of the chrominance components is n6 or less.
In the above-described embodiments, the control information allows the chrominance components to use a secondary transform, which may include, but is not limited to, one of the following: the sequence level control information allows the chrominance components to use a secondary transform. The image parameter set level control information allows the chrominance components to use a secondary transform. The image header level control information allows the chrominance components to use a secondary transform. The slice header level control information allows the chrominance components to use a secondary transform.
In a possible implementation manner, if the current block meets the second preset condition, the encoding end may further determine whether to perform secondary transformation on the chroma component of the current block, for example, based on a cost value (such as a rate distortion cost value) of the chroma component, and the specific determination manner is referred to in the following steps, which are not described herein.
Step 414, quantize the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encode a transform coefficient flag bit in the encoded bit stream of the current block, where the transform coefficient flag bit is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
Step 415, after the current block meets the second preset condition and determines whether to perform secondary transformation on the chroma component of the current block, the secondary transformation flag bit of the block level chroma component may also be encoded in the encoded bitstream of the current block. Illustratively, the secondary transform flag is used to indicate that the chrominance component is secondarily transformed or that the chrominance component is not secondarily transformed.
In one possible implementation manner, the chroma component of the current block is a chroma U component and a chroma V component, and the secondary transform flag bit may be a UV component common secondary transform flag bit, which is used to indicate that the chroma U component and the chroma V component are secondarily transformed at the same time when the value of the UV component common secondary transform flag bit is a first value, or is used to indicate that the chroma U component and the chroma V component are not secondarily transformed when the value of the UV component common secondary transform flag bit is a second value. Based on this, in step 413, it is possible to determine a first generation value when only the initial transform is performed on the chrominance U component and the chrominance V component, and to determine a second generation value when the initial transform is performed on the chrominance U component and the chrominance V component, followed by the secondary transform. If the second cost value is smaller than the first cost value, determining that 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, and if the second cost value is larger than the first cost value, determining that the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component are not subjected to secondary transformation.
For example, if the second cost value is equal to the first generation value, it may be determined that no secondary transformation is performed on both the chrominance U component and the chrominance V component, or it may be determined that the secondary transformation is performed on both the chrominance U component and the chrominance V component simultaneously.
In step 415, if it is determined that the chroma U component and the chroma V component are subjected to the secondary transform at the same time, when the UV component-shared secondary transform flag bit is encoded in the encoded bit stream of the current block, the value of the UV component-shared secondary transform flag bit is the first value. If it is determined that no secondary transformation is performed on both the chrominance U component and the chrominance V component, when the UV component is encoded in the encoded bitstream of the current block with a common secondary transformation flag bit, the value of the UV component with the common secondary transformation flag bit is a second value.
In another possible implementation manner, the chroma components of the current block are a chroma U component and a chroma V component, and the secondary transform flag bits include a U component secondary transform flag bit and a V component secondary transform flag bit. And 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 the chroma U-component is subjected to secondary transformation, 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 the chroma U-component is not subjected to secondary transformation. And when the value of the V component secondary transformation zone bit is a first value, the V component secondary transformation zone bit is used for indicating that the chroma V component is subjected to secondary transformation, or when the value of the V component secondary transformation zone bit is a second value, the V component secondary transformation zone bit is used for indicating that the chroma V component is not subjected to secondary transformation. Based on this, in step 413, the third generation value when only the initial transform is performed on the chrominance U component is determined, and the fourth generation value when the initial transform is performed on the chrominance U component and then the secondary transform is performed is determined. If the fourth generation value is smaller than the third generation value, determining to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chromaticity U component; if the fourth generation value is greater than the third generation value, determining that secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chrominance U component; and if the fourth cost value is equal to the third generation value, determining that the chroma U component is not subjected to secondary transformation or the chroma U component is subjected to secondary transformation. And determining a fifth cost value when only the initial transformation is performed on the chrominance V component, and determining a sixth cost value when the initial transformation is performed on the chrominance V component and then the secondary transformation is performed. If the sixth cost value is smaller than the fifth cost value, determining to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance V component; if the sixth cost value is larger than the fifth cost value, determining that secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the chrominance V component; 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.
If it is determined that the chroma U component is secondarily transformed in step 415, then the value of the U component secondary transform flag bit is the first value when the U component secondary transform flag bit is encoded in the encoded bitstream. If it is determined that the secondary transformation is not performed on the chroma U component, when the U component secondary transformation flag bit is encoded in the encoded bitstream, the value of the U component secondary transformation flag bit is a second value. If it is determined to perform secondary transformation on the chrominance V component, when the V component secondary transformation flag bit is encoded in the encoded bitstream, the value of the V component secondary transformation flag bit is a first value. If it is determined that the secondary transformation is not performed on the chrominance V component, the value of the V component secondary transformation flag bit is a second value when the V component secondary transformation flag bit is encoded in the encoded bitstream.
In one possible implementation, in step 415, the encoding end encodes the secondary transform flag bit in the encoded bitstream of the current block, which may include, but is not limited to: the encoding end encodes the secondary transformation flag bit by adopting a binary arithmetic encoding mode based on context; or the coding end adopts a bypass coding mode to code the secondary transformation zone bit.
Illustratively, the encoding end encodes the secondary transformation flag bit by adopting a binary arithmetic encoding mode based on context, which can include but is not limited to: the encoding end may select a target context model from at least two context models configured in advance based on a chroma intra prediction mode of the current block, and encode the secondary transform flag bit based on the target context model. Alternatively, the encoding end may select a target context model from at least two context models configured in advance based on the size of the chrominance component of the current block, and encode the secondary transform flag based on the target context model.
As can be seen from the above technical solutions, in the embodiments of the present application, after performing initial transformation on a chrominance component of a current block, whether to perform secondary transformation on the chrominance component of the current block can be determined, if yes, the secondary transformation can be performed on the chrominance component of the current block, that is, the secondary transformation technique can also be applied to the chrominance component of the current block, and when the chrominance component has a problem of insufficient energy concentration after the initial transformation, the secondary transformation can also be performed on the chrominance component, thereby improving coding performance and coding efficiency.
Example 4: in a possible implementation manner, referring to fig. 4B, a schematic flow chart of an encoding method set forth in an embodiment of the present application is shown, where the encoding method may be applied to an encoding end, and the encoding method may include the following steps:
step 421, obtaining a residual coefficient matrix corresponding to the chrominance component of the current block.
Step 422, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
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, so as to obtain the target transformation coefficient matrix corresponding to the chrominance component.
For example, the implementation procedure of step 421 to step 423 can be referred to embodiment 3, and the detailed description is not repeated here.
Step 424, if it is determined to perform secondary transformation on the initial transform coefficient matrix corresponding to the chrominance component, performing secondary transformation on the initial transform coefficient matrix corresponding to the chrominance component to obtain the target transform coefficient matrix corresponding to the chrominance component. If the initial transformation coefficient matrix corresponding to the chrominance component is determined not to be subjected to secondary transformation, the initial transformation coefficient matrix corresponding to the chrominance component is determined to be a target transformation coefficient matrix corresponding to the chrominance component.
In one possible implementation, the initial transform coefficient matrix corresponding to the chroma component may include an initial transform coefficient matrix corresponding to the chroma U component and an initial transform coefficient matrix corresponding to the chroma V component, based on which:
if the secondary transformation flag bit is a UV component sharing secondary transformation flag bit, and the secondary transformation is carried out on the chroma U component and the chroma V component at the same time, carrying out secondary transformation on an initial 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 secondary transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a target transformation coefficient matrix corresponding to the chroma V component. Or if the secondary transformation is not performed on both the chrominance U component and the chrominance V component, determining the initial transformation coefficient matrix corresponding to the chrominance U component as the target transformation coefficient matrix corresponding to the chrominance U component, and determining the initial transformation coefficient matrix corresponding to the chrominance V component as the target transformation coefficient matrix corresponding to the chrominance V.
If the secondary transformation flag bit is a U-component secondary transformation flag bit and a V-component secondary transformation flag bit, and the chromaticity U-component is subjected to secondary transformation, the initial transformation coefficient matrix corresponding to the chromaticity U-component can be subjected to secondary transformation, and the target transformation coefficient matrix corresponding to the chromaticity U-component can be obtained. If the secondary transform is not performed on the chrominance U component, the initial transform coefficient matrix corresponding to the chrominance U component may be determined as the target transform coefficient matrix corresponding to the chrominance U component.
And if the secondary transformation is carried out on the chrominance V component, carrying out the secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance V component, and obtaining the target transformation coefficient matrix corresponding to the chrominance V component. If the secondary transformation is not performed on the chrominance V component, determining an initial transformation coefficient matrix corresponding to the chrominance V component as a target transformation coefficient matrix corresponding to the chrominance V component.
In one possible implementation manner, performing 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 (for example, performing secondary transformation on the initial transform coefficient matrix corresponding to the chroma U component to obtain a target transform coefficient matrix corresponding to the chroma U component, or performing secondary transformation on the initial transform coefficient matrix corresponding to the chroma V component to obtain a target transform coefficient matrix corresponding to the chroma 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 value, or the height of the chrominance component is greater than a preset threshold value, determining a coefficient matrix based on the transform coefficient of a designated area located in the upper left corner in the initial transform coefficient matrix; performing vertical transformation on the coefficient matrix to obtain a vertical transformation matrix; performing horizontal transformation on the vertical transformation matrix to obtain a horizontal transformation matrix; and updating the transformation coefficient of the appointed 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. Illustratively, the preset threshold may be empirically configured, such as 4, and the designated region in the upper left corner may be empirically configured, such as the sub-region of 4*4 in the target transform coefficient matrix that is located in the upper left corner.
2, 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, determining a coefficient matrix based on the transformation coefficient of a designated area positioned at the upper left corner in the initial transformation coefficient matrix; if the mode number of the intra-chroma prediction mode of the current block is positioned in the first mode number interval, horizontally transforming the coefficient matrix to obtain a horizontal transformation matrix; if the mode number of the intra-chroma prediction mode of the current block is located in the second mode number interval, the coefficient matrix is subjected to vertical transformation to obtain a vertical transformation matrix. If only the coefficient matrix is subjected to horizontal transformation, updating the transformation coefficient of a 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 subjected to vertical transformation, updating the transformation coefficient of the appointed 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 pattern number section comprises pattern numbers 0-2, 4-6, 8-9, 11-12 and 14-15, and the second pattern number section comprises pattern 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 or 4-6 or 8-9 or 11-12 or 14-15, the mode number of the chroma intra prediction mode is located in the first mode number section. If the mode number of the chroma intra prediction mode is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, the mode number of the chroma intra prediction mode is located in the second mode number section.
For example, if the mode number of the intra-chroma prediction mode of the current block is located in 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 subjected to horizontal transformation to obtain a horizontal transformation matrix. On the basis, the coefficient matrix is subjected to vertical transformation and then horizontal transformation, so that the transformation coefficient of a 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 to obtain the target transformation coefficient matrix.
3, if the width of the chrominance component is equal to a preset threshold value and the height of the chrominance component is equal to a preset threshold value, horizontally transforming 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 case 1, the case 2 and the case 3, if the preset threshold is 4 and the designated area is the sub-area of 4*4 in the upper left corner, in the process of performing the secondary transformation on the chrominance component, if the value of the width or the height of the initial transformation coefficient matrix is greater than 4, the secondary transformation is performed on the coefficient matrix in the upper left corner 4*4, and if the values of the width and the height of the initial transformation coefficient matrix are both 4, the secondary transformation is performed on the initial transformation coefficient matrix, and the secondary transformation process is not described again.
In summary, in step 424, a target transform coefficient matrix corresponding to the chroma component, that is, a target transform coefficient matrix corresponding to the chroma U component and a target transform coefficient matrix corresponding to the chroma V component, may be obtained.
Step 425, quantize the target transform coefficient matrix corresponding to the chrominance component to obtain a final transform coefficient matrix corresponding to the chrominance component, and encode a transform coefficient flag bit in the encoded bitstream of the current block, where the transform coefficient flag bit is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
For example, after the final transform coefficient matrix corresponding to the chrominance component is obtained, the final transform coefficient matrix corresponding to the chrominance component may be encoded in the encoded bitstream of the current block, which is not limited in the encoding process.
For example, if the transform coefficient flag bit is the first bit, it indicates that the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients. Or if the transform coefficient flag bit is the second value, indicating that the final transform coefficient matrix corresponding to the chrominance component of the current block does not contain a non-zero transform coefficient. The transform coefficient flag may include a chroma U component transform coefficient flag and a chroma V component transform coefficient flag, for example. When the value of the color U component transformation coefficient flag bit is the first value, the color U component transformation coefficient flag bit can be used for indicating that a final transformation coefficient matrix corresponding to the color U component of the current block contains a non-zero transformation coefficient; when the value of the transform coefficient flag bit of the chroma U component is the second value, the flag bit 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 bit is the first value, the flag bit may be used to indicate that the 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 bit is the second value, the flag bit 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 bit is encoded in the encoded bitstream of the current block, where the secondary transform flag bit is used to indicate that the chroma component of the current block is secondarily transformed or that the chroma component of the current block is not secondarily transformed.
For example, before the secondary transform flag bit is encoded in the encoded bitstream of the current block, it may be determined whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, and if the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient, the secondary transform flag bit is encoded in the encoded bitstream of the current block. If the final transform coefficient matrix corresponding to the chrominance component does not contain a non-zero transform coefficient, the secondary transform flag bit is not encoded in the encoded bit stream of the current block.
For example, for an application scenario in which the UV component shares the secondary transform flag bit, if the final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient and/or the final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient, the UV component is encoded in the encoded bitstream to share the secondary transform flag bit. If the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient and the final transform coefficient matrix corresponding to the chroma V component does not contain a non-zero transform coefficient, the UV component is not encoded in the encoded bit stream to share the secondary transform flag bit.
For another example, for an application scenario of the U-component secondary transform flag bit and the V-component secondary transform flag bit, if the final transform coefficient matrix corresponding to the chroma U-component contains a non-zero transform coefficient, the U-component secondary transform flag bit is encoded in the encoded bitstream, and if the final transform coefficient matrix corresponding to the chroma U-component does not contain a non-zero transform coefficient, the U-component secondary transform flag bit is not encoded in the encoded bitstream. If the final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient, the V component secondary transform flag bit is encoded in the encoded bit stream, and if the final transform coefficient matrix corresponding to the chrominance V component does not contain a non-zero transform coefficient, the V component secondary transform flag bit is not encoded in the encoded bit stream.
As can be seen from the above technical solutions, in the embodiments of the present application, after performing initial transformation on a chrominance component of a current block, whether to perform secondary transformation on the chrominance component of the current block can be determined, if yes, the secondary transformation can be performed on the chrominance component of the current block, that is, the secondary transformation technique can also be applied to the chrominance component of the current block, and when the chrominance component has a problem of insufficient energy concentration after the initial transformation, the secondary transformation can also be performed on the chrominance component, thereby improving coding performance and coding efficiency.
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 foregoing is merely an example, and the first value and the second value are not limited thereto.
Example 5: in a possible implementation manner, referring to fig. 5A, a schematic flow chart of a decoding method set forth in an embodiment of the present application is shown, where the decoding method may be applied to a decoding end, and the decoding method may include the following steps:
step 511, obtaining the encoded bit stream of the current block, and analyzing the luminance component transform coefficient flag bit, the chrominance U component transform coefficient flag bit and the chrominance V component transform coefficient flag bit from the encoded bit stream.
Illustratively, the luminance component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient, the chrominance U component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the chrominance U component contains a non-zero transform coefficient, and the chrominance V component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient.
For example, if the value of the flag bit of the transform coefficient of the luminance component is the first value, it is determined that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient. If the value of the brightness component transformation coefficient flag bit is the second value, determining that the final transformation coefficient matrix corresponding to the brightness component does not contain non-zero transformation coefficients. If the value of the transform coefficient flag bit of the chroma U component is the first value, determining that the final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient. If the value of the transform coefficient flag bit of the chroma U component is the second value, determining that the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient. If the value of the transform coefficient flag bit of the chrominance V component is the first value, determining that the final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient. If the value of the transform coefficient flag bit of the chrominance V component is the second value, determining that the final transform coefficient matrix corresponding to the chrominance V component does not contain a non-zero transform coefficient.
And step 512, if the current block meets a third preset condition, analyzing a brightness secondary conversion zone bit of the block level from the coded bit stream, wherein the brightness secondary conversion zone bit is a secondary conversion zone bit shared by a brightness component, a chromaticity U component and a chromaticity V component, and the brightness secondary conversion zone bit is used for indicating that the brightness component, the chromaticity U component and the chromaticity V component are subjected to secondary inverse conversion at the same time when the brightness secondary conversion zone bit is a first value, or is used for indicating that the brightness component, the chromaticity U component and the chromaticity V component are not subjected to secondary inverse conversion when the brightness secondary conversion zone bit is a second value.
In step 513, if the final transform coefficient matrix contains non-zero transform coefficients (e.g., the final transform coefficient matrix corresponding to the luminance component, the final transform coefficient matrix corresponding to the chrominance U component, and at least one of the final transform coefficient matrices corresponding to the chrominance V component contains non-zero transform coefficients), the final transform coefficient matrix corresponding to the luminance component, the final transform coefficient matrix corresponding to the chrominance U component, and the final transform coefficient matrix corresponding to the chrominance V component are parsed from the encoded bitstream. And performing inverse quantization on the final transformation coefficient matrix corresponding to the luminance component to obtain a target transformation coefficient matrix corresponding to the luminance component, performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance U component to obtain a target transformation coefficient matrix corresponding to the chrominance U component, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance V component to obtain a target transformation coefficient matrix corresponding to the chrominance V component.
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-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 meets the third preset condition, and if the current block does not meet the third preset condition, the decoding end determines that no secondary inverse transformation is 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 brightness secondary transformation zone bit from the coding bit stream of the current block. If the value of the luminance secondary transformation flag bit is the first value, the decoding end determines 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 of the current block at the same time. If the value of the luminance secondary transformation flag bit is the second value, the decoding end determines that no secondary inverse transformation is performed 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 of the current block.
In one possible embodiment, the third preset condition may at least 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 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 bit is used for indicating that a final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient, for example, the luminance component transform coefficient flag bit takes a first value. The chroma U component transform coefficient flag bit is used to indicate that the 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 bit is the first value. The chroma V component transform coefficient flag bit 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 bit 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 transform coefficient flag bit is used to indicate that the final transform coefficient matrix contains a non-zero transform coefficient (e.g., at least one of the luma component transform coefficient flag bit, the chroma U component transform coefficient flag bit, and the chroma V component transform coefficient flag bit is the first value), the decoding end determines that the current block meets a third preset condition. Otherwise, the decoding end determines that the current block does not meet a third preset condition.
In one possible implementation, in addition to the prediction mode of the current block being an intra prediction mode, the transform coefficient flag bit is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients, and the third preset condition may further 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 DT partitioning mode; the current block does not use the modified intra prediction mode; the current block adopts a transformation check (DCT 2 ) to perform initial inverse transformation; the chroma intra prediction mode of the current block meets a preset mode condition; the size of the current block meets the preset size condition; the control information allows the use of a quadratic inverse transformation. The third preset condition may include any combination of all the above conditions, which is not limited.
In the above embodiment, the chroma intra prediction mode of the current block satisfies the preset mode condition, which can be referred to embodiment 1, and the detailed description is not repeated here. The current block size satisfies the preset size condition, which can be seen in embodiment 1, and the detailed description is not repeated here. The control information allows the use of a quadratic inverse transformation, which can be seen in embodiment 1 and will not be repeated here.
In one possible implementation, the decoding end parses the luma secondary transform flag bits from the encoded bitstream, which may include, but is not limited to: the decoding end adopts a binary arithmetic decoding mode based on context to analyze the brightness secondary transformation zone bit from the coded bit stream; or the decoding end adopts a bypass decoding mode to analyze the brightness secondary transformation zone bit from the coded bit stream.
The decoding end adopts a binary arithmetic decoding mode based on context to analyze the brightness secondary transformation zone bit from the coded bit stream, and can include but is not limited to: the decoding end selects a target context model from at least two pre-configured context models based on a chroma intra prediction mode of the current block, and analyzes a brightness secondary transformation zone 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 that are pre-configured based on the size of the chrominance component, and parses the luminance-secondary-transform flag bits from the encoded bitstream based on the target context model.
For example, if the luminance component, the chrominance U component, and the chrominance V component of the current block are subjected to secondary inverse transformation at the same time, the target transform coefficient matrix corresponding to the luminance component is subjected to secondary inverse transformation to obtain the initial transform coefficient matrix corresponding to the luminance component, the target transform coefficient matrix corresponding to the chrominance U component is subjected to secondary inverse transformation to obtain the 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 secondary inverse transformation to obtain the initial transform coefficient matrix corresponding to the chrominance V component. If no secondary inverse transformation is 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 one possible implementation, the process of performing the inverse transformation on the target transform coefficient matrix corresponding to the chrominance component (e.g., the chrominance U component and the chrominance V component) to obtain the initial transform coefficient matrix corresponding to the chrominance component may refer to step 325, which is not described herein. The process of performing the second inverse transformation on the target transformation coefficient matrix corresponding to the luminance component to obtain the initial 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 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; performing vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; and updating the transformation coefficient of the appointed 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 value and the height of the brightness component is equal to a 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; the initial transform coefficient matrix is determined based on the horizontal inverse transform matrix.
For example, an initial inverse transformation may be performed on an initial transformation 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 coefficient matrix corresponding to the chrominance U component; and carrying out initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a residual coefficient matrix corresponding to the chroma V component. The manner of the initial inverse transformation is not repeated here.
For example, the reconstructed value of the luminance component may be determined according to a residual coefficient matrix corresponding to the luminance component, the reconstructed value of the chrominance U component may be determined according to a residual coefficient matrix corresponding to the chrominance U component, and the reconstructed value of the chrominance V component may be determined according to a residual coefficient matrix corresponding to the chrominance V component. The decoding end can determine the reconstruction value of the current block based on the reconstruction value of the luminance component, the reconstruction value of the chrominance U component and the reconstruction value of the chrominance V component, and then the decoding process of the current block is completed.
As can be seen from the above technical solutions, in the embodiments of the present application, after an initial transformation is performed on a luminance component and a chrominance component of a current block, whether to perform a secondary transformation on the luminance component and the chrominance component of the current block can be determined, that is, a secondary transformation technique can be applied to the luminance component and the chrominance component of the current block at the same time, and when the luminance component and the chrominance component have a problem of insufficient energy concentration after the initial transformation, the secondary transformation can be performed on the luminance component and the chrominance component, thereby improving coding performance and coding efficiency.
Example 6: in a possible implementation manner, referring to fig. 5B, a schematic flow chart of an encoding method set forth 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 luminance component to obtain an initial transformation coefficient matrix corresponding to the luminance component; carrying out initial 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; and carrying out initial transformation on the residual coefficient matrix corresponding to the chrominance V component to obtain an initial transformation coefficient matrix corresponding to the chrominance V component. The implementation of the initial transformation is not repeated here.
Step 523, if the current block meets the fourth preset condition, determining whether to perform secondary transformation 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, that is, performing secondary transformation simultaneously, or not performing secondary transformation.
For example, the encoding end may determine whether the current block meets the fourth preset condition, and if the current block does not meet the fourth preset condition, the encoding end may determine that no secondary transformation 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 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 based on the cost value (such as the rate distortion cost value) of the current block.
In one possible embodiment, the fourth preset condition may at least include: 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, including 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 chrominance 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-frame prediction mode and the initial transform coefficient matrix contains the non-zero transform coefficient, it is determined that the current block meets the fourth preset condition. 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 non-zero transformation coefficients, determining that the current block does not meet a fourth preset condition.
In one possible implementation, in addition to the prediction mode of the current block being an intra prediction mode, the initial transform coefficient matrix contains non-zero transform coefficients, and the fourth preset condition may further 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 DT partitioning mode; the current block does not use the modified intra prediction mode; the current block adopts a transformation check (DCT 2 ) to perform initial transformation; the chroma intra prediction mode of the current block meets a preset mode condition; the size of the current block meets the preset size condition; the control information allows the use of a secondary transformation. For example, when the fourth preset condition needs to be matched with the third preset condition, for example, 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. When the third preset condition does not include that the current block does not use the intra-prediction filtering mode, the fourth preset condition does not include that the current block does not use the intra-prediction filtering mode.
For example, regarding that 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 use of the secondary transform, refer to embodiment 3, and the description thereof will not be repeated.
Step 524, 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 subjected to secondary transform, then the initial transform coefficient matrix corresponding to the luminance component is subjected to secondary transform to obtain a target transform coefficient matrix corresponding to the luminance component, the initial transform coefficient matrix corresponding to the chrominance U component is subjected to secondary transform to obtain a target transform coefficient matrix corresponding to the chrominance U component, and the initial transform coefficient matrix corresponding to the chrominance V component is subjected to secondary transform to obtain a target transform coefficient matrix corresponding to the chrominance V component. If it is determined that no secondary transformation is performed on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component, determining the initial transformation coefficient matrix corresponding to the luminance component as the target transformation coefficient matrix corresponding to the luminance component, determining the initial transformation coefficient matrix corresponding to the chrominance U component as the target transformation coefficient matrix corresponding to the chrominance U component, and determining the initial transformation coefficient matrix corresponding to the chrominance V component as the target transformation coefficient matrix corresponding to the chrominance V component.
For example, the process of performing the secondary transformation on the initial transform coefficient matrix corresponding to the chrominance components (such as the chrominance U component and the chrominance V component) to obtain the target transform coefficient matrix corresponding to the chrominance components may refer to step 424, which is not described herein. 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 a 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; performing horizontal transformation on the vertical transformation matrix to obtain a horizontal transformation matrix; and updating the transformation coefficient of the appointed 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 the preset threshold value and the height of the brightness component is equal to the preset threshold value, horizontally transforming 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.
Step 525, quantize the target transform coefficient matrix corresponding to the luminance component to obtain a final transform coefficient matrix corresponding to the luminance component, quantize 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 quantize 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 encoding 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 an encoded bit stream. And encoding the luminance component transform coefficient flag bit, the chrominance U component transform coefficient flag bit, and the chrominance V component transform coefficient flag bit in the encoded bitstream. The luminance component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient, the chrominance U component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the chrominance U component contains a non-zero transform coefficient, and the chrominance V component transform coefficient flag bit is used for indicating whether a final transform coefficient matrix corresponding to the chrominance V component contains a non-zero transform coefficient.
And 526, encoding a brightness secondary transformation zone bit of the block level in the encoding bit stream of the current block, wherein the brightness secondary transformation zone bit is a secondary transformation zone bit shared by a brightness component, a chromaticity U component and a chromaticity V component.
For example, when the value of the luminance secondary conversion flag bit is a first value, the luminance component, the chrominance U component, and the chrominance V component are indicated to be subjected to secondary inverse conversion at the same time, or when the value of the luminance secondary conversion flag bit is a second value, the luminance component, the chrominance U component, and the chrominance V component are indicated to be not subjected to secondary inverse conversion.
In step 523, a seventh cost value when only the initial transform is performed on the luminance component, the chrominance U component, and the chrominance V component is determined, and an eighth cost value when the initial transform is performed on the luminance component, the chrominance U component, and the chrominance V component is performed on the chrominance V component, followed by the secondary transform is determined. If the eighth cost value is smaller than the seventh cost value, determining that secondary transformation is performed on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component at the same time, and if the eighth cost value is larger than the seventh cost value, determining that secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component. If the eighth cost value is equal to the seventh cost value, determining 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 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 primary transform coefficient matrix corresponding to the luminance component, the primary transform coefficient matrix corresponding to the chrominance U component, and the primary transform coefficient matrix corresponding to the chrominance V component are secondarily transformed at the same time, the luminance-chrominance secondary transform flag bit is encoded in the encoded bitstream of the current block, and the value of the luminance-chrominance secondary transform flag bit is the first value. If it is determined that secondary transformation is not performed on the initial transformation coefficient matrix corresponding to the luminance component, the initial transformation coefficient matrix corresponding to the chrominance U component, and the initial transformation coefficient matrix corresponding to the chrominance V component, a luminance-chrominance secondary transformation flag bit is encoded in the encoded bitstream of the current block, and the value of the luminance-chrominance secondary transformation flag bit is a second value.
In one possible implementation, the encoding end encodes the luma secondary transform flag bit in the encoded bit stream of the current block, which may include, but is not limited to: the coding end adopts a binary arithmetic coding mode based on context to code the brightness secondary transformation zone bit; or the coding end adopts a bypass coding mode to code the secondary conversion zone bit of the brightness and the chrominance.
The encoding end encodes the brightness secondary transformation flag bit by adopting a binary arithmetic encoding mode based on context, and the method can comprise the following steps: the encoding end may select a target context model from at least two context models configured in advance based on a chroma intra prediction mode of the current block, and encode the luma secondary transform flag bit based on the target context model. Alternatively, the encoding end may select a target context model from at least two context models configured in advance based on the size of the chrominance component of the current block, and encode the luminance-secondary transform flag bit based on the target context model.
In a possible implementation, before step 526, it may further be determined whether the final transform coefficient matrix contains a non-zero transform coefficient, and if 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 contains a non-zero transform coefficient, the luminance-chrominance secondary transform flag bit is encoded in the encoded bitstream of the current block. If 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 do not contain non-zero transform coefficients, the luminance secondary transform flag bit is not encoded in the encoded bit stream of the current block.
As can be seen from the above technical solutions, in the embodiments of the present application, after an initial transformation is performed on a luminance component and a chrominance component of a current block, whether to perform a secondary transformation on the luminance component and the chrominance component of the current block can be determined, that is, a secondary transformation technique can be applied to the luminance component and the chrominance component of the current block at the same time, and when the luminance component and the chrominance component have a problem of insufficient energy concentration after the initial transformation, the secondary transformation can be performed on the luminance component and the chrominance component, thereby improving coding performance and coding efficiency.
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 foregoing is merely an example, and the first value and the second value are not limited thereto.
Example 7: the embodiment of the application provides a secondary transformation method, and a decoding flow of a decoding end comprises the following steps: if the current block meets the analysis condition (namely the first preset condition), analyzing the secondary transformation zone bit from the coding bit stream of the current block. When the secondary transformation flag bit is equal to 0 (the second value is represented by 0), it indicates that the chrominance component is not subjected to secondary inverse transformation, and when the secondary transformation flag bit is equal to 1 (the first value is represented by 1), it indicates that the chrominance component is subjected to secondary inverse transformation. For example, if the chrominance component is subjected to the secondary inverse transformation, the target transformation coefficient matrix of the chrominance component is subjected to the secondary inverse transformation in the region of the upper left corner 4*4, the transformation coefficient in the region of the upper left corner 4*4 is updated to obtain an initial transformation coefficient matrix, and then the initial transformation coefficient matrix is subjected to the initial inverse transformation to obtain a residual coefficient matrix. If the chrominance component does not perform the secondary inverse transformation, the target transformation coefficient matrix (namely, the target transformation coefficient matrix is used as an initial transformation coefficient matrix) is directly subjected to the initial inverse transformation to obtain a residual coefficient matrix. Then, a reconstructed block is determined based on the residual coefficient matrix (i.e., 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 non-zero transform coefficients. For example, ctp_u is 1 or ctp_v is 1.ctp_u is a transform coefficient flag bit of the chroma U component, and ctp_u is 1, which indicates that the final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients. ctp_v is a transform coefficient flag bit of the chrominance V component, and ctp_v is 1, which indicates that a final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients.
The coding flow of the coding end comprises: if the current block meets the analysis condition (namely a second preset condition), the coding end decides whether the chrominance component of the current block carries out secondary transformation through RDO, if the chrominance component is decided not to carry out secondary transformation, the residual coefficient matrix (namely the residual block) is directly subjected to initial transformation 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 coded in the coded bit stream of the current block, and the secondary transformation flag bit is coded in the coded bit stream to be equal to 0 so as to indicate that the secondary transformation is not carried out. If the decision is made on the chrominance component to perform secondary transformation, performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix, performing secondary transformation on the transformation coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix to obtain a target transformation coefficient matrix after secondary transformation, quantizing the target transformation coefficient matrix to obtain a final transformation coefficient matrix, encoding the final transformation coefficient matrix in the encoding bit stream of the current block, and encoding a secondary transformation flag bit equal to 1 in the encoding bit stream to represent performing secondary transformation. 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 chroma component contains non-zero transformation coefficients.
Example 8: the chroma U component and the chroma V component share one secondary transformation zone bit, the secondary transformation zone bit can be a UV component sharing secondary transformation zone bit, the UV component sharing secondary transformation zone bit is marked as st_chroma_flag, and the st_chroma_flag can be named Stchromaflag.
The decoding flow of the decoding end comprises: if the current block meets the parsing condition 1 (i.e., the first preset condition), parsing st_chroma_flag from the encoded bitstream of the current block. When st_chroma_flag is equal to 0, it indicates that neither the chrominance U component nor the chrominance V component is subjected to the secondary inverse transformation, and when st_chroma_flag is equal to 1, it indicates that both the chrominance U component and the chrominance V component are subjected to the secondary inverse transformation at the same time. For example, if the chroma U component and the chroma V component are subjected to the secondary inverse transformation at the same time, the secondary inverse transformation is performed on the region 4*4 of the upper left corner of the target transformation coefficient matrix corresponding to the chroma U component, the transformation coefficient of the region 4*4 of the upper left corner is updated, so as to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the chroma U component, so as to obtain a residual coefficient matrix corresponding to the chroma U component. And performing secondary inverse transformation on the target transformation coefficient matrix corresponding to the chroma V component in the upper left corner 4*4 area, updating the transformation coefficient in the upper left corner 4*4 area to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a residual coefficient matrix corresponding to the chroma V component. If the chrominance U component and the chrominance V component do not perform secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance U component is directly subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance U component, and the target transformation coefficient matrix corresponding to the chrominance V component is subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance V component. Then, a reconstruction block is determined based on the residual coefficient matrix (i.e., residual block) corresponding to the chroma U component and the residual coefficient matrix corresponding to the chroma V component, for example, the residual block corresponding to the chroma U component is added to the prediction block to obtain the reconstruction block corresponding to the chroma U component, and the residual block corresponding to the chroma V component is added to the prediction block to obtain the reconstruction block corresponding to the chroma V component.
For example, the parsing condition 1 may refer to the first preset condition in embodiment 1, which is not described herein.
The coding flow of the coding end comprises: if the current block meets the analysis condition 2, the coding 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 decision is made that the secondary transformation is not performed on both the chrominance U component and the chrominance V component, the residual coefficient matrix (namely, the residual block) corresponding to the chrominance U component is directly subjected to initial transformation 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 chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and quantizing the initial transformation coefficient matrix corresponding to the chroma V component to obtain a final transformation coefficient matrix corresponding to the chroma V 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 encoded in the encoded bit stream of the current block, and the st_chroma_flag is encoded in the encoded bit stream to be equal to 0.
If it is decided to perform secondary transformation on the chrominance U component and the chrominance V component simultaneously, performing 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, performing secondary transformation on the transform coefficient of the upper left corner 4*4 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. Performing initial transformation on the residual coefficient matrix corresponding to the chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component, performing secondary transformation on the transformation coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix corresponding to the chroma V component to obtain a target transformation coefficient matrix corresponding to the chroma V component, and quantizing the target transformation coefficient matrix corresponding to the chroma V component to obtain a final transformation coefficient matrix corresponding to the chroma V 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 encoded in the encoded bit stream, and the encoded bit stream is encoded with st_chroma_flag equal to 1.
For example, the parsing condition 2 may refer to the second preset condition in embodiment 3, which is not described herein.
Example 9: the chroma U component and the chroma V component share one secondary transformation zone bit, the secondary transformation zone bit can be a UV component sharing secondary transformation zone bit, and the UV component sharing secondary transformation zone bit is marked as st_chroma_flag.
The decoding flow of the decoding end comprises: the transform coefficient flag bits ctp_u and ctp_v of the current block are analyzed, ctp_u represents whether the final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient, ctp_v represents whether the final transform coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transform coefficient, for example ctp_u=0 represents that the final transform coefficient matrix corresponding to the chroma U component of the current block does not contain a non-zero transform coefficient, ctp_u=1 represents that the final transform coefficient matrix corresponding to the chroma U component of the current block contains a non-zero transform coefficient, ctp_v=0 represents that the final transform coefficient matrix corresponding to the chroma V component of the current block does not contain a non-zero transform coefficient, and ctp_v=1 represents that the final transform coefficient matrix corresponding to the chroma V component of the current block contains a non-zero transform coefficient. If the current block meets the parsing condition 1 (first preset condition), parsing st_chroma_flag from the encoded bitstream. When st_chroma_flag is equal to 0, it indicates that neither the chrominance U component nor the chrominance V component is subjected to the secondary inverse transformation, and when st_chroma_flag is equal to 1, it indicates that both the chrominance U component and the chrominance V component are subjected to the secondary inverse transformation at the same time.
If the final transform coefficient matrix corresponding to the chroma component (e.g., the chroma U component and/or the chroma V component) of the current block contains a non-zero transform coefficient, the final transform coefficient matrix corresponding to the chroma component of the current block is parsed from the encoded bitstream of the current block, and the final transform coefficient matrix corresponding to the chroma component is dequantized to obtain the target transform coefficient matrix corresponding to the chroma component.
For example, if the chroma U component and the chroma V component are subjected to the secondary inverse transformation at the same time, the secondary inverse transformation is performed on the region 4*4 of the upper left corner of the target transformation coefficient matrix corresponding to the chroma U component, the transformation coefficient of the region 4*4 of the upper left corner is updated, so as to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the chroma U component, so as to obtain a residual coefficient matrix corresponding to the chroma U component. And performing secondary inverse transformation on the target transformation coefficient matrix corresponding to the chroma V component in the upper left corner 4*4 area, updating the transformation coefficient in the upper left corner 4*4 area to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and performing initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a residual coefficient matrix corresponding to the chroma V component. If the chrominance U component and the chrominance V component do not perform secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance U component is directly subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance U component, and the target transformation coefficient matrix corresponding to the chrominance V component is subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance V component. Then, a reconstruction block is determined based on the residual coefficient matrix (i.e., residual block) corresponding to the chroma U component and the residual coefficient matrix corresponding to the chroma V component, for example, the residual block corresponding to the chroma U component is added to the prediction block to obtain the reconstruction block corresponding to the chroma U component, and the residual block corresponding to the chroma V component is added to the prediction block to obtain the reconstruction block corresponding to the chroma V component.
For example, the parsing condition 1 may refer to the first preset condition in embodiment 1, which is not described herein.
The parsing st_chroma_flag syntax description at the decoding end may be one or more of the following descriptions:
grammar 1
Figure BDA0002828877170000331
Grammar 2
Figure BDA0002828877170000332
Grammar 3
Figure BDA0002828877170000333
In the above-described syntax 1, syntax 2, and syntax 3, syntax 1 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 intra_chroma_pcm mode, the current block does not use Intra Prediction Filtering (IPF) mode, the current block does not use modified Intra prediction (IIP) mode, and the transform coefficient flag bit is used to indicate that the final transform coefficient matrix corresponding to the Chroma u or v component contains a non-zero transform coefficient. Syntax 2 indicates that when 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 intra_chroma_pcm mode, the current block does not use Intra Prediction Filtering (IPF) mode, the current block does not use modified Intra prediction (IIP) mode, a transform coefficient flag bit 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 stchromaenable flag allows the Chroma component to use a secondary inverse transform. Syntax 3 indicates that when 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 intra_chroma_pcm mode, the current block does not use Intra Prediction Filtering (IPF) mode, the current block does not use modified Intra prediction (IIP) mode, a transform coefficient flag bit 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 coding flow of the coding end comprises:
if the current block meets the analysis condition 2, the coding 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 decision is made that the secondary transformation is not performed on the chrominance U component and the chrominance V component, the residual coefficient matrix (namely the residual block) corresponding to the chrominance U component is subjected to initial transformation directly 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 chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and quantizing the initial transformation coefficient matrix corresponding to the chroma V component to obtain a final transformation coefficient matrix corresponding to the chroma V component.
Encoding a final transform coefficient matrix corresponding to a chroma U component and a final transform coefficient matrix corresponding to a chroma V component in a coded bit stream of a current block, encoding transform coefficient flag bits ctp_u and ctp_v in the coded bit stream, ctp_u indicating whether the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients, ctp_v indicating whether the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients, e.g., ctp_u=0 indicating that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients, ctp_u=1 indicating that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients, ctp_v=0 indicating that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients.
If the final transform coefficient matrix corresponding to the chrominance U component and/or the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients, coding st_chroma_flag as 0 in the coded bit stream, and coding the final transform coefficient matrix in the coded bit stream.
If it is decided to perform secondary transformation on the chrominance U component and the chrominance V component simultaneously, performing 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, performing secondary transformation on the transform coefficient of the upper left corner 4*4 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. Performing initial transformation on the residual coefficient matrix corresponding to the chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component, performing secondary transformation on the transformation coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix corresponding to the chroma V component to obtain a target transformation coefficient matrix corresponding to the chroma V component, and quantizing the target transformation coefficient matrix corresponding to the chroma V component to obtain a final transformation coefficient matrix corresponding to the chroma V component.
Encoding a final transform coefficient matrix corresponding to a chroma U component and a final transform coefficient matrix corresponding to a chroma V component in a coded bit stream of a current block, encoding transform coefficient flag bits ctp_u and ctp_v in the coded bit stream, ctp_u indicating whether the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients, ctp_v indicating whether the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients, e.g., ctp_u=0 indicating that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients, ctp_u=1 indicating that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients, ctp_v=0 indicating that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients.
If the final transform coefficient matrix corresponding to the chroma U component and/or the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients, coding st_chroma_flag as 1 in the coded bit stream, and coding the final transform coefficient matrix in the coded bit stream.
For example, the parsing condition 2 may refer to the second preset condition in embodiment 3, which is not described herein.
Example 10: on the basis of the st_chroma_flag of embodiment 8 or embodiment 9, the encoding side may encode the st_chroma_flag in a context-based binary arithmetic encoding manner, and the decoding side may decode the st_chroma_flag in a context-based binary arithmetic decoding manner. Or the encoding end encodes the st_chroma_flag in a bypass encoding mode, and the decoding end decodes the st_chroma_flag in a bypass decoding mode. If a binary arithmetic coding mode or a decoding mode based on context is adopted, a context model can be also preconfigured, and the context model is described below:
case 1, a single context model is preconfigured as the target context model for all chrominance components. Based on this, for the encoding end, when the st_chroma_flag needs to be encoded, the encoding end may encode the st_chroma_flag based on the context model. For the decoding end, when the st_chroma_flag needs to be decoded, the decoding end may decode the st_chroma_flag based on the context model.
Case 2, preconfiguring at least two context models based on chroma intra prediction modes, each of which may be a target context model. For the encoding end, when the st_chroma_flag needs to be encoded, the encoding end firstly selects a target context model from at least two pre-configured context models based on a chroma intra prediction mode of the current block, and encodes the st_chroma_flag based on the target context model. For the decoding end, when the 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 prediction mode of the current block, and decodes the st_chroma_flag based on the target context model.
For example, referring to table 5, two context models, context model 0 and context model 1, respectively, may be preconfigured. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 0-4 (DM, DC, HOR, VER, BI), the context model 0 is taken as the target context model, the st_chroma_flag is encoded based on the context model 0, and the decoding end decodes the 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 (other modes except DM, DC, HOR, VER, BI), the context model 1 is taken as a target context model, the st_chroma_flag is encoded based on the context model 1, and similarly, the decoding end decodes the st_chroma_flag based on the context model 1.
TABLE 5
Intra chromaMode (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, context model 0, context model 1, and context model 2, respectively, may be preconfigured. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 0-4 (DM, DC, HOR, VER, BI), the context model 0 is taken as a target context model, the st_chroma_flag is encoded based on the context model 0, and the decoding end decodes the 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 5-7 (TSCPM, tscpm_ L, TSCPM _t), the context model 1 is used as a target context model, the st_chroma_flag is encoded based on the context model 1, and the decoding end decodes the st_chroma_flag based on the context model 1. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 8-16 (PMC, pmc_ L, PMC _ T, EPMC, EPMC _ L, EPMC _ T, EPMC2, EPMC2_ L, EPMC2 _t), then the context model 2 is taken as the target context model, and the 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 BDA0002828877170000351
Figure BDA0002828877170000361
For another example, referring to table 7, four context models, context model 0-context model 3, respectively, may be preconfigured. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 0-4 (DM, DC, HOR, VER, BI), the context model 0 is used as the target context model, the st_chroma_flag is encoded based on the context model 0, and the decoding end decodes the 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 5-7 (TSCPM, tscpm_ L, TSCPM _t), the context model 1 is used as a target context model, the st_chroma_flag is encoded based on the context model 1, and the decoding end decodes the st_chroma_flag based on the context model 1. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 8-10 (PMC, pmc_ L, PMC _t), the context model 2 is used as the target context model, the 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. For the encoding end, if the mode number of the chroma intra prediction mode of the current block is 11-16 (EPMC, epmc_ L, EPMC _ T, EPMC2, epmc2_ L, EPMC2 _t), then the context model 3 is used as the target context model, the st_chroma_flag is encoded based on the context model 3, and the decoding end decodes the st_chroma_flag based on the context model 3.
TABLE 7
Figure BDA0002828877170000362
Case 3, preconfiguring at least two context models based on the size of the chrominance component of the current block, each of which may be a target context model. For the encoding end, a target context model is first selected from at least two context models that are pre-configured 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 the decoding end, a target context model is selected from at least two context models configured in advance based on the size of the chrominance component of the current block, 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 chrominance component, at least two context models may be configured based on the height of the chrominance component, at least two context models may be configured based on the maximum value of the width and the height of the chrominance component, at least two context models may be configured based on the minimum value of the width and the height of the chrominance component, and at least two context models may be configured based on the product of the width and the height of the chrominance component, although the above is just a few examples and is not limiting.
For example, referring to table 8, two context models, context model 0 and context model 1, respectively, may be configured according to the product of width and 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 the st_chroma_flag may be encoded based on the context model 0, and similarly, the decoding end may decode the 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 taken as a target context model, the st_chroma_flag is encoded based on the context model 1, and the decoding end decodes the st_chroma_flag based on the context model 1. Illustratively, N may be empirically configured, 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, context model 0 and context model 1, respectively, may be configured according to the minimum values of the width and the height. For the encoding end, if the minimum value of the width and the height of the chrominance component is greater than or equal to M, the context model 0 is taken as a target context model, the st_chroma_flag is encoded based on the context model 0, and similarly, the decoding end decodes the 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 a target context model, the st_chroma_flag is encoded based on the context model 1, and the decoding end decodes the st_chroma_flag based on the context model 1. For example, M may be empirically configured, 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: based on embodiment 8 or embodiment 9, for the secondary transform process, the encoding end performs (DCT 2 ) transform to obtain an initial transform coefficient matrix, multiplies the transform coefficient of 4*4 in the upper left corner of the initial transform coefficient matrix by the secondary transform matrix to obtain a new transform coefficient, replaces the transform coefficient of 4*4 in the upper left corner of the initial transform coefficient matrix with the new transform coefficient to obtain a target transform coefficient matrix, and then performs quantization to obtain a final transform coefficient matrix. From the decoding end, the final transformation coefficient matrix obtained from the entropy decoding of the code stream is subjected to inverse quantization to obtain a target transformation coefficient matrix, the 4*4 area at the left upper corner of the target transformation coefficient matrix is subjected to secondary inverse transformation to obtain a new transformation coefficient, the new transformation coefficient is used for replacing the 4*4 transformation coefficient at the left upper corner of the target transformation coefficient matrix to obtain an initial transformation coefficient matrix, and then the initial transformation coefficient matrix is subjected to inverse transformation by (DCT 2 ) to obtain a residual coefficient.
For chrominance components (e.g., chrominance U-component and chrominance 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., a chroma component), the value of the width or height of the chroma component is greater than 4, and the value of the second transform enable flag is equal to 1 (the value of the second transform enable flag is equal to 1, indicating that the sequence level or the frame level allows enabling the second transform), and the value of the StChromaFlag is equal to 1 (the value of the StChromaFlag is equal to 1 indicating that the chroma component is secondarily transformed, it should be noted that in other embodiments, the StChromaFlag may also be denoted as st_chroma_flag, both of which are one meaning), the following operations are performed on the coefficient matrix:
1. the coefficient matrix C of the upper left corner 4*4 is derived from the transform coefficient matrix: c ij =coeff ij I=0 to 3, j=0 to 3, and c in the above formula ij Is an element of matrix C, coeff ij Is an element of the transform coefficient matrix. Illustratively, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4*4 region located in the upper left corner in the target transform coefficient matrix.
2. The coefficient matrix C is subjected to the following horizontal inverse transformation: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is an element of a matrix P of 4*4, and the matrix P is calculated as follows: p=c×s 4 ,S 4 Is 4*4 inverse transformation matrix, clip3 (-32768, 32767, (p) ij +2 6 )>>7) If c is expressed as ij The value of c lies between-32768 and 32767 ij Has a value of (p) ij +2 6 )>>7, if c ij The value of c is smaller than-32768 ij The value of (C) is-32768, if C ij Is greater than 32767, then c ij Is 32767. Illustratively, the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix.
3. The horizontal inverse transform matrix is subjected to the following vertical inverse transform: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3。q ij Is an element of a 4 x 4 matrix Q, which is calculated as follows: q=s 4 T ×C,S 4 T Is S 4 Transposed matrix of S 4 Is the 4*4 inverse transform matrix. The vertical inverse transformation matrix is subjected to vertical inverse transformation to obtain a vertical inverse transformation moment.
4. Modifying values of elements of the target transform coefficient matrix according to the vertical inverse transform moment: coeff ij =c ij I=0 to 3, j=0 to 3. I.e. the transform coefficients of the 4*4 region located in the upper left corner of the target transform coefficient matrix are replaced based on the inverse vertical transform matrix.
In case two, if the current block is a chroma intra prediction residual block, the value of the width and height of the chroma component is equal to 4, and the value of the second transform enable flag is equal to 1, and the value of the StChromaFlag is equal to 1:
1. the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k (k) ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1,v ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows: v=d 4 T ×CoeffMatrix,D 4 T Is an inverse transformation matrix D 4 Is the transposed matrix of CoeffMatrix, is the transform coefficient. Illustratively, after performing the inverse vertical transform on the target transform coefficient matrix, the resulting matrix K is an inverse vertical transform matrix.
2. The matrix K is subjected to the following horizontal inverse transformation to obtain a matrix H: h is a ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1,w i,j Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 22-BitDepth, matrix W is: w=k×d 4 ,D 4 Is an inverse transform matrix. For example, after performing horizontal inverse transformation on the vertical inverse transformation matrix, the obtained matrix H is a horizontal inverse transformation matrix, and the initial transformation coefficient matrix may be determined based on the matrix H, that is, the matrix H is directly determined as the initial transformation coefficient matrix.
Illustratively, for blocks of 4*4, no further initial inverse transforms are required after the second inverse transform is performed.
Example 12: in the secondary inverse transform process, on the basis of embodiment 8, embodiment 9 and embodiment 11, for chrominance components (such as a chrominance U component and a chrominance V component), it is also possible to determine whether to perform horizontal inverse transform and vertical inverse transform for the prediction mode based on the chrominance of the current block, and on the basis, the decoding-side inverse transform process is as follows:
in case one, if the current block is a chroma intra prediction residual block, the value of the width or height of the chroma component is greater than 4, and the value of the second transform enable flag is equal to 1, and the st chroma flag is equal to 1, the following operations are performed on the coefficient matrix:
1. The coefficient matrix C of the upper left corner 4*4 is derived from the transform coefficient matrix: c ij =coeff ij I=0 to 3, j=0 to 3, and c in the above formula ij Is an element of matrix C, coeff ij Is an element of the transform coefficient matrix. Illustratively, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4*4 region located in the upper left corner in the target transform coefficient matrix.
2. If the value of the IntraChromaPredMode is 0-2 or 4-6 or 8-9 or 11-12 or 14-15, the coefficient matrix C is subjected to the following horizontal inverse transformation: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3。p ij Is an element of a matrix P of 4*4, and the matrix P is calculated as follows: p=c×s 4 ,S 4 Is the 4*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 intra chroma predmode is 0-2 or 4-6 or 8-9 or 11-12 or 14-15, and the mode number indicating the intra chroma prediction mode is located in the first mode number section.
3. If the value of Intra ChromaPredMode is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, the coefficient matrix is subjected to the following vertical inverse transformation: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3。q ij Is an element of a 4 x 4 matrix Q, which is calculated as follows: q=s 4 T ×C,S 4 T Is S 4 Transposed matrix of S 4 Is the 4*4 inverse transform matrix. The coefficient matrix is subjected to vertical inverse transformation to obtain a vertical inverse transformation moment, wherein the value of the intra-chroma predmode is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, and the mode number representing the intra-chroma prediction mode is located in the second mode number section. For example, if the coefficient matrix C is not subjected to the horizontal inverse transformation before the step 3, the coefficient matrix C is directly subjected to the vertical inverse transformation in the step 3. If the coefficient matrix C has been subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix before step 3, in step 3, the horizontal inverse transformation matrix is subjected to vertical inverse transformation 。
4. Modifying values of elements of the target transform coefficient matrix according to the coefficient matrix: coeff ij =c ij I=0 to 3, j=0 to 3. Illustratively, if only the coefficient matrix C is subjected to the horizontal inverse transform to obtain a horizontal inverse transform matrix, and the horizontal inverse transform matrix is not subjected to the vertical inverse transform, the values of the elements of the target transform coefficient matrix are modified using the horizontal inverse transform matrix. If only the coefficient matrix C is subjected to the vertical inverse transformation to obtain a vertical inverse transformation matrix, and the coefficient matrix C is not subjected to the horizontal inverse transformation, the vertical inverse transformation matrix is used for modifying the values of the elements of the target transformation coefficient matrix. If the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix, and then the horizontal inverse transformation matrix is subjected to vertical inverse transformation to obtain a vertical inverse transformation matrix, the values of the elements of the target transformation coefficient matrix are modified by using the vertical inverse transformation matrix (i.e., the matrix subjected to horizontal inverse transformation and vertical inverse transformation).
In case two, if the current block is a chroma intra prediction residual block, the value of the width and height of the chroma component is equal to 4, and the value of the second transform enable flag is equal to 1, and the value of the st_chroma_flag is equal to 1:
1. the transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K: k (k) ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1,v ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows: v=d 4 T ×CoeffMatrix,D 4 T Is an inverse transformation matrix D 4 Is the transposed matrix of CoeffMatrix, is the transform coefficient. Illustratively, after performing the inverse vertical transform on the target transform coefficient matrix, the resulting matrix K is an inverse vertical transform matrix.
2. The matrix K is subjected to the following horizontal inverse transformation to obtain a matrix H: h is a ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1,w i,j Is an element of matrix W, h ij Is an element of the matrix H. Value of MaxValueIs (1)<<BitDepth) -1, shift1 equals 22-BitDepth, matrix W is: w=k×d 4 ,D 4 Is an inverse transform matrix. For example, after performing horizontal inverse transformation on the vertical inverse transformation matrix, the obtained matrix H is a horizontal inverse transformation matrix, and the initial transformation coefficient matrix may be determined based on the matrix H, that is, the matrix H is directly determined as the initial transformation coefficient matrix.
Illustratively, for blocks of 4*4, no further initial inverse transforms are required after the second inverse transform is performed.
Example 13: different secondary transformation zone bits are used for the chrominance U component and the chrominance V component, the secondary transformation zone bit of the chrominance 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 chrominance V component is a V component secondary transformation zone bit, and the V component secondary transformation zone bit is marked as st_cr_flag. Illustratively, the st_cb_flag may also be named StCbFlag, and the st_cr_flag may also be named StCrFlag.
The decoding flow of the decoding end comprises: if the current block meets the parsing condition 3 (i.e., the first preset condition), then parsing the st_cb_flag from the encoded bitstream of the current block. When st_cb_flag is equal to 0, it means that the chrominance U component is not subjected to the secondary inverse transform, and when st_cb_flag is equal to 1, it means that the chrominance U component is subjected to the secondary inverse transform. If the chroma U component is subjected to the secondary inverse transformation, the secondary inverse transformation is performed on the region 4*4 of the left upper corner of the target transformation coefficient matrix corresponding to the chroma U component, the transformation coefficient of the region 4*4 of the left upper corner is updated to obtain an initial transformation coefficient matrix corresponding to the chroma U component, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the chroma U component to obtain a residual coefficient matrix corresponding to the chroma U component. If the chrominance U component does not perform the secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance U component is directly subjected to the initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance 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 meets the parsing condition 4 (i.e., the first preset condition), then parsing st_cr_flag 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. If the chroma V component performs the secondary inverse transformation, performing the secondary inverse transformation on the region 4*4 of the left upper corner of the target transformation coefficient matrix corresponding to the chroma V component, updating the transformation coefficient of the region 4*4 of the left upper corner to obtain an initial transformation coefficient matrix corresponding to the chroma V component, and performing the initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma V component to obtain a residual coefficient matrix corresponding to the chroma V component. If the chrominance V component does not perform the secondary inverse transformation, the target transformation coefficient matrix corresponding to the chrominance V component is directly subjected to the initial inverse transformation to obtain the residual coefficient matrix corresponding to the chrominance V component. And obtaining a reconstruction block corresponding to the chroma V component based on the residual coefficient matrix (namely the 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-frame prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chroma U component contains a non-zero transform coefficient, for example, ctp_u is 1. The parsing condition 4 may include: the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag bit is used for indicating that a final transform coefficient matrix corresponding to the chroma V component contains a non-zero transform coefficient, for example, ctp_v is 1. The analysis conditions 3 and 4 may further include optional analysis conditions, which are referred to as the first preset conditions in embodiment 1 and are not described herein.
The coding flow of the coding end comprises: if the current block meets the analysis condition 5, the coding end does not perform secondary transformation or performs secondary transformation on the chroma U component through RDO decision. If the decision is made that the secondary transformation is not performed on the chrominance U component, the residual coefficient matrix corresponding to the chrominance U component is directly subjected to the initial transformation 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. 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 equal to 0. If it is decided to perform secondary transformation on the chroma U component, performing initial transformation on the residual coefficient matrix corresponding to the chroma U component to obtain an initial transformation coefficient matrix corresponding to the chroma U component, performing secondary transformation on the transform coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix corresponding to the chroma U component to obtain a target transformation coefficient matrix corresponding to the chroma U component, quantizing the target transformation coefficient matrix corresponding to the chroma U component to obtain a final transformation coefficient matrix corresponding to the chroma U component, encoding the final transformation coefficient matrix corresponding to the chroma U component in the encoded bitstream, and encoding st_cb_flag equal to 1 in the encoded bitstream.
If the current block meets the analysis condition 6, the coding end can also carry out no secondary transformation or secondary transformation on the chroma V component through RDO decision. If the decision is made that the secondary transformation is not performed on the chrominance V component, the residual coefficient matrix corresponding to the chrominance V component is directly subjected to the initial transformation to obtain an initial transformation coefficient matrix corresponding to the chrominance V component, and the initial transformation coefficient matrix corresponding to the chrominance V component is quantized to obtain a final transformation coefficient matrix corresponding to the chrominance V component. The 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 it is decided to perform secondary transformation on the chroma V component, performing initial transformation on the residual coefficient matrix corresponding to the chroma V component to obtain an initial transformation coefficient matrix corresponding to the chroma V component, performing secondary transformation on the transform coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix corresponding to the chroma V component to obtain a target transformation coefficient matrix corresponding to the chroma V component, quantizing the target transformation coefficient matrix corresponding to the chroma V component to obtain a final transformation coefficient matrix corresponding to the chroma V component, encoding the final transformation coefficient matrix corresponding to the chroma V component in the encoded bit stream of the current block, and encoding st_cr_flag in the encoded 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 parsing conditions 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 chroma V component contains non-zero transformation coefficients. Resolution condition 5 and resolution condition 6 may also include optional resolution conditions, see the second preset conditions of example 3.
Example 14: on the basis of the st_cb_flag of embodiment 13, the encoding side encodes the st_cb_flag in a context-based binary arithmetic encoding manner, and the decoding side 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 binary arithmetic coding mode or a decoding mode based on context is adopted, a context model can be also preconfigured. For example, a single context model is preconfigured as the target context model for all chrominance U components. For another example, at least two context models based on chroma intra prediction modes are preconfigured, and each of these context models may be a target context model. For another example, at least two context models based on the size of the chrominance component of the current block are preconfigured, and each of these context models may be a target context model.
For an example, regarding the configuration manner of the context model, and the encoding manner and decoding manner of the st_cb_flag, reference may be made to embodiment 10, where st_chroma_flag is replaced by st_cb_flag, and the description of this embodiment 14 is not repeated.
On the basis of the st_cr_flag of embodiment 13, the encoding side encodes the st_cr_flag in a context-based binary arithmetic encoding manner, and the decoding side decodes the st_cr_flag in a context-based binary arithmetic decoding manner. Or the encoding end encodes the st_cr_flag in a bypass encoding mode, and the decoding end decodes the st_cr_flag in a bypass decoding mode. If a binary arithmetic coding mode or a decoding mode based on context is adopted, a context model can be also preconfigured. For example, a single context model is preconfigured as the target context model for all chrominance V components. For another example, at least two context models based on chroma intra prediction modes are preconfigured, and each of these context models may be a target context model. For another example, at least two context models based on the size of the chrominance component of the current block are preconfigured, and each of these context models may be a target context model.
For an example, regarding the configuration manner of the context model, and the encoding manner and decoding manner of the st_cr_flag, reference may be made to embodiment 10, where st_chroma_flag is replaced by st_cr_flag, and the description of this embodiment 14 is not repeated.
Example 15: on the basis of embodiment 13, for the chroma U component, the inverse transform procedure at the decoding end is similar to that of embodiment 11 or embodiment 12, the condition of case one of embodiment 11 or embodiment 12 is replaced with "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 second chroma component is equal to 1, and the value of the current chroma component is a chroma U component and the value of the st_cb_flag is equal to 1", and the condition of case two of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block, the value of the width and height of the chroma component is equal to 4, and the value of the second chroma component is a chroma U component and the value of the st_cb_flag is equal to 1", and the specific inverse transform procedure is the same as that of case one and two of embodiment 11 or embodiment 12, and will not be repeated here.
Similarly, for the chroma V component, the inverse transform process at the decoding end is similar to that of embodiment 11 or embodiment 12, and the condition of case one of embodiment 11 or embodiment 12 is replaced with "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 second chroma component is equal to 1, and the value of the current chroma component is a chroma V component and the value of the st_cr_flag is equal to 1", and the condition of case two of embodiment 11 or embodiment 12 is replaced with "if the current block is a chroma intra prediction residual block, the value of the width and height of the chroma component is equal to 4, and the value of the second chroma component is a chroma V component and the value of the st_cr_flag is equal to 1", and the specific inverse transform process is the same as that of case one of embodiment 11 or embodiment 12 and the second, and the details are not repeated here.
Example 16: the luminance component, the chrominance U component and the chrominance V component share one secondary transform flag bit, which may be a luminance secondary transform flag bit, and the luminance secondary transform flag bit is denoted as st_tu_flag. Illustratively, the st_tu_flag may also be named StTuFlag.
The decoding flow of the decoding end comprises: if the current block meets the parsing condition 7 (i.e., the third preset condition), then parsing the st_tu_flag 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 secondary inverse transformation is performed on the luminance component, the chrominance U component, and the chrominance V component at the same time. For example, if the luminance component, the chrominance U component, and the chrominance V component are subjected to the secondary inverse transformation at the same time, the secondary inverse transformation is performed on the region 4*4 in the upper left corner of the target transformation coefficient matrix corresponding to the luminance component, the transformation coefficients in the region 4*4 in the upper left corner are updated, so as to obtain an initial transformation coefficient matrix corresponding to the luminance component, and then the initial inverse transformation is performed on the initial transformation coefficient matrix corresponding to the luminance component, so as to obtain a residual coefficient matrix corresponding to the luminance component. Similarly, a residual coefficient matrix corresponding to the chrominance U component and a residual coefficient matrix corresponding to the chrominance V component can be obtained. If the luminance component, the chrominance U component and the chrominance V component are not subjected to secondary inverse transformation, the target transformation coefficient matrix corresponding to the luminance component is directly subjected to initial inverse transformation to obtain a residual coefficient matrix corresponding to the luminance component, and the residual coefficient matrix corresponding to the chrominance U component and the residual coefficient matrix corresponding to the chrominance V component can be obtained in the same way. 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 conditions 7 may include: the prediction mode of the current block is an intra prediction mode, and the transform coefficient flag bit is used for indicating that a 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 or ctp_u is 1 or ctp_v is 1, and ctp_y is 1 and is used for indicating that the final transform coefficient matrix corresponding to the luminance component contains a non-zero transform coefficient. The analysis conditions 7 may further include optional analysis conditions, which refer to the third preset conditions in embodiment 5, and are not repeated here.
The coding flow of the coding end comprises: 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 decision is made that the luminance component, the chrominance U component and the chrominance V component are not subjected to secondary transformation, 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.
If it is decided to perform secondary transformation on the luminance component, the chrominance U component and the chrominance V component simultaneously, performing initial transformation on the residual coefficient matrix corresponding to the luminance component to obtain an initial transformation coefficient matrix corresponding to the luminance component, performing secondary transformation on the transform coefficient of the upper left corner 4*4 of the initial transformation coefficient matrix corresponding to the luminance component to obtain a target transformation coefficient matrix corresponding to the luminance component, and quantizing the target 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. And encoding a final transform coefficient matrix corresponding to the luminance component, a final transform coefficient matrix corresponding to the chrominance U component, and a final transform coefficient matrix corresponding to the chrominance V component in the encoded bit stream, and encoding st_tu_flag equal to 1 in the encoded bit stream.
Illustratively, the parsing conditions 8 may include: the prediction mode of the current block is an intra-frame prediction mode, and an initial transformation coefficient matrix corresponding to a luminance component or an initial transformation coefficient matrix corresponding to a chrominance U component or an initial transformation coefficient matrix corresponding to a chrominance V component contains non-zero transformation coefficients. The analysis conditions 8 may further include optional analysis conditions, which refer to the fourth preset condition in embodiment 6, and are not repeated here.
Example 17: on the basis of the st_tu_flag in embodiment 16, the encoding end may encode the st_tu_flag in a context-based binary arithmetic encoding manner, and the decoding end decodes the st_tu_flag in a context-based binary arithmetic decoding manner. Alternatively, 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 binary arithmetic coding mode or a decoding mode based on context is adopted, a context model can be also preconfigured. For example, a single context model may be preconfigured as the 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 preconfigured, each of which may be a target context model.
Regarding the configuration mode of the context model, and the encoding mode and decoding mode of the st_tu_flag, reference may be made to embodiment 10, where st_chroma_flag is replaced by st_tu_flag, and the description in this embodiment 17 is not repeated.
Example 18: on the basis of embodiment 11, the inverse transform process at the decoding end is identical to the inverse transform process of embodiment 11 for chrominance components (e.g., chrominance U component and chrominance V component), and the condition of case one of embodiment 11 is replaced with "if the current block is an intra-luminance prediction residual block, the value of the width or height of the current block is greater than 4, and the value of the second reconversion enable flag is equal to 1, the value of the est_tu_flag is equal to 1", and the condition of case two of embodiment 11 is replaced with "if the current block is an intra-luminance prediction residual block, the value of the width and height of the current block is equal to 4, and the value of the second reconversion enable flag is equal to 1", and the specific inverse transform process is identical to the case one and the case two of embodiment 11, and the detailed description thereof will not be repeated.
In one possible implementation, for the current block, including a luminance component and a chrominance component (e.g., a chrominance U-component and a chrominance V-component), the decoding-side inverse transform procedure is as follows:
a) If the current block is an intra prediction residual block, M 1 Or M 2 The following is performed on CoeffMatrix with a value greater than 4 and a value of second transform enable flag equal to 1:
1) Obtaining a 4×4 matrix C from the transform coefficient matrix:
c ij =coeff ij ,i=0~3,j=0~3
in c ij Is an element of matrix C, coeff ij Is an element of the transform coefficient matrix.
2) If the current block satisfies one of the following conditions:
condition 1, the current block is a luma prediction residual block, the value of the transform split direction of the current block is 0 and the value of the EstTuFlag is equal to 1, or the value of the EstEnableFlag is 0 and the value of the intraluma predmode is 0-2 or 13-32 or 44-65, and the reference samples with coordinates (x 0-1, y0+j-1) (j=1-N) are "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 subjected to secondary transform).
Then: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3
In p ij Is an element of a 4 x 4 matrix P. The matrix P is calculated as follows:
P=C×S 4
wherein S is 4 Is a 4 x 4 inverse transform matrix.
3) If the current block satisfies one of the following conditions:
Condition 1, the current block is a luma prediction residual block, if the value of EstEnableFlag is non-zero and the value of transform split direction of the current block is 0 and the value of EstTuFlag is equal to 1, or the value of EstEnableFlag is 0 and the value of intraluma predmode is 0-23 or 34-57, and the reference samples with coordinates (x0+i-1, y 0-1) (i=1-M) are "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 subjected to secondary transform).
Then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3
Q in ij Is an element of a 4 x 4 matrix Q. The matrix Q is calculated as follows:
Q=S 4 T ×C
s in 4 T Is S 4 Is a transpose of (a).
4) Modifying the values of the elements of the transformation coefficient matrix according to the matrix C:
coeff ij =c ij ,i=0~3,j=0~3
b) The transformation coefficient matrix is subjected to the following vertical inverse transformation to obtain a matrix K:
1) If the current block is an intra prediction residual block, M 1 And M 2 Is equal to 4 and the value of second transformation enableflag is equal to 1, and one of the following conditions is satisfied:
condition 1, the current block is a luma prediction residual block, and the value of EstEnableFlag is 0 or EstEnableFlag is non-zero and 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 subjected to secondary transform).
Then: k (k) ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
V in ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows:
V=D 4 T ×CoeffMatrix
d in 4 T Is an inverse transformation matrix D 4 Is a transposed matrix of (a).
2) Otherwise, the values of PbtCuFlag, sbtCuFlag, sbtDirFlag and sbtpossflag are determined,
first, if the value of PptCuFlag is 1 and the sequence number of the transform block is 0, 1, 2 or 3:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
v in ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows:
if the sequence number of the transform block is 0 or 1: then
V=DCT8 M2 T ×CoeffMatrix
DCT8 in M2 T Is DCT8 M2 DCT8 M2 Is M 2 ×M 2 The matrix is inverse transformed.
Otherwise, if the sequence number of the transform block is 2 or 3: then
V=DST7 M2 T ×CoeffMatrix
DST7 in M2 T Is DST7 M2 Transposed matrix of DST7 M2 Is M 2 ×M 2 The matrix is inverse transformed.
Second, otherwise, if the value of SbtCuFlag is 1 and the sequence number of the transform block is 0 and the width of the transform block is less than 64 and the height of the transform block is less than 32:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
v in ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows:
if SbtDirFlag is 1 and SbtPosFlag is 0: then
V=DCT8 M2 T ×CoeffMatrix
DCT8 in M2 T Is DCT8 M2 DCT8 M2 Is M 2 ×M 2 The matrix is inverse transformed.
Otherwise:
V=DST7 M2 T ×CoeffMatrix
DST7 in M2 T Is DST7 M2 Transposed matrix of DST7 M2 Is M 2 ×M 2 The matrix is inverse transformed.
Third, otherwise:
k ij =Clip3(-32768,32767,(v ij +2 4 )>>5),i=0~M 1 -1,j=0~M 2 -1
v in ij Is an element of matrix V, k ij Is an element of the matrix K. The matrix V is calculated as follows:
V=DCT2 M2 T ×CoeffMatrix
DCT2 in M2 T Is DCT2 M2 DCT2 M2 Is M 2 ×M 2 The matrix is inverse transformed.
c) The matrix K is subjected to the following horizontal inverse transformation to obtain a matrix H:
1) If the current transform block is an intra prediction residual block, M 1 And M 2 Is equal to 4 and the value of second transformation enableflag is equal to 1, and one of the following conditions is satisfied:
condition 1, the current block is a luma prediction residual block, and the value of EstEnableFlag is 0 or EstEnableFlag is non-zero and 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 subjected to secondary transform).
Then:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1),i=0~M 1 -1,j=0~M 2 -1
w in i,j Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 22-BitDepth. The matrix W is calculated as follows:
W=K×D 4
d in 4 Is an inverse transform matrix.
2) Otherwise, the values of PbtCuFlag, sbtCuFlag, sbtDirFlag and sbtpossflag are determined,
first, if the value of PptCuFlag is 1 and the sequence number of the transform block is 0, 1, 2 or 3:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1)i=0~M 1 -1,j=0~M 2 -1
w in ij Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 20-BitDepth. The matrix W is calculated as follows:
If the sequence number of the transform block is 0 or 2: then
W=K×DCT8 M1
Otherwise, if the sequence number of the transform block is 1 or 3: then
W=K×DST7 M1
DCT8 in M1 、DST7 M1 Is M 1 ×M 1 The matrix is inverse transformed.
Second, otherwise, if the value of SbtCuFlag is 1 and the sequence number of the transform block is 0 and the width of the transform block is less than 32 and the height of the transform block is less than 64:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1)i=0~M 1 -1,j=0~M 2 -1
w in ij Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 20-BitDepth. The matrix W is calculated as follows:
if SbtDirFlag is 0 and SbtPosFlag is 0: then
W=K×DCT8 M1
Otherwise:
W=K×DST7 M1
DCT8 in M1 、DST7 M1 Is M 1 ×M 1 The matrix is inverse transformed.
Third, otherwise:
h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1)i=0~M 1 -1,j=0~M 2 -1
w in ij Is an element of matrix W, h ij Is an element of the matrix H. The value of MaxValue is (1<<BitDepth) -1, shift1 equals 20-BitDepth. The matrix W is calculated as follows:
W=K×DCT2 M1
DCT2 in M1 Is M 1 ×M 1 The matrix is inverse transformed.
d) And directly taking the matrix H as a residual sample matrix ResidueMatrix, and ending the inverse transformation operation.
Example 19:
the decoding flow of the decoding end comprises: parsing the secondary transform enable flag SecondaryTransformEnableFlag, secondaryTransformEnableFlag from the bitstream indicates whether the sequence-level control information allows the current sequence to use the secondary inverse transform, e.g., second-digit transform enable flag 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 second-digit transform enable flag 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 secondary inverse transform, it may also be analyzed whether the sequence-level control information allows the chrominance components (i.e., the chrominance components of all image blocks of the current sequence) to use the secondary inverse transform, e.g., the first value of the st_chroma_enable_flag is equal to the first value of the st_chroma_enable_flag, and the second value of the st_chroma_enable_flag is equal to the second value of the st_chroma_enable_flag. The syntax of the second transform enable flag and the st_chroma_enable_flag described above is as follows:
Figure BDA0002828877170000451
The above-mentioned sequence level control information is merely an example, and may be image parameter set level control information, image header level control information, and slice header level control information, and the level of the control information is not limited.
The coding flow of the coding end comprises: the encoding secondary transform enable flag bit second transform enable flag indicates whether the sequence level control information allows the current sequence to use the secondary inverse transform, e.g., second transform enable flag equals a first value indicating that the sequence level control information allows the current sequence to use the secondary inverse transform, and second transform enable flag equals a second value indicating 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 secondary inverse transform, the encoded chroma secondary transform enable flag bit 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 secondary inverse transform, e.g., an equal value of st_chroma_enable_flag to the first value indicates that the sequence level control information allows the chroma components to use the secondary inverse transform, and an equal value of st_chroma_enable_flag to the second value indicates that the sequence level control information does not allow the chroma components to use the secondary inverse transform.
The above-mentioned sequence level control information is merely an example, and may be image parameter set level control information, image header level control information, and slice header level control information, and the level of the control information is not limited.
Example 20: for an Improved Intra Prediction (IIP) mode, if it is determined to IIP a current block, IIP is performed on a luminance component and a chrominance component of the current block, respectively, including:
1. if the prediction mode of the luminance component or the chrominance component of the current block is an angular intra prediction mode:
luminance component: an 8-tap interpolation filter is used to generate the reference pixels for the sub-pixel points, and when MIPF is enabled, a class 3 8-tap filter is used, the index value of which is implicitly derived based on the size of the current block and the rank index number. The index of the filter is derived using the following formula: filter_idx=mipf_enable_flag? (j < 1. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current luminance component, respectively.
Chrominance 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, the index value of which is implicitly derived based on the size of the current block and the rank index number. The index of the filter is derived using the following formula: filter_idx=mipf_enable_flag? (j < 2. j represents the index number of the column in which the current pixel is located, and w and h represent the width and height of the current chrominance component, respectively.
2. If the prediction mode of the luminance component or the chrominance component of the current block is the DC mode:
for the luminance component and the chrominance component, the following operations are performed: the pixels inside the current block and the pixels close to the boundary have different predicted values, still using the conventional DC values for the inside pixels (not the pixels of the first two rows or columns); for pixels close to 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 predicted 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, a 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 B position of the first column, using the weighted average value of the reference pixels B0, B1, B2 and DC as the predicted value of the B position; if the current pixel point is located at the upper left corner C position of the current block, the weighted average of the reference pixels C0, C1, C2, C3, C4 and DC is 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 position, a weighted average of the reference pixels D and DC is used as a predicted value of the D position; if the current pixel point is positioned at the second column E position, using the weighted average value of the reference pixel E and DC as a predicted value of the E position; if the current pixel point is located at the upper left corner F position of the current block, a weighted average of the reference pixels F0, F1 and DC is used as a predicted value of the F position.
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 luminance component or the chrominance component of the current block is the Plane mode:
for the luminance component and the chrominance component, the following operations are performed: the pixels inside the current block and the pixels close to the boundary have different predictors, the plane predictor is still used for the inside pixels (not the pixels of the first two rows or columns); for pixels close to the boundary (pixels of the first two rows or columns), a weighted average of (plane predictor and reference pixel values) is used as the final predictor. The luminance and chrominance have respective reference pixels, and the specific weights are consistent with the modified 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 luminance component and the chrominance component, the following operations are performed: the original 1 reference pixel value is replaced by a weighted average of 5 reference pixels, and the weights of the 5 reference pixels are as follows: {82, 252, 356, 252, 82}. The luminance and chrominance have respective reference pixels. And then performing a bilinear prediction process.
Of course, the above-described embodiment 1 to embodiment 20 may be implemented alone or in combination. For example, each of the embodiments may be realized separately, the embodiments 1 and 3 may be realized in combination, the embodiments 2 and 4 may be realized in combination, the embodiments 5 and 6 may be realized in combination, the embodiments 8 and 10 may be realized in combination, the embodiments 9 and 10 may be realized in combination, the embodiments 8 and 11 may be realized in combination, the embodiments 9 and 11 may be realized in combination, the embodiments 8 and 12 may be realized in combination, the embodiments 9 and 12 may be realized in combination, the embodiments 8, 10 and 11 may be realized in combination, the embodiments 8, 10 and 12 may be realized in combination, the embodiments 13 and 14 may be realized in combination, the embodiments 13 and 15 may be realized in combination, the embodiments 13, 14 and 15 may be realized in combination, the embodiments 16 and 17 may be realized in combination, the embodiments 16 and 18 may be realized in combination, the embodiments 16, 17 and 18 may be realized in combination, and so on.
Of course, the above is only a few examples, and the combination of the embodiments is not limited.
Based on the same application concept as the above method, the embodiment of the present application further provides a decoding device, applied to a decoding end, as shown in fig. 6A, which is a structural diagram of the device, where the device includes: an obtaining module 611, configured to obtain a coded bitstream of the current block; a decoding module 612, configured to parse a transform coefficient flag bit from the encoded bitstream, where the transform coefficient flag bit 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, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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; if the final transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream; a processing module 613, configured to dequantize the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; and 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 bit.
In one possible embodiment, the first preset condition further includes at least one of the following: 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 perform initial inverse transformation; the chroma intra 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 chrominance components to use a quadratic inverse transformation.
In one possible implementation, the transform coefficient flag bits include a chroma U component transform coefficient flag bit and a chroma V component transform coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 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 one possible implementation, the chrominance components are a chrominance U component and a chrominance V component, and the secondary transform flag bit is a UV component sharing secondary transform flag bit; and when the value of the UV component shared secondary transformation zone bit is a first value, the UV component shared secondary transformation zone bit is used for indicating 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 shared secondary transformation zone bit is a second value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are not subjected to secondary inverse transformation. Or the chrominance components are chrominance U components and chrominance V components, and the secondary transformation zone bit comprises a U component secondary transformation zone bit and a V component secondary transformation zone bit; the method comprises the steps that when the value of a U component secondary transformation zone bit is a first value, the U component secondary transformation zone bit is used for indicating that the chromaticity U component is subjected to secondary inverse transformation, 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 the chromaticity U component is not subjected to secondary inverse transformation; and when the value of the V component secondary transformation zone bit is a first value, the V component secondary transformation zone bit is used for indicating that the chroma V component is subjected to secondary inverse transformation, or when the value of the V component secondary transformation zone bit is a second value, the V component secondary transformation zone bit is used for indicating that the chroma V component is not subjected to secondary inverse transformation.
In one 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, and an initial transformation coefficient matrix corresponding to the chrominance component is obtained; 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 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 above method, the embodiment of the present application further provides an encoding device, which is applied to an encoding end, as shown in fig. 6B, and is a structural diagram of the device, where the device includes: an obtaining module 621, configured to obtain a residual coefficient matrix corresponding to a 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 622, configured to determine whether to perform secondary transformation on the initial transform coefficient matrix corresponding to the chrominance component if the current block meets a second preset condition, so as to obtain a target transform coefficient matrix corresponding to the chrominance component; a processing module 623, configured to quantize a target transform coefficient matrix corresponding to the chrominance component, to obtain a final transform coefficient matrix corresponding to the chrominance component; an encoding module 624, configured to encode a transform coefficient flag bit in an encoded bitstream of the current block, 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; coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component; wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
In one possible embodiment, the second preset condition includes at least one of: the current block does not use an intra prediction filtering mode; the current block does not use an improved intra prediction mode; the current block adopts a transformation check (DCT 2 ) to perform initial transformation; the chroma intra 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 chrominance components to use a secondary transform.
In one possible implementation, the chrominance components are a chrominance U component and a chrominance V component, and the secondary transform flag bit is a UV component sharing secondary transform flag bit; and when the value of the UV component shared secondary transformation zone bit is a first value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are subjected to secondary transformation at the same time, or when the value of the UV component shared secondary transformation zone bit is a second value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are not subjected to secondary transformation. Or the chrominance components are chrominance U components and chrominance V components, and the secondary transformation zone bit comprises a U component secondary transformation zone bit and a V component secondary transformation zone bit; the method comprises the steps that when the value of a U component secondary transformation zone bit is a first value, the U component secondary transformation zone bit is used for indicating that the chroma U component is subjected to secondary transformation, 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 the chroma U component is not subjected to secondary transformation; and when the value of the V component secondary transformation zone bit is a first value, the V component secondary transformation zone bit is used for indicating that the chroma V component is subjected to secondary transformation, or when the value of the V component secondary transformation zone bit is a second value, the V component secondary transformation zone bit is used for indicating that the chroma V component is not subjected to secondary transformation.
The processing module 623 is also configured to: if the secondary transformation is carried out on the initial transformation coefficient matrix corresponding to the chrominance component, carrying out the 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 fact that secondary transformation is not carried out on the initial transformation coefficient matrix corresponding to the chrominance component is determined, determining the initial transformation coefficient matrix corresponding to the chrominance component as a target transformation coefficient matrix corresponding to the chrominance component.
The decoding end device (the decoding end device may be a video decoder) provided in the embodiment of the present application, and in terms of a hardware layer, a hardware architecture schematic diagram of the decoding end device may be specifically shown in fig. 7A. Comprising the following steps: a processor 711 and a machine-readable storage medium 712, said machine-readable storage medium 712 storing machine-executable instructions executable by said 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 configured to execute machine-executable instructions to perform the steps of: acquiring a coded bit stream of a current block, and analyzing a transformation coefficient flag bit from the coded bit stream, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transformation coefficient or not; if the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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; if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
The encoding end device (the encoding end device may be a video encoder) provided in the embodiment of the present application, and in terms of a hardware layer, a hardware architecture schematic diagram of the encoding end device may be specifically shown in fig. 7B. Comprising 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 the machine executable instructions to implement the methods disclosed in the above examples of the present application. For example, a processor is configured to execute machine-executable instructions to perform the steps of: acquiring a residual coefficient matrix corresponding to a 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 an initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component; quantizing a target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component, and coding a transformation coefficient flag bit in a coded bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient; coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component; wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
Based on the same application concept as the above method, a camera apparatus is further provided in the embodiments of the present application, where the camera apparatus may include the encoding device and/or the decoding device in any of the embodiments described above.
Based on the same application concept as the above method, the embodiments of the present application further provide a machine-readable storage medium, where a number of computer instructions are stored, where the computer instructions can implement the codec method disclosed in the above example of the present application when executed by a processor. Wherein 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, or the like. For example, a machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, a storage drive (e.g., hard drive), a solid state drive, any type of storage disk (e.g., optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.
Based on the same application concept as the above method, the embodiments of the present application further provide a computer application program, where the computer application program enables the codec method disclosed in the above example of the present application to be implemented when the computer application program is executed by a processor.
The system, apparatus, module or unit set forth in the above embodiments may be implemented by a computer chip or entity, or by an article of manufacture having some function. 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 device, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present application.
It will be appreciated by those skilled in the art that 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, etc.) 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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. Moreover, 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 foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (17)

1. A decoding method, applied to a decoding end, the method comprising:
acquiring a coded bit stream of a current block, and analyzing a transformation coefficient flag bit from the coded bit stream, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transformation coefficient or not; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
If the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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;
if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
2. The method of claim 1, wherein 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 chroma intra prediction mode of the current block meets a preset mode condition;
the control information allows the chrominance components to use a quadratic inverse transformation.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the chroma intra prediction mode of the current block meeting a preset mode condition includes:
the Chroma Intra prediction mode of the current block is not Intra Chroma PCM mode.
4. A method according to any one of claims 1-3, wherein the chrominance components are a chrominance U-component and a chrominance V-component, and the secondary transform flag is a UV-component common secondary transform flag;
and when the value of the UV component shared secondary transformation zone bit is a first value, the UV component shared secondary transformation zone bit is used for indicating 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 shared secondary transformation zone bit is a second value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are not subjected to secondary inverse transformation.
5. A method according to any one of claim 1 to 3, wherein,
the parsing the secondary transformation flag bit from the encoded bit stream includes:
And analyzing the secondary transformation flag bit from the coded bit stream by adopting a binary arithmetic decoding mode based on context.
6. The method of claim 5, wherein parsing the secondary transform flag bits from the encoded bitstream using context-based binary arithmetic decoding comprises:
the secondary transform flag bits are parsed from the encoded bitstream based on a single context model that is pre-configured.
7. A coding method, applied to a coding end, the method comprising:
acquiring a residual coefficient matrix corresponding to a 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 an initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
quantizing a target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component, and coding a transformation coefficient flag bit in a coded bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
Coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component;
wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
8. The method of claim 7, wherein 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 chroma intra prediction mode of the current block meets a preset mode condition;
the control information allows the chrominance components to use a secondary transform.
9. The method of claim 8, wherein the step of determining the position of the first electrode is performed,
the chroma intra prediction mode of the current block meeting a preset mode condition includes:
the Chroma Intra prediction mode of the current block is not Intra Chroma PCM mode.
10. The method according to any one of claims 7-9, wherein the chrominance components are a chrominance U-component and a chrominance V-component, and the secondary transform flag is a UV-component common secondary transform flag;
And when the value of the UV component shared secondary transformation zone bit is a first value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are subjected to secondary transformation at the same time, or when the value of the UV component shared secondary transformation zone bit is a second value, the UV component shared secondary transformation zone bit is used for indicating that the chroma U component and the chroma V component are not subjected to secondary transformation.
11. The method according to any one of claims 7 to 9, wherein,
the secondary transform flag bit for coding the block-level chrominance component in the coded bit stream of the current block comprises:
and if the final transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients, the secondary transformation flag bit is encoded in the encoding bit stream of the current block.
12. The method according to any one of claims 7 to 9, wherein,
the secondary transform flag bit for coding the block-level chrominance component in the coded bit stream of the current block comprises:
and encoding the secondary transformation flag bit by adopting a binary arithmetic encoding mode based on context.
13. The method of claim 12, wherein the step of determining the position of the probe is performed,
the method for encoding the secondary transformation flag bit by adopting a binary arithmetic encoding mode based on context comprises the following steps:
The secondary transform flag is encoded based on a single context model that is pre-configured.
14. A decoding device, for use at a decoding end, the device comprising:
an acquisition module, configured to acquire a coded bitstream of a current block;
a decoding module, configured to parse a transform coefficient flag bit from the encoded bitstream, where the transform coefficient flag bit 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; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
If the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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;
if the final transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream;
the processing module is used for carrying out inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
and the determining module is used for determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
15. An encoding apparatus, for use at an encoding end, the apparatus comprising:
The acquisition module is used for acquiring a residual coefficient matrix corresponding to the chrominance component of the current block; performing initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
the determining module is used for determining whether to perform secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance component if the current block meets a second preset condition, so as to obtain a target transformation coefficient matrix corresponding to the chrominance component;
the processing module is used for quantizing the target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component;
the coding module is used for coding a transformation coefficient flag bit in the coding bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to the chroma component contains a non-zero transformation coefficient or not; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
Coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component;
wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
16. A decoding end apparatus, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
the processor is configured to execute machine-executable instructions to perform the steps of:
acquiring a coded bit stream of a current block, and analyzing a transformation coefficient flag bit from the coded bit stream, wherein the transformation coefficient flag bit is used for indicating whether a final transformation coefficient matrix corresponding to a chrominance component of the current block contains a non-zero transformation coefficient or not; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
If the current block meets a first preset condition, analyzing a secondary transformation flag bit of a block-level chroma component from the coded bit stream, wherein the secondary transformation flag bit is used for indicating that the secondary inverse transformation is performed on the chroma component or the secondary inverse transformation is not performed on the chroma component; the first preset condition at least comprises: the prediction mode of the current block is an intra-frame prediction mode, and 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;
if the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient, analyzing the final transformation coefficient matrix corresponding to the chrominance component from the coded bit stream, and performing inverse quantization on the final transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
and determining whether to perform secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component according to the secondary transformation zone bit.
17. An encoding end device, comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor;
The processor is configured to execute machine-executable instructions to perform the steps of:
acquiring a residual coefficient matrix corresponding to a 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 an initial transformation coefficient matrix corresponding to the chrominance component to obtain a target transformation coefficient matrix corresponding to the chrominance component;
quantizing a target transformation coefficient matrix corresponding to the chrominance component to obtain a final transformation coefficient matrix corresponding to the chrominance component, and coding a transformation coefficient flag bit in a coded bit stream of the current block, wherein the transformation coefficient flag bit is used for indicating whether the final transformation coefficient matrix corresponding to the chrominance component contains a non-zero transformation coefficient; the transformation coefficient flag bit comprises a chroma U component transformation coefficient flag bit and a chroma V component transformation coefficient flag bit; when the value of the chroma U component transformation coefficient flag bit is a first value, the flag bit 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; when the value of the color U component transformation coefficient flag bit is a second value, the color U component transformation coefficient flag bit is used for indicating that a final transformation coefficient matrix corresponding to the color 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 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 chromatic V component transformation coefficient flag bit is a second value, the flag bit is used for indicating that a final transformation coefficient matrix corresponding to the chromatic V component does not contain a non-zero transformation coefficient; 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 includes: the value of the color U component transformation coefficient zone bit is a first value, and/or the value of the color V component transformation coefficient zone bit is a first value;
Coding a secondary transformation flag bit of a block level chroma component in a coded bit stream of the current block; the secondary transformation flag bit is used for indicating that the secondary transformation is performed on the chrominance component or the secondary transformation is not performed on the chrominance component;
wherein the second preset condition at least includes: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma component contains non-zero transformation coefficients.
CN202011455990.XA 2020-12-10 2020-12-10 Encoding and decoding method, device and equipment Active CN114630119B (en)

Priority Applications (3)

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

Applications Claiming Priority (1)

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

Related Child Applications (2)

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

Publications (2)

Publication Number Publication Date
CN114630119A CN114630119A (en) 2022-06-14
CN114630119B true CN114630119B (en) 2023-04-25

Family

ID=78668984

Family Applications (3)

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
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

Family Applications After (2)

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

Country Status (1)

Country Link
CN (3) CN114630119B (en)

Families Citing this family (2)

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

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2625911C1 (en) * 2011-10-19 2017-07-19 Кт Корпорейшен Video signal decoding method
CN110999304B (en) * 2017-07-28 2023-12-08 韩国电子通信研究院 Image processing method and image encoding/decoding method, and apparatus using the same
US10819979B2 (en) * 2018-09-06 2020-10-27 Tencent America LLC Coupled primary and secondary transform
US20200304794A1 (en) * 2019-03-21 2020-09-24 Mediatek Inc. Method and Apparatus of the Quantization Matrix Computation and Representation for Video Coding
CN113853798B (en) * 2019-05-17 2024-04-19 北京字节跳动网络技术有限公司 Signaling syntax elements according to chroma format
CN114630119B (en) * 2020-12-10 2023-04-25 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Also Published As

Publication number Publication date
CN113709481B (en) 2022-12-23
CN114630119A (en) 2022-06-14
CN113709480B (en) 2022-12-23
CN113709480A (en) 2021-11-26
CN113709481A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
US12184838B2 (en) Method and device for encoding/decoding image, and recording medium storing bit stream
US12155843B2 (en) Image encoding/decoding method and device, and recording medium storing bitstream
US11924412B2 (en) Image encoding/decoding method and device, and recording medium having bitstream stored therein
US12309368B2 (en) Methods and devices for intra sub-partition coding mode
US11109024B2 (en) Decoder side intra mode derivation tool line memory harmonization with deblocking filter
KR20160003174A (en) Adaptive color space transform coding
CN114630119B (en) Encoding and decoding method, device and equipment
CN113132724A (en) Encoding and decoding method, device and equipment thereof
CN114598871B (en) Encoding and decoding method, device and equipment
HK40064017B (en) Coding and decoding method, device and equipment
HK40064017A (en) Coding and decoding method, device and equipment
RU2817405C1 (en) Method, equipment and devices for encoding and decoding
RU2827777C2 (en) Method, equipment and devices for encoding and decoding
CN112911312B (en) Encoding and decoding method, device and equipment
US12375647B2 (en) Method and device for encoding/decoding image, and recording medium storing bit stream
RU2824459C2 (en) Methods, equipment and devices for decoding, encoding and encoding/decoding
RU2810727C1 (en) Methods, equipment and devices for decoding, encoding and encoding/decoding
HK40065929B (en) Coding and decoding method, device and equipment thereof
KR20240047943A (en) Video encoding and decoding device and method

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