A method, device and equipment for encoding and decoding
By analyzing the flag bits and preset conditions in the encoded bit stream, it is decided to perform initial and secondary transformations on the chroma components of the video blocks, which solves the problem of poor coding performance in the existing technology and improves the coding efficiency.
Patent Information
- Application Number
- CN202011412630.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-12-03
AI Technical Summary
In the existing technology, when performing secondary transformation on the luminance component and chrominance component of the current block during the video encoding process, there is a lack of effective implementation methods, resulting in poor encoding performance.
By obtaining the encoded bit stream of the current block, analyzing the transform coefficient flag bits and secondary transform flag bits, and deciding whether to perform initial transformation and secondary inverse transformation on the chroma component according to preset conditions, this ensures energy concentration and thereby improves coding performance.
The secondary transformation of the chroma component is realized, the coding performance and coding efficiency are improved, and the problem of poor coding performance in the existing technology is solved.
Smart Images

Figure CN114598871B
Abstract
Description
Technical Field
[0001] The present application relates to the field of coding and decoding technology, and in particular to a coding and decoding method, device and equipment thereof. Background Art
[0002] In order to save space, video images are transmitted after being encoded. The complete video encoding method may include prediction, transformation, quantization, entropy coding, filtering and other processes. Predictive coding may include intra-frame coding and inter-frame coding. Inter-frame coding uses the correlation in the video time domain to predict the pixels of the current image using the pixels of the adjacent encoded images to remove the redundancy in the video time domain. Intra-frame coding takes into account the strong spatial correlation between adjacent blocks, and uses the surrounding reconstructed pixels as reference pixels to predict the current uncoded block. It only needs to perform subsequent encoding processing on the residual value instead of encoding the original value, which effectively removes the redundancy in the spatial domain and greatly improves the compression efficiency.
[0003] In the video encoding process, transformation refers to converting an image described in the form of pixels in the spatial domain to an image in the transform domain, and expressing it in the form of transform coefficients. Since most images contain many flat areas and slowly changing areas, an appropriate transformation process can convert the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain, thereby removing the frequency domain correlation between signals and effectively compressing the bitstream in conjunction with the quantization process.
[0004] Regarding the transformation process, a secondary transformation technology is proposed in the related art. The secondary transformation technology means that: first, an initial transformation is performed to obtain the transformation coefficients after the initial transformation. Then, a secondary transformation is performed on the transformation coefficients after the initial transformation to obtain new transformation coefficients. Then, the new transformation coefficients are quantized and entropy encoded. However, there is currently no effective way to implement a secondary transformation on the luminance component and chrominance component of the current block, and there are problems such as poor coding performance. Summary of the invention
[0005] The present application provides a decoding method, which is applied to a decoding end, and the method includes:
[0006] Obtaining a coded bit stream of a current block, parsing a final transform coefficient matrix corresponding to a chrominance component of the current block from the coded bit stream, and parsing a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0007] If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0008] Whether to perform a secondary inverse transform on the chrominance component is determined according to the secondary transform flag.
[0009] The present application provides an encoding method, which is applied to an encoding end, and the method includes:
[0010] Get the residual coefficient matrix corresponding to the chrominance component of the current block;
[0011] Performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
[0012] If the current block satisfies a second preset condition, determining whether to perform a secondary transformation on the chrominance component;
[0013] Encoding a secondary transform flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component;
[0014] 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 chrominance component contains non-zero transformation coefficients.
[0015] The present application provides a decoding device, applied to a decoding end, the device comprising:
[0016] An acquisition module, used for acquiring a coded bit stream of a current block;
[0017] A parsing module, configured to parse a final transform coefficient matrix corresponding to the chrominance component of the current block from the coded bit stream, and parse a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0018] If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0019] A determination module is used to determine whether to perform a secondary inverse transformation on the chrominance component according to the secondary transformation flag.
[0020] The present application provides an encoding device, applied to an encoding end, the device comprising:
[0021] An acquisition module, used to acquire a residual coefficient matrix corresponding to the chrominance component of the current block;
[0022] A processing module, used for performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
[0023] A determination module, configured to determine whether to perform a secondary transformation on the chrominance component if the current block satisfies a second preset condition;
[0024] An encoding module, configured to encode a secondary transformation flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transformation flag is used to indicate whether to perform a secondary transformation on the chrominance component or not to perform a secondary transformation on the chrominance component;
[0025] 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 chrominance component contains non-zero transformation coefficients.
[0026] The present application provides a decoding end device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;
[0027] The processor is used to execute machine executable instructions to implement the following steps:
[0028] Obtaining a coded bit stream of a current block, parsing a final transform coefficient matrix corresponding to a chrominance component of the current block from the coded bit stream, and parsing a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0029] If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0030] Whether to perform a secondary inverse transform on the chrominance component is determined according to the secondary transform flag.
[0031] The present application provides an encoding end device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;
[0032] The processor is used to execute machine executable instructions to implement the following steps:
[0033] Get the residual coefficient matrix corresponding to the chrominance component of the current block;
[0034] Performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
[0035] If the current block satisfies a second preset condition, determining whether to perform a secondary transformation on the chrominance component;
[0036] Encoding a secondary transform flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component;
[0037] 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 chrominance component contains non-zero transformation coefficients.
[0038] It can be seen from the above technical scheme that in the embodiment of the present application, after the chrominance components of the current block are initially transformed, it can be determined whether to perform a secondary transformation on the chrominance components of the current block. If so, the chrominance components of the current block can be secondary transformed, that is, the secondary transformation technology can also be applied to the chrominance components of the current block. When the chrominance components have a problem of insufficient energy concentration after the initial transformation, the chrominance components can also be secondary transformed, thereby improving the coding performance and coding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1A-Figure 1C is a schematic diagram of a DT partitioning mode in one implementation of the present application;
[0040] Figure 1D is a schematic diagram of a luma intra prediction mode in one implementation of the present application;
[0041] Figure 1E-1L It is a schematic diagram of the application of intra-frame prediction filtering in one implementation of the present application;
[0042] Figure 2 is a schematic diagram of a video coding framework in one implementation of the present application;
[0043] Figure 3A and Figure 3B is a flowchart of a decoding method in one embodiment of the present application;
[0044] Figure 4A and Figure 4B is a flowchart of an encoding method in one embodiment of the present application;
[0045] Figure 5A is a flowchart of a decoding method in one embodiment of the present application;
[0046] Figure 5B is a flowchart of an encoding method in one embodiment of the present application;
[0047] Fig. 6A is a structural diagram of a decoding device in one embodiment of the present application;
[0048] Figure 6B is a structural diagram of an encoding device in one embodiment of the present application;
[0049] Fig. 7A is a hardware structure diagram of a decoding end device in one embodiment of the present application;
[0050] Figure 7B It is a hardware structure diagram of an encoding end device in one implementation of the present application. DETAILED DESCRIPTION
[0051] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, rather than for limiting the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items. It should be understood that, although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information, which may depend on the context, and in addition, the term "if" used may be interpreted as "at ... ", or "when ... ", or "in response to determination".
[0052] In order to enable those skilled in the art to better understand the technical solution of the present application, the technical terms are briefly explained below.
[0053] Prediction Signal: refers to the pixel value derived from the encoded and decoded pixel. The residual is obtained by the difference between the original pixel and the predicted pixel, and then the residual transformation, quantization and coefficient encoding are performed.
[0054] Intra Prediction: refers to a prediction mode that predicts the prediction value of the current block by reconstructing the pixel values of the surrounding decoded area. Common methods include copying pixels in the angular direction and deriving the prediction value according to a certain gradient principle. For example, intra prediction removes the spatial correlation of the video / image.
[0055] Transform kernel: In video coding, transformation is an essential stage for data compression. Transformation can make the energy of the signal more concentrated. Transformation technology based on discrete cosine transform (DCT) / discrete sine transform (DST) has always been the mainstream transformation technology for video coding. DCT and DST are divided into multiple transformation kernels according to different basis functions. See Table 1 for three transformation kernels.
[0056] Table 1
[0057]
[0058] Forward transform and inverse transform: The video encoding process includes forward transform and inverse transform. Forward transform is also called forward transform, and inverse transform is also called inverse transform. For example, forward transform converts a two-dimensional residual coefficient (also called residual signal) into a two-dimensional transform coefficient (also called spectrum signal) with more concentrated energy. After the transform coefficient is quantized and other processes, it can effectively remove high-frequency components and retain medium and low-frequency components, thus achieving compression. For example, the forward transform process can be represented by the matrix form of formula (1).
[0059] F=B·f·A T Formula (1)
[0060] In formula (1), M represents the width of the residual block (i.e., the block composed of residual coefficients), N represents the height of the residual block, f represents the original residual signal of N*M dimension, F represents the frequency domain signal of N*M dimension (i.e., the frequency domain signal after conversion), A and B represent the transformation matrices of M*M and N*N dimensions, and both A and B satisfy orthogonality, such as the transformation kernel shown in Table 1.
[0061] The inverse transform (also called inverse transform) is the inverse process of the forward transform, that is, the frequency domain signal F is converted into the time domain residual signal f through the orthogonal transform matrix A and the orthogonal transform matrix B. For example, the inverse transform process can be represented by the matrix form of formula (2).
[0062] f=B T ·F·A Formula (2)
[0063] Horizontal transform and vertical transform: In the encoding transformation stage, the input is a two-dimensional residual signal, let X = A·f T , then F=B·X T , for example, is represented by the matrix form of formula (3).
[0064] F=B·f·A T =B·(A·f T ) T Formula (3)
[0065] From the above, it can be seen that the forward transformation of a two-dimensional signal can be achieved by two one-dimensional forward transformations. After the first forward transformation, an M*N signal X is obtained, and the correlation between the horizontal pixels of the two-dimensional residual signal is removed. Therefore, the first forward transformation is called horizontal transformation, and A is called the horizontal transformation matrix. After the second forward transformation, a signal F is obtained, and the correlation between the vertical pixels of the two-dimensional residual signal is removed. Therefore, the second forward transformation is called vertical transformation, and B is called the vertical transformation matrix.
[0066] Transform pair: also called transform kernel pair. In order to support matrix blocks, M is not necessarily equal to N, the dimensions of A and B are not necessarily equal, and it can also support transform matrices where A and B are not produced by the same transform kernel. Therefore, in the transformation, there is a transform pair {H, V} composed of the transform kernels corresponding to A and B. H is called the horizontal transform kernel and V is called the vertical transform kernel.
[0067] Rate-Distortion Optimized (RDO): There are two major indicators for evaluating coding efficiency: bit rate and PSNR (Peak Signal to Noise Ratio). The smaller the bit rate, the greater the compression rate; the greater the PSNR, the better the reconstructed image quality. When selecting a mode, the discriminant formula is essentially a comprehensive evaluation of the two.
[0068] The cost value corresponding to the mode is: J(mode) = D + λ*R. For example, D represents Distortion, which is usually measured using the SSE indicator. SSE refers to the mean square sum of the difference between the reconstructed block and the source image; λ is the Lagrange multiplier; R is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residual, etc. When selecting a mode, if the RDO principle is used to make a comparative decision on the encoding mode, the best encoding performance can usually be guaranteed.
[0069] Derive Tree (DT) partitioning mode: DT partitioning mode is a new partitioning mode that generates new partitioning shapes and can further gain performance gains. Figure 1A As shown in the figure, it is a schematic diagram of QTBT+EQT+DT. When the derivative mode flag is 0, it means no division. When the derivative mode flag is 1, it means the derivative mode is used. The derivative mode is specifically divided into horizontal derivative mode (2N×hN, 2N×nU, 2N×nD) and vertical derivative mode (hN×2N, nL×2N, nR×2N). For CUs that do not use DT, the PU mode is 2N×2N. The two '2N's here do not necessarily indicate that the width and height are equal. The first '2N' indicates that the width of the PU is equal to that of the CU, and the second '2N' indicates that the height of the PU is equal to that of the CU. For 2N×hN, '2N' indicates that the width of the PU is equal to that of the CU, and 'hN' indicates that the height of the PU is equal to 1 / 4 of the height of the CU.
[0070] Derived patterns can be grown on leaf nodes of a quadtree or binary tree, see Figure 1BAs shown, the derived mode can be obtained by continuously merging and dividing the boundaries of the coding units to obtain different types of PU partitions (2N×hN, 2N×nU, 2N×nD, hN×2N, nL×2N, nR×2N) of the derived mode, which are used for prediction and transform blocks generated by intra-frame prediction.
[0071] The derivative mode can cooperate with QTBT and EQT to produce richer block divisions and obtain more performance.
[0072] See also Figure 1C As shown, for the Intra mode (ie, intra-frame prediction mode), the coding unit predicted using the derivative mode can use 4 non-square blocks for transform quantization, and there is no need to introduce a new transform kernel.
[0073] AVS3's luma intra prediction modes: AVS2 has 33 luma intra prediction modes, including 30 angle modes and 3 special modes (DC, Plane, and Bilinear). To support more sophisticated angle prediction, AVS3 proposes to expand the angle modes to 62, plus 3 special modes, for a total of 65 modes. Figure 1D As shown, it is a schematic diagram of the brightness intra-frame prediction mode. The mode number of the original angle mode remains unchanged, and the mode number of the newly added angle mode increases from 34 to 65.
[0074] AVS3's chroma intra prediction mode: In AVS3, there are 18 chroma intra prediction modes, including 5 traditional chroma intra prediction modes (DM, DC, HOR, VER, BI), 12 special chroma intra prediction modes and Intra_Chroma_PCM mode. Exemplarily, the 12 special chroma intra prediction modes include TSCPM mode (such as TSCPM, TSCPM_L, TSCPM_T, etc.) and PMC mode (such as PMC, PMC_L, PMC_T, EPMC, EPMC_L, EPMC_T, EPMC2, EPMC2_L, EPMC2_T, etc.).
[0075] The TSCPM mode is an inter-component prediction technology that removes inter-component redundancy by exploring the linear relationship between different components. The TSCPM mode can be divided into two steps. First, a temporary prediction block of the same size is generated using the Co-located luma block through the parameters α and β. Then, the temporary prediction block is downsampled to obtain the prediction value of the chrominance component.
[0076] Exemplarily, four available pixel pairs can be obtained according to three cases based on the availability of adjacent block pixels, and the parameters α and β are calculated through the four available pixel pairs. After the parameters α and β are obtained, the chromaticity prediction value is obtained by reconstructing the pixels through the luminance according to the linear relationship between luminance and chromaticity. When selecting four pairs of available pixels, the availability of the upper pixels and the left pixels can be considered, which can be divided into the following three cases: 1. If the pixels directly above and directly to the left of the current block are both "available", two pixel pairs are selected from the upper side and two pixel pairs are selected from the left side. 2. If only the upper side of the current block is available, all four pixel pairs are selected from the upper side, and the width of the selected position is: 0 / 4, 1 / 4, 2 / 4, 3 / 4. 3. If only the left pixel of the current block is available, all four pixel pairs are selected from the left side, and the height of the selected position is: 0 / 4, 1 / 4, 2 / 4, 3 / 4. For case 1, enhanced TSCPM proposes two enhancement modes, namely TSCPM_T and TSCPM_L: that is, 4 pixel pairs only come from the upper side (TSCPM_T), and 4 pixel pairs only come from the left side (TSCPM_L).
[0077] In addition to predicting the chrominance component through the luminance component, AVS3 also supports predicting the Cr component through the Y component and the Cb component, that is, the PMC mode. The prediction process of the PMC mode can be expressed by the following two formulas: IPred = A·Rec Y +B,FPred Cr =IPred′-Rec Cb ×k. In the above formula, RecY is the reconstructed value of the Y component, RecCb is the reconstructed value of the Cb component, IPred is the generated intermediate variable, IPred' is the value after IPred is downsampled, and FPredCr is the final predicted value of the Cr component. The parameters A and B in this formula are set to (α 0 ×k+α 1 , β 0 ×k+β 1 ), (α 0 , β 0 ) and (α 1 , β 1 ) are the parameters α (i.e. alpha) and β (i.e. beta) of Cb and Cr in TSCPM, and k is 0.5, 1, or 2, which is determined by the image-level flag and the CU-level flag. For example, the image header can transmit a flag. If the image header flag is equal to 0, then the k of this image is 1 or 2; if the image header flag is 1, then the k of this image is 1 or 0.5. Each CU using the EPMC mode transmits another flag to determine one of the two k values of this image.
[0078] For example, the intra-frame mode code stream marking scheme of TSCPM and PMC can be shown in Table 2.
[0079] Table 2
[0080]
[0081] Intra Prediction Filter (IPF): In the intra prediction process, the correlation between some reference pixels and the current prediction unit will be ignored. IPF can effectively enhance the spatial correlation, thereby improving the intra prediction accuracy. Figure 1E As shown, the prediction direction is from the upper right to the lower left. The generated current intra-frame prediction block mainly uses the MRB reference pixel point. The prediction effect is poor on the left side of the prediction sample block because the correlation with the URB is not considered.
[0082] To solve this problem, IPF uses the reference pixels in the URB to filter the intra-frame prediction block. There are three types of filters in IPF, namely, horizontal 2-tap filter (see formula (4)), vertical 2-tap filter (see formula (5)) and 3-tap filter that filters in both horizontal and vertical directions (see formula (6)).
[0083] P′(x,y)=f(x)·P(-1,y)+(1-f(x))·P(x,y) Formula (4)
[0084] P'(x, y)=f(y)·P(x,-1)+(1-f(y))·P(x, y) Formula (5)
[0085] P′(x,y)=f(x)·P(-1,y)+f(y)·P(x,-1)+(1-f(x)-f(y))·P(x,y) Formula (6)
[0086] For the luminance component, a filter is selected to filter the current prediction value according to the intra prediction mode. The horizontal 2-tap filter is applied to the prediction mode close to the vertical downward, the vertical 2-tap filter is applied to the prediction mode close to the horizontal left, and the 3-tap filter is applied to the non-angle prediction mode and the lower right diagonal mode. For the chrominance component, when the chrominance intra prediction mode is horizontal or TSCPM_L, the prediction value is filtered by a vertical 2-tap filter; when the chrominance intra prediction mode is vertical or TSCPM_T, the prediction value is filtered by a horizontal 2-tap filter.
[0087] If the size of the current intra-frame prediction block is M*N, for the pixel point with coordinates (i, j) in the block, the filter coefficients f[i] and f[j] corresponding to this pixel point are obtained by looking up the intra-frame prediction boundary filter coefficient table by M, i and N, j respectively, as shown in Table 3.
[0088] Table 3
[0089]
[0090] Improved Intra Prediction (IIP) mode: Compared with the traditional luma intra prediction mode, IIP improves four aspects of luma intra prediction. The following describes the improvements to the luma intra prediction process in the IIP mode of the present application.
[0091] Among them, regarding the improvement of the angle mode. In order to obtain more accurate predicted pixels, an 8-tap interpolation filter can be used to replace the original 4-tap interpolation filter to generate sub-pixel reference pixels. In order to support 8-tap filtering, see Figure 1F As shown, the 4 reference pixels on the left and top are filled. Exemplarily, when MIPF is enabled, 3 types of 8-tap filters are used, and the index value of the filter is implicitly derived based on the size of the current block and the row and column index numbers. The filter index is derived using the following formula: filter_idx = mipf_enable_flag? (j<1?((w*h<64)+1:w*h<64)):3. j represents the index number of the column where the current pixel is located, and w and h represent the width and height of the current block respectively.
[0092] Among them, the improvement of DC mode. For the traditional DC mode: for the luminance block, the reference sample above the current block is recorded as r[i], the reference sample to the left of the current block is recorded as c[j], r[0] is equal to c[0], if i is greater than 2M, then r[i] = r[2M], if j is greater than 2N, then c[j] = c[2N]. If r[i], c[j] (i = 1 ~ M, j = 1 ~ N) are both "available", then: If r[i] (i=1~M) is "available", c[j] (j=1~N) is "unavailable", Otherwise, if c[j] (j=1~N) is "available" and r[i] (i=1~M) is "unavailable", then Otherwise, predMatrix[x][y]=2BitDepth-1 (x=0~M-1, y=0~N-1; BitDepth is the encoding sample accuracy).
[0093] For the improved DC mode: In the traditional DC mode, all pixels in the current block have the same prediction value, while in the improved DC mode, the internal pixels and the pixels near the boundary of the current block have different prediction values. For the internal pixels (not the pixels in the first two rows or columns), the traditional DC value is still used; for the pixels near the boundary (the pixels in the first two rows or columns), Figure 1G and Figure 1H As shown, the weighted average of (DC value and reference pixel value) is used as the final prediction value.
[0094] For example, see Figure 1G As shown in the figure, if the current pixel is located at position a in the first row, the weighted average of reference pixels A0, A1, A2 and DC can be used as the prediction value of position a; if the current pixel is located at position b in the first column, the weighted average of reference pixels B0, B1, B2 and DC can be used as the prediction value of position b; if the current pixel is located at position c in the upper left corner of the current block, the weighted average of reference pixels C0, C1, C2, C3, C4 and DC can be used as the prediction value of position c. Figure 1H As shown, if the current pixel is located at position d in the second row, the weighted average of reference pixels D and DC can be used as the prediction value of position d; if the current pixel is located at position e in the second column, the weighted average of reference pixels E and DC can be used as the prediction value of position e; if the current pixel is located at position f in the upper left corner of the current block, the weighted average of reference pixels F0, F1 and DC can be used as the prediction value of position f. Exemplarily, the weights for positions a, b, c, d, e, and f can be as shown in Table 4, and the last weight can be the weight of the DC value.
[0095] Table 4
[0096] 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}
[0097] Among them, regarding the improvement of 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~M-1,y=0~N-1). For example, 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,2 3}, 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],
[0098] For the improved plane mode: Similar to the improved DC prediction process, the improved plane prediction process also uses the same operation, except that the objects processed are reference pixel values and plane values. The weighted average method is used for the first two rows or columns of the current block to obtain a new prediction value. The specific weights are shown in Table 4, which will not be repeated here.
[0099] Among them, the improvement of Bilinear mode. Traditional Bilinear mode prediction process: see Fig. 1I As shown, the prediction value of the lower right corner C position (the weighted average of the upper right corner reference pixel A and the lower left corner reference pixel B) is generated, and the prediction value of the right boundary AC position (the weighted average of the prediction value of the upper right corner reference pixel A and the lower right corner C position) is generated. Similarly, the prediction value of the lower boundary BC position (the weighted average of the prediction value of the lower left corner reference pixel B and the lower right corner C position) is generated. The prediction values of the remaining other internal pixels are generated by the weighted average of the horizontal linear prediction and the vertical linear prediction. The prediction value generated by the horizontal linear prediction model is the weighted average of the prediction value of the reference pixel L at the corresponding position on the left and the prediction value of the right boundary AC position; the prediction value generated by the vertical linear prediction model is the weighted average of the prediction value of the reference pixel T at the corresponding position on the top and the prediction value of the lower boundary BC position.
[0100] For example, orgPredMatrix[x][y]=((((ia-c[y+1])×(x+1))< <Log(N))+(((ib-r[x+1])×(y+1))<<Log(M))+((r[x+1]+c[y+1])<<(Log(M)+Log(N)))+((ic<<1)-ia-ib)×x×y+(1<<(Log(M)+Log(N))))> >(Log(M)+Log(N)+1), (x=0~M-1, y=0~N-1). predMatrix[x][y]=Clip1(orgPredMatrix[x][y]), (x=0~M-1, y=0~N-1). ia=r[M], ib=c[N], if M is equal to N, then 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}.
[0101] Improved Bilinear prediction process: The number of reference pixels used is improved, and the weighted average of 5 reference pixels is used to replace the original 1 reference pixel value. The weights of the 5 reference pixels are: {82, 252, 356, 252, 82}, see Figure 1J shown.
[0102] Prediction value correction process: Based on the improved angular, DC, Plane, and Bilinear modes, the predicted pixels are further corrected using the current block reference pixels, see Figure 1K and Figure 1L As shown, for the pixel X in the first row or column, the reference pixel used is marked as "D1", otherwise the reference pixel used is marked as "D2", D1 and D2 contain reference pixels in four different positions, and if the current pixel is located in the first two rows or columns, the weighted average weight used is {10,216}, otherwise the weight used is {13,204}. In summary, the IIP mode includes the above five improvements. For the IIP mode, a flag bit iip_flag is used to identify whether the current block uses the improved intra-frame prediction mode to generate an intra-frame prediction value.
[0103] The video coding framework applicable to this application: see Figure 2As shown, the video encoding framework can be used to implement the encoding end processing flow of the embodiment of the present application, and the schematic diagram of the video decoding framework is similar to Figure 2 Similarly, no further description will be given here, and the decoding end processing flow of the embodiment of the present application can be implemented using a video decoding framework. In the video encoding framework and the video decoding framework, it may include but is not limited to: intra-frame prediction, motion estimation / motion compensation, reference image buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy encoder and other modules. At the encoding end, through the cooperation between these modules, the processing flow of the encoding end can be implemented, and at the decoding end, through the cooperation between these modules, the processing flow of the decoding end can be implemented.
[0104] For example, prediction is divided into intra-frame prediction and inter-frame prediction. Intra-frame prediction takes into account the strong spatial correlation between adjacent blocks in the image, and can use the surrounding reconstructed pixels as reference pixels to predict the current uncoded block. It only needs to perform subsequent coding processing on the residual signal (original signal-prediction signal) instead of encoding the original signal, effectively removing the redundancy in the spatial domain and greatly improving the compression efficiency of the video signal. Inter-frame prediction refers to the use of the correlation in the time domain of the video signal, using the adjacent coded image pixels to predict the pixels of the current image, so as to achieve the purpose of removing the temporal redundancy of the video.
[0105] For example, in the video encoding process, transformation refers to converting an image described in the form of pixels in the spatial domain to an image in the transform domain, and expressing it in the form of transform coefficients. Since most images contain more flat areas and slowly changing areas, an appropriate transformation process can convert the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain, thereby removing the frequency domain correlation between signals, and in conjunction with the quantization process, effectively compressing the bitstream.
[0106] Exemplarily, entropy coding refers to a method of lossless coding based on the principle of information entropy. It is the last processing module of video compression, which converts a series of element symbols used to represent the video sequence into a binary code stream for transmission or storage. The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, etc. The output data of the entropy coding module is the final code stream after the original video is compressed. Entropy coding can effectively remove the statistical redundancy of these video element symbols and is one of the important tools to ensure the efficiency of video coding compression.
[0107] Secondary transform: Different secondary transform matrices are used for 4*4 blocks and non-4*4 blocks. For the encoding end, the transform coefficients are obtained after the (DCT2, DCT2) transform. The transform coefficients of the 4*4 block in the upper left corner are multiplied by the secondary transform matrix to obtain new transform coefficients, and then quantized and entropy encoded. For the decoding end, after the transform coefficients obtained from the bitstream entropy decoding are inverse quantized, the 4*4 area in the upper left corner is first inversely transformed to obtain new transform coefficients, and then the entire transform block is inversely transformed using (DCT2, DCT2) to obtain the residual coefficients. The specific decoding end inverse transform process of the secondary transform is as follows:
[0108] Case 1: If the current transform block is a luma intra prediction residual block, the width or height value is greater than 4, and the value of the secondary transform enable flag (SecondaryTransformEnableFlag) is equal to 1 (the value of the secondary transform enable flag is equal to 1, indicating that the sequence level or frame level allows the secondary transform to be enabled), the following operations are performed on the coefficient matrix:
[0109] First, the coefficient matrix C of the upper left corner 4*4 is obtained from the transformation coefficient matrix: c ij =coeff ij , i = 0 ~ 3, j = 0 ~ 3, in the above formula, c ij is the element of matrix C, coeff ij is an element of the transform coefficient matrix. If the value of the intra prediction mode (IntraLumaPredMode) is 0 to 2, or 13 to 32, or 44 to 65, and the reference sample to the left outside the current block is "available", then: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7), i=0~3, j=0~3. p ij It is an element of the 4*4 matrix P. The calculation method of matrix P is as follows: P = C × S 4 , S 4 It is a 4*4 inverse transformation matrix, Clip3(-32768, 32767, (p ij +2 6 )>>7) means that if c ij If the value of is between -32768 and 32767, then c ij The value of (p ij +2 6 )>>7, if c ij If the value of is less than -32768, then c ij The value of c is -32768. ij If the value of is greater than 32767, then c ijThe value of is 32767. If the value of the intra prediction mode (IntraLumaPredMode) is 0 to 23, or 34 to 57, and the reference sample above the current block is "available", then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7), i=0~3, j=0~3. q ij are the elements of the 4×4 matrix Q, which is calculated as follows: Q = S 4 T ×C,S 4 T YesS 4 The transposed matrix, S 4 It is a 4*4 inverse transformation matrix.
[0110] Then, the values of the elements of the transform coefficient matrix are modified according to the matrix C: ij =c ij , i=0~3, j=0~3.
[0111] Then, the matrix coeff is initially inverse transformed.
[0112] Case 2: If the current transform block is a luma intra prediction residual block, the width and height values are both equal to 4, and the value of the secondary transform enable flag (SecondaryTransformEnableFlag) is equal to 1 (the value of the secondary transform enable flag is equal to 1, indicating that the sequence level or frame level allows the secondary transform to be enabled), the following operations are performed on the coefficient matrix:
[0113] First, the transformation coefficient matrix is vertically inversely transformed as follows to obtain the matrix K: ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1, j = 0 ~ M 2 -1, v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows: V = D 4 T ×CoeffMatrix,D 4 T is the inverse transformation matrix D 4 The transposed matrix of , CoeffMatrix is the transformation coefficient.
[0114] Then, the matrix K is horizontally inversely transformed as follows to obtain the matrix H: ij= Clip3(-MaxValue - 1, MaxValue, (w ij + 2 shift1-1 ) >> shift1), i = 0 to M 1 - 1, j = 0 to M 2 - 1, w i,j is an element of matrix W, h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, shift1 is equal to 22 - BitDepth, and matrix W is: W = K × D 4 , D 4 is the inverse transform matrix.
[0115] Exemplarily, for a 4 * 4 block, after performing the inverse transform of the second - order transform, there is no need to perform the initial inverse transform again.
[0116] Referring to the above - mentioned embodiments, the second - order transform technology means: First, perform an initial transform to obtain the transform coefficients after the initial transform, then perform a second - order transform on the transform coefficients after the initial transform to obtain new transform coefficients, and then perform quantization and entropy coding on the new transform coefficients and other processes. In the related art, the second - order transform is performed on the luminance component of the current block. However, the second - order transform is only used for the luminance component and not for the chrominance component. For the chrominance component of the current block, by default, only the initial transform of (DCT2, DCT2) is performed. For the chrominance component, there is also a problem that the energy may not be concentrated enough after the initial transform. In view of the above findings, in the embodiments of the present application, the second - order transform can be performed on the chrominance component, thereby improving the coding performance.
[0117] In one possible implementation, for the encoding end, the rate - distortion cost value (RDO) is used to determine whether to perform the second - order transform on the chrominance component, and the second - order transform flag bit is explicitly encoded to indicate whether the chrominance component of the current block uses the second - order transform. Moreover, the chrominance U component and the chrominance V component share the same second - order transform flag bit, that is, the second - order transform flag bit indicates to perform the second - order transform on both the chrominance U component and the chrominance V component simultaneously, or not to perform the second - order transform on both the chrominance U component and the chrominance V component.
[0118] In another possible implementation, for the encoding end, the rate - distortion cost value (RDO) is used to determine whether to perform the second - order transform on the chrominance component, and the second - order transform flag bit is explicitly encoded to indicate whether the chrominance component of the current block uses the second - order transform. Moreover, the chrominance U component and the chrominance V component use separate second - order transform flag bits respectively. That is, one second - order transform flag bit indicates to perform the second - order transform on the chrominance U component, or not to perform the second - order transform on the chrominance U component. Another second - order transform flag bit indicates to perform the second - order transform on the chrominance V component, or not to perform the second - order transform on the chrominance V component.
[0119] In another possible implementation, for the encoding end, a rate-distortion cost (RDO) is used to determine whether the luminance component and the chrominance component are subjected to secondary transformation, and a secondary transformation flag is explicitly encoded to indicate whether the luminance component and the chrominance component of the current block use secondary transformation, and the luminance component and the chrominance component (chrominance U component and chrominance V component) share the same secondary transformation flag, that is, the secondary transformation flag indicates that the luminance component, the chrominance U component and the chrominance V component are subjected to secondary transformation at the same time, or that the luminance component, the chrominance U component and the chrominance V component are not subjected to secondary transformation.
[0120] The following is a detailed description of the encoding method and decoding method of the embodiments of the present application in combination with several specific embodiments.
[0121] Example 1: In one possible implementation, see Figure 3A FIG. 1 is a flow chart of a decoding method proposed in an embodiment of the present application. The decoding method can be applied to a decoding end. The decoding method can include the following steps:
[0122] Step 311, obtain the encoded bit stream of the current block, and parse the final transform coefficient matrix corresponding to the chrominance component of the current block from the encoded bit stream, and parse the transform coefficient flag from the encoded bit stream, where the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients.
[0123] For example, if the transform coefficient flag is the first value, it can be used to indicate that the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients. Alternatively, if the transform coefficient flag is the second value, it can be used to indicate that the final transform coefficient matrix corresponding to the chrominance component of the current block does not contain non-zero transform coefficients.
[0124] Exemplarily, the encoder may encode the final transform coefficient matrix in the encoded bit stream of the current block. For the specific encoding process, please refer to the subsequent embodiments. The final transform coefficient matrix may contain non-zero transform coefficients or not contain non-zero transform coefficients. When the encoder sends the encoded bit stream to the decoder, the transform coefficient flag is encoded in the encoded bit stream of the current block. The transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients. In summary, after the decoder obtains the encoded bit stream of the current block, it can parse the transform coefficient flag from the encoded bit stream, and the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients.
[0125] The chroma components of the current block are a chroma U component and a chroma V component, and the transform coefficient flag includes a chroma U component transform coefficient flag and a chroma V component transform coefficient flag. When the value of the chroma U component transform coefficient flag is a first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients; when the value of the chroma U component transform coefficient flag is a second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block does not contain non-zero transform coefficients. When the value of the chroma V component transform coefficient flag is a first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients; when the value of the chroma V component transform coefficient flag is a second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block does not contain non-zero transform coefficients. For example, the above-mentioned first value can be 1, and the second value can be 0. Based on this, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, including: the value of the chrominance U component transform coefficient flag is the first value, and / or the value of the chrominance V component transform coefficient flag is the first value.
[0126] In summary, the decoding end can parse the chroma U component transform coefficient flag and the chroma V component transform coefficient flag from the coded bit stream of the current block. If the value of the chroma U component transform coefficient flag is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients. If the value of the chroma U component transform coefficient flag is the second value, the decoding end can determine that the final transform coefficient matrix corresponding to the chroma U component does not contain non-zero transform coefficients. If the value of the chroma V component transform coefficient flag is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients. If the value of the chroma V component transform coefficient flag is the second value, the decoding end can determine that the final transform coefficient matrix corresponding to the chroma V component does not contain non-zero transform coefficients.
[0127] Step 312: If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, and the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance 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 is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
[0128] When the value of the secondary transformation flag is a first value, it is used to indicate that the chrominance component is subjected to a secondary inverse transformation, and when the value of the secondary transformation flag is a second value, it is used to indicate that the chrominance component is not subjected to a secondary inverse transformation. For example, the first value is 1 and the second value is 0.
[0129] Step 313: Determine whether to perform a secondary inverse transform on the chrominance component according to the secondary transform flag.
[0130] Exemplarily, the decoding end may determine whether the current block satisfies the first preset condition. If the current block does not satisfy the first preset condition, the decoding end determines not to perform a secondary inverse transformation on the chrominance component of the current block. If the current block satisfies the first preset condition, the decoding end may also parse a secondary transformation flag (referred to as a secondary transformation flag) of the block-level chrominance component from the coded bit stream of the current block. If the secondary transformation flag is used to indicate that a secondary inverse transformation is performed on the chrominance component, the decoding end determines that a secondary inverse transformation is performed on the chrominance component according to the secondary transformation flag. If the secondary transformation flag is used to indicate that a secondary inverse transformation is not performed on the chrominance component, the decoding end determines not to perform a secondary inverse transformation on the chrominance component according to the secondary transformation flag.
[0131] In a possible implementation, 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 is used to indicate that the 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 an intra-frame prediction mode, and the transform coefficient flag is a first value, the decoder can determine that the current block meets the first preset condition. If it is determined that the prediction mode of the current block is not an intra-frame prediction mode, and / or the transform coefficient flag is a second value, the decoder can determine that the current block does not meet the first preset condition.
[0132] Referring to the above embodiment, the transform coefficient flag includes a chroma U component transform coefficient flag and a chroma V component transform coefficient flag, based on which, if the prediction mode of the current block is an intra-frame prediction mode, and the chroma U component transform coefficient flag is a first value and / or the chroma V component transform coefficient flag is a first value, the decoding end determines that the current block meets the first preset condition. If the prediction mode of the current block is not an intra-frame prediction mode, and / or the chroma U component transform coefficient flag and the chroma V component transform coefficient flag are both second values, the decoding end determines that the current block does not meet the first preset condition.
[0133] In a possible implementation, in addition to the prediction mode of the current block being an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the first preset condition may also include but is not limited to at least one of the following: the current block does not use the intra-frame prediction filtering mode; the current block does not use the improved intra-frame prediction mode; the current block uses the transform kernel (DCT2, DCT2) for initial inverse transform; the chrominance intra-frame prediction mode of the current block meets the preset mode condition; the size of the chrominance component of the current block meets the preset size condition; the control information allows the current block to use a secondary inverse transform; and other positions in the final transform coefficient matrix except the upper left corner coordinate (0, 0) contain non-zero transform coefficients.
[0134] For example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the current block does not use the intra-frame prediction filter mode (IPF mode).
[0135] For another example, the first preset condition may include: the prediction mode of the current block is the intra prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the current block does not use the improved intra prediction mode (IIP mode).
[0136] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the current block uses the transform core (DCT2, DCT2) for initial inverse transform.
[0137] For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the chrominance intra-frame prediction mode of the current block meets the preset mode condition.
[0138] For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the size of the chrominance component of the current block meets the preset size condition.
[0139] For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the control information allows the current block to use a secondary inverse transform.
[0140] For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0141] For example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filtering mode, and the current block does not use the improved intra-frame prediction mode.
[0142] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, and the current block uses the transform core (DCT2, DCT2) for initial inverse transform.
[0143] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, and the chrominance intra-frame prediction mode of the current block meets the preset mode condition.
[0144] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, and the size of the chrominance component of the current block meets the preset size condition.
[0145] For another example, the first preset condition may include: the prediction mode of the current block is an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use an intra-frame prediction filter mode, the current block does not use an improved intra-frame prediction mode, and the control information allows the current block to use a secondary inverse transform.
[0146] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0147] For example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform core (DCT2, DCT2) for initial inverse transform, and the chrominance intra-frame prediction mode of the current block meets the preset mode conditions.
[0148] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform core (DCT2, DCT2) for initial inverse transform, and the size of the chrominance component of the current block meets the preset size condition.
[0149] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform core (DCT2, DCT2) for initial inverse transform, and the control information allows the current block to use secondary inverse transform.
[0150] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform kernel (DCT2, DCT2) for initial inverse transform, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0151] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform kernel (DCT2, DCT2) for initial inverse transform, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, the size of the chrominance component of the current block meets the preset size condition, the control information allows the current block to use a secondary inverse transform, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0152] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform kernel (DCT2, DCT2) for initial inverse transform, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, the size of the chrominance component of the current block meets the preset size condition, the control information allows the current block to use a secondary inverse transform, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0153] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform kernel (DCT2, DCT2) for initial inverse transform, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, the control information allows the current block to use a secondary inverse transform, and the final transform coefficient matrix contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0).
[0154] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform core (DCT2, DCT2) for initial inverse transform, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, the size of the chrominance component of the current block meets the preset size condition, and the control information allows the current block to use a secondary inverse transform.
[0155] For another example, the first preset condition may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the current block does not use the intra-frame prediction filter mode, the current block does not use the improved intra-frame prediction mode, the current block uses the transform core (DCT2, DCT2) for initial inverse transform, the chrominance intra-frame prediction mode of the current block meets the preset mode condition, and the control information allows the current block to use a secondary inverse transform.
[0156] Of course, the above are just a few examples and are not limited thereto. The first preset condition may include any combination of the above conditions.
[0157] In the above embodiment, the chroma intra-frame prediction mode of the current block satisfies the preset mode conditions, which may include but are not limited to at least one of the following: the chroma intra-frame prediction mode of the current block is not the TSCPM mode; the chroma intra-frame prediction mode of the current block is not the PMC mode; the mode number of the chroma intra-frame prediction mode of the current block is mode number 0 to mode number 4; the chroma intra-frame prediction mode of the current block is not the Intra_Chroma_PCM mode; the chroma intra-frame prediction mode of the current block is not the DM mode.
[0158] For example, if the chroma intra-frame prediction mode of the current block is not the TSCPM mode, or the chroma intra-frame prediction mode of the current block is not the PMC mode, or the mode number of the chroma intra-frame prediction mode of the current block is mode number 0 to mode number 4, it can be determined that the chroma intra-frame prediction mode of the current block meets the preset mode condition.
[0159] For another example, if the chroma intra prediction mode of the current block is not the Intra_Chroma_PCM mode (or the IPD_IPCM mode), or the chroma intra prediction mode of the current block is not the DM mode, it can be determined that the chroma intra prediction mode of the current block meets the preset mode condition.
[0160] For another example, if the chroma intra prediction mode of the current block is not the Intra_Chroma_PCM mode, and the chroma intra prediction mode of the current block is not the TSCPM mode, it can be determined that the chroma intra prediction mode of the current block meets the preset mode condition.
[0161] In the above embodiment, the size of the chroma component of the current block satisfies the preset size condition, which may include but is not limited to at least one of the following: the width of the chroma component is less than or equal to n1, and the height of the chroma component is less than or equal to n2. The width of the chroma component is less than or equal to n1, or the height of the chroma component is less than or equal to n2. The width of the chroma component is greater than or equal to n3, and the height of the chroma component is greater than or equal to n4. The width of the chroma component is greater than or equal to n3, or the height of the chroma component is greater than or equal to n4. The product of the width and height of the chroma component is greater than or equal to n5. The product of the width and height of the chroma component is less than or equal to n6.
[0162] For example, any combination of the above-mentioned preset size conditions can be: the width of the chroma component is greater than or equal to n3 and less than or equal to n1, and the height of the chroma component is greater than or equal to n4 and less than or equal to n2. For another example, the width of the chroma component is greater than or equal to n3 and less than or equal to n1, or the height of the chroma component is greater than or equal to n4 and less than or equal to n2. For another example, the width of the chroma component is less than or equal to n1, and the height of the chroma component is less than or equal to n2, and the product of the width and height of the chroma component is greater than or equal to n5. For another example, the width of the chroma component is less than or equal to n1, and the height of the chroma component is less than or equal to n2, and the product of the width and height of the chroma component is less than or equal to n6.
[0163] Of course, the above are only examples of preset size conditions, and the preset size conditions may be any combination of the above conditions.
[0164] Exemplarily, n1 and n2 can be configured based on experience, and n1 and n2 can be the same or different, for example, n1=n2=32. Of course, 32 is just an example, and other values can also be used, such as 64. n3 and n4 can be configured based on experience, and n3 and n4 can be the same or different, for example, n3=n4=4. Of course, 4 is just an example, and other values can also be used, such as 8. n5 and n6 can be configured based on experience, and n5 and n6 can be the same or different, for example, n5=n6=128. Of course, 128 is just an example, and other values can also be used, such as 256.
[0165] In the above embodiment, the control information allows the current block to use the secondary inverse transform, which may include but is not limited to the following: sequence level control information allows the current block to use the secondary inverse transform. Image parameter set level control information allows the current block to use the secondary inverse transform. Image header level control information allows the current block to use the secondary inverse transform. Slice header level control information allows the current block to use the secondary inverse transform. Of course, the above are just a few examples of control information, and there is no limitation on the level of this control information.
[0166] The sequence parameter set (SPS) has a flag bit that determines whether certain tools (methods) are allowed to be switched in the entire video sequence (i.e., multiple frames of video images). 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 process of the sequence. Based on this, the current block can be allowed to use the secondary inverse transform through the sequence level control information, or the current block can be not allowed to use the secondary inverse transform through the sequence level control information. For example, secondary_transform_enable_flag = 1, indicating that the sequence level control information allows the current block to use the secondary inverse transform, and secondary_transform_enable_flag = 0, indicating that the sequence level control information does not allow the current block to use the secondary inverse transform.
[0167] The picture parameter set (PPS) contains a flag bit that determines whether certain tools (methods) are allowed to be switched in a certain image. If the flag bit is 1, the corresponding tool (method) is allowed to be enabled in the image; otherwise, the tool (method) cannot be enabled during the encoding process of the image. Based on this, the current block can be allowed to use the secondary inverse transform through the picture parameter set level control information, or the current block can be not allowed to use the secondary inverse transform through the picture parameter set level control information.
[0168] Picture header: Common information for a certain frame of image. Different from the image parameter set (which can be used by different images), the picture header stores common information only for the current image. For example, when the current image contains multiple slices, the multiple slices can use the information in the picture header. The picture header contains 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 process of the current image. Based on this, the current block can be allowed to use the secondary inverse transform through the picture header level control information, or the current block can be not allowed to use the secondary inverse transform through the picture header level control information.
[0169] Slice header: A frame of image contains at least one slice. In the header information of each slice, there is a flag bit that determines whether certain tools (methods) are allowed to be switched in the slice. If the flag bit is 1, the corresponding tool (method) is allowed to be enabled in the slice; otherwise, the tool (method) cannot be enabled in the encoding process of the slice. Based on this, the current block can be allowed to use the secondary inverse transform through the slice header level control information, or the current block can be not allowed to use the secondary inverse transform through the slice header level control information.
[0170] In the above embodiment, the chrominance components are the chrominance U component and the chrominance V component, and the non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0) in the final transform coefficient matrix include one of the following conditions:
[0171] Condition 1: The final transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), or the final transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0).
[0172] Condition 2: The final transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), and the final transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0).
[0173] In conditions 1 and 2, since the decoder can parse the final transform coefficient matrix corresponding to the chroma U component from the coded bit stream, it can be determined whether other positions in the final transform coefficient matrix corresponding to the chroma U component, except the position of the upper left corner coordinate (0, 0), contain non-zero transform coefficients. Since the decoder can parse the final transform coefficient matrix corresponding to the chroma V component from the coded bit stream, it can be determined whether other positions in the final transform coefficient matrix corresponding to the chroma V component, except the position of the upper left corner coordinate (0, 0), contain non-zero transform coefficients.
[0174] Condition 3: the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance U component are not both 0, or the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance V component are not both 0.
[0175] Condition 4: the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance U component are not both 0, and the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance V component are not both 0.
[0176] In Condition 3 and Condition 4, the horizontal coordinate (sr_x) of the scanning area corresponding to the chrominance U component represents the maximum horizontal coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chrominance U component, and the vertical coordinate (sr_y) of the scanning area corresponding to the chrominance U component represents the maximum vertical coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chrominance U component.
[0177] In Condition 3 and Condition 4, the horizontal coordinate of the scanning area corresponding to the chroma V component represents the maximum horizontal coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma V component, and the vertical coordinate of the scanning area corresponding to the chroma V component represents the maximum vertical coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma V component.
[0178] Exemplarily, the encoding end may encode the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chrominance U component in the encoded bit stream, and the decoding end may parse the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chrominance U component from the encoded bit stream. If the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chrominance U component are both 0, it means that only the upper left corner coordinate (0, 0) position in the final transformation coefficient matrix corresponding to the chrominance U component contains a non-zero transformation coefficient, and other positions except the upper left corner coordinate (0, 0) position do not contain non-zero transformation coefficients. If the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chrominance U component are not both 0, it means that in the final transformation coefficient matrix corresponding to the chrominance U component, other positions except the upper left corner coordinate (0, 0) position contain non-zero transformation coefficients, and a secondary inverse transformation can be performed.
[0179] Exemplarily, the encoding end may encode the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chroma V component in the encoded bit stream, and the decoding end may parse the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chroma V component from the encoded bit stream. If the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chroma V component are both 0, it means that in the final transformation coefficient matrix corresponding to the chroma V component, only the upper left corner coordinate (0, 0) position contains a non-zero transformation coefficient, and other positions except the upper left corner coordinate (0, 0) position do not contain non-zero transformation coefficients. If the scanning area horizontal coordinate and the scanning area vertical coordinate corresponding to the chroma V component are not both 0, it means that in the final transformation coefficient matrix corresponding to the chroma V component, other positions except the upper left corner coordinate (0, 0) position contain non-zero transformation coefficients, and a secondary inverse transformation can be performed.
[0180] In a possible implementation manner, the chroma components of the current block are a chroma U component and a chroma V component, and the secondary transformation flag may be a UV component shared secondary transformation flag. When the value of the UV component shared secondary transformation flag is a first value, it is used to indicate that the chroma U component and the chroma V component are simultaneously subjected to secondary inverse transformation, or when the value of the UV component shared secondary transformation flag is a second value, it is used to indicate that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation. Based on this, in step 313, if the value of the UV component shared secondary transformation flag obtained by parsing is a first value, it is determined that the chroma U component and the chroma V component are simultaneously subjected to secondary inverse transformation, and if the value of the UV component shared secondary transformation flag obtained by parsing is a second value, it is determined that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation.
[0181] In another possible implementation, the chrominance components of the current block are a chrominance U component and a chrominance V component, and the secondary transformation flag may include a U component secondary transformation flag and a V component secondary transformation flag; when the value of the U component secondary transformation flag is a first value, it is used to indicate that the chrominance U component is subjected to a secondary inverse transformation, or, when the value of the U component secondary transformation flag is a second value, it is used to indicate that the chrominance U component is not subjected to a secondary inverse transformation; when the value of the V component secondary transformation flag is a first value, it is used to indicate that the chrominance V component is subjected to a secondary inverse transformation, or, when the value of the V component secondary transformation flag is a second value, it is used to indicate that the chrominance V component is not subjected to a secondary inverse transformation. Based on this, in step 313, if the parsed U component secondary transformation flag is a first value, it is determined that the chrominance U component is subjected to a secondary inverse transformation; if the parsed U component secondary transformation flag is a second value, it is determined that the chrominance U component is not subjected to a secondary inverse transformation. If the parsed V component secondary transformation flag is the first value, it is determined that the chrominance V component is subjected to secondary inverse transformation; if the parsed V component secondary transformation flag is the second value, it is determined that the chrominance V component is not subjected to secondary inverse transformation.
[0182] In a possible implementation, in step 312, the decoding end parses the secondary transform flag from the encoded bit stream, which may include but is not limited to: the decoding end uses a context-based binary arithmetic decoding method to parse the secondary transform flag from the encoded bit stream; or, the decoding end uses a bypass decoding method to parse the secondary transform flag from the encoded bit stream.
[0183] Exemplarily, the decoding end adopts a context-based binary arithmetic decoding method to parse the secondary transform flag from the coded bit stream, which may include but is not limited to: the decoding end selects a target context model from at least two pre-configured context models based on the chroma intra-frame prediction mode of the current block, and parses the secondary transform flag from the coded bit stream based on the target context model. Alternatively, the decoding end selects a target context model from at least two pre-configured context models based on the size of the chroma component, and parses the secondary transform flag from the coded bit stream based on the target context model.
[0184] It can be seen from the above technical scheme that in the embodiment of the present application, after the chrominance components of the current block are initially transformed, it can be determined whether to perform a secondary transformation on the chrominance components of the current block. If so, the chrominance components of the current block can be secondary transformed, that is, the secondary transformation technology can also be applied to the chrominance components of the current block. When the chrominance components have a problem of insufficient energy concentration after the initial transformation, the chrominance components can also be secondary transformed, thereby improving the coding performance and coding efficiency.
[0185] Example 2: In one possible implementation, see Figure 3B FIG. 1 is a flow chart of a decoding method proposed in an embodiment of the present application. The decoding method can be applied to a decoding end. The decoding method can include the following steps:
[0186] Step 321, obtain the encoded bit stream of the current block, and parse the final transform coefficient matrix corresponding to the chrominance component of the current block from the encoded bit stream, and parse the transform coefficient flag from the encoded bit stream, where the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients.
[0187] Step 322: If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, the secondary transform flag being used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance 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 is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient.
[0188] Step 323: Determine whether to perform a secondary inverse transform on the chrominance component according to the secondary transform flag.
[0189] Exemplarily, the implementation process of step 321 to step 323 can refer to embodiment 1, and will not be repeated here.
[0190] Step 324: Dequantize the final transform coefficient matrix corresponding to the chrominance component to obtain the target transform coefficient matrix corresponding to the chrominance component. The implementation method of this dequantization will not be described in detail in this embodiment.
[0191] Step 325: If a secondary inverse transform is performed on the chrominance components of the current block, a secondary inverse transform is performed on the target transform coefficient matrix to obtain an initial transform coefficient matrix corresponding to the chrominance components; if a secondary inverse transform is not performed on the chrominance components of the current block, the target transform coefficient matrix is determined as the initial transform coefficient matrix corresponding to the chrominance components.
[0192] Exemplarily, after determining whether to perform a secondary inverse transform on the chroma component based on the secondary transform flag, if so, perform a secondary inverse transform on the target transform coefficient matrix to obtain an initial transform coefficient matrix; if not, directly determine the target transform coefficient matrix as the initial transform coefficient matrix, and no longer perform a secondary inverse transform on the target transform coefficient matrix.
[0193] Exemplarily, 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 this basis:
[0194] If the secondary transform flag is a UV component shared secondary transform flag, and the UV component shared secondary transform flag is used to indicate that the chroma U component and the chroma V component are simultaneously subjected to secondary inverse transform, then the target transform coefficient matrix corresponding to the chroma U component is subjected to secondary inverse transform to obtain the initial transform coefficient matrix corresponding to the chroma U component. Also, the target transform coefficient matrix corresponding to the chroma V component is subjected to secondary inverse transform to obtain the initial transform coefficient matrix corresponding to the chroma V component. If the UV component shared secondary transform flag is used to indicate that the chroma U component and the chroma V component are not subjected to secondary inverse transform, then the target transform coefficient matrix corresponding to the chroma U component is determined as the initial transform coefficient matrix corresponding to the chroma U component, and the target transform coefficient matrix corresponding to the chroma V component is determined as the initial transform coefficient matrix corresponding to the chroma V component.
[0195] If the secondary transform flag is the U component secondary transform flag and the V component secondary transform flag, if the U component secondary transform flag is used to indicate that the chroma U component is to be secondary inversely transformed, the target transform coefficient matrix corresponding to the chroma U component is secondary inversely transformed to obtain the initial transform coefficient matrix corresponding to the chroma U component. If the U component secondary transform flag is used to indicate that the chroma U component is not to be secondary inversely transformed, the target transform coefficient matrix corresponding to the chroma U component is determined as the initial transform coefficient matrix corresponding to the chroma U component. If the V component secondary transform flag is used to indicate that the chroma V component is to be secondary inversely transformed, the target transform coefficient matrix corresponding to the chroma V component is secondary inversely transformed to obtain the initial transform coefficient matrix corresponding to the chroma V component. If the V component secondary transform flag is used to indicate that the chroma V component is not to be secondary inversely transformed, the target transform coefficient matrix corresponding to the chroma V component is determined as the initial transform coefficient matrix corresponding to the chroma V component.
[0196] In a possible implementation, in step 325, the target transformation coefficient matrix is subjected to a secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chroma component (e.g., the target transformation coefficient matrix corresponding to the chroma U component is subjected to a secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chroma U component, or, the target transformation coefficient matrix corresponding to the chroma V component is subjected to a secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chroma V component), which may include but is not limited to:
[0197] Case 1: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, then the coefficient matrix is determined based on the transform coefficients of the designated area located in the upper left corner of the target transform coefficient matrix; the coefficient matrix is horizontally inversely transformed to obtain a horizontal inverse transform matrix; the horizontal inverse transform matrix is vertically inversely transformed to obtain a vertical inverse transform matrix; based on the vertical inverse transform matrix, the transform coefficients of the designated area located in the upper left corner of the target transform coefficient matrix are updated to obtain the initial transform coefficient matrix. Exemplarily, the preset threshold can be configured according to experience, such as 4, etc., and the designated area in the upper left corner can be configured according to experience, such as a 4*4 sub-area located in the upper left corner of the target transform coefficient matrix.
[0198] Case 2: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, the coefficient matrix is determined based on the transform coefficients of the designated area located in the upper left corner of the target transform coefficient matrix; if the mode number of the chroma intra-frame prediction mode of the current block is in the first mode number interval, the coefficient matrix is horizontally inverse transformed to obtain a horizontal inverse transform matrix; if the mode number of the chroma intra-frame prediction mode of the current block is in the second mode number interval, the coefficient matrix is vertically inverse transformed to obtain a vertical inverse transform matrix. If only the coefficient matrix is horizontally inverse transformed, the transform coefficients of the designated area located in the upper left corner of the target transform coefficient matrix are updated based on the horizontal inverse transform matrix to obtain an initial transform coefficient matrix. If only the coefficient matrix is vertically inverse transformed, the transform coefficients of the designated area located in the upper left corner of the target transform coefficient matrix are updated based on the vertical inverse transform matrix to obtain an initial transform coefficient matrix.
[0199] Exemplarily, the first mode number interval and the second mode number interval can be configured based on experience, and there is no restriction on the first mode number interval and the second mode number interval. There may be no repeated mode numbers in the first mode number interval and the second mode number interval, and there may be repeated mode numbers in the first mode number interval and the second mode number interval. For example, the first mode number interval includes mode numbers 0 to 2, mode numbers 4 to 6, mode numbers 8 to 9, mode numbers 11 to 12, and mode numbers 14 to 15, and the second mode number interval includes mode numbers 0 to 1, mode numbers 3 to 5, mode numbers 7 to 8, mode numbers 10 to 11, mode numbers 13 to 14, and mode number 16. If the mode number of the chroma intra prediction mode of the current block is 0 to 2 or 4 to 6 or 8 to 9 or 11 to 12 or 14 to 15, the mode number of the chroma intra prediction mode of the current block is located in the first mode number interval. If the mode number of the chroma intra prediction mode of the current block is 0-1 or 3-5 or 7-8 or 10-11 or 13-14 or 16, the mode number of the chroma intra prediction mode of the current block is in the second mode number interval.
[0200] Exemplarily, if the mode number of the chroma intra prediction mode of the current block is located in both the first mode number interval and the second mode number interval, the coefficient matrix can be horizontally inverse transformed to obtain a horizontal inverse transformation matrix, and then the horizontal inverse transformation matrix is vertically inverse transformed to obtain a vertical inverse transformation matrix. On this basis, the coefficient matrix is first horizontally inverse transformed and then vertically inverse transformed, so the transformation coefficients of the designated area located in the upper left corner of the target transformation coefficient matrix can be updated based on the vertical inverse transformation matrix after the vertical inverse transformation to obtain an initial transformation coefficient matrix.
[0201] Case three: if the width of the chrominance component is equal to a preset threshold, and the height of the chrominance component is equal to a preset threshold, the target transformation coefficient matrix is vertically inverse transformed to obtain a vertical inverse transformation matrix; the vertical inverse transformation matrix is horizontally inverse transformed to obtain a horizontal inverse transformation matrix; and the initial transformation coefficient matrix is determined based on the horizontal inverse transformation matrix.
[0202] To summarize, based on case one, case two and case three, if the preset threshold is 4, and the designated area is the 4*4 sub-area in the upper left corner, then in the process of performing a secondary inverse transformation on the chrominance component, if the width or height of the target transformation coefficient matrix is greater than 4, the 4*4 coefficient matrix in the upper left corner is subjected to a secondary inverse transformation; if the width and height of the target transformation coefficient matrix are both 4, the target transformation coefficient matrix is subjected to a secondary inverse transformation, and this secondary inverse transformation process will not be described in detail.
[0203] In summary, in step 325, the initial transformation coefficient matrix corresponding to the chrominance components can be obtained, that is, the initial transformation coefficient matrix corresponding to the chrominance U component and the initial transformation coefficient matrix corresponding to the chrominance V component.
[0204] Step 326: Perform an initial inverse transformation on the initial transformation coefficient matrix corresponding to the chroma component to obtain a residual coefficient matrix corresponding to the chroma component. Exemplarily, the decoding end may perform an initial inverse transformation on the initial transformation 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 an 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.
[0205] Exemplarily, during the initial inverse transformation process, if the encoding end uses the transform kernel (DCT2, DCT2) to perform an initial transformation on the residual coefficient matrix corresponding to the chrominance component to obtain an initial transformation coefficient matrix, then the decoding end can use the transform kernel (DCT2, DCT2) to perform an initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the chrominance component.
[0206] Of course, when the encoding end uses other transform cores for initial transformation, the decoding end also uses the same transform core for initial inverse transformation, that is, the initial inverse transformation is the inverse process of the initial transformation, and the initial inverse transformation process will not be described in detail.
[0207] Step 327: Determine the reconstructed value of the chrominance component according to the residual coefficient matrix corresponding to the chrominance component.
[0208] Exemplarily, 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.
[0209] For example, a reference block corresponding to the chrominance component can be determined, and for each pixel of the chrominance component, a reference point corresponding to the pixel is determined from the reference block, and a residual coefficient value corresponding to the pixel is determined from the residual coefficient matrix. According to the pixel value of the reference point and the residual coefficient value, the reconstructed value of the pixel can be obtained. The reconstructed values corresponding to all the pixels of the chrominance component can constitute the reconstructed value of the chrominance component. Of course, the above method is only an example and is not limited to this.
[0210] It can be seen from the above technical scheme that in the embodiment of the present application, after the chrominance components of the current block are initially transformed, it can be determined whether to perform a secondary transformation on the chrominance components of the current block. If so, the chrominance components of the current block can be secondary transformed, that is, the secondary transformation technology can also be applied to the chrominance components of the current block. When the chrominance components have a problem of insufficient energy concentration after the initial transformation, the chrominance components can also be secondary transformed, thereby improving the coding performance and coding efficiency.
[0211] Example 3: In one possible implementation, see Figure 4A FIG. 1 is a flow chart of an encoding method proposed in an embodiment of the present application. The encoding method can be applied to an encoding end. The encoding method can include the following steps:
[0212] Step 411: Obtain the residual coefficient matrix corresponding to the chrominance component of the current block.
[0213] Exemplarily, a reference block corresponding to the chrominance component of the current block can be determined, and for each pixel of the chrominance component, a reference point corresponding to the pixel is determined from the reference block. The difference between the pixel value of the pixel and the pixel value of the reference point is the residual coefficient corresponding to the pixel, and the residual coefficients corresponding to all the pixels of the chrominance component constitute the residual coefficient matrix corresponding to the chrominance component of the current block. Of course, the above method is only an example and is not limited to this.
[0214] Step 412: Perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
[0215] For example, the chrominance components of the current block include a chrominance U component and a chrominance V component. The encoding end can perform an initial transformation on the residual coefficient matrix corresponding to the chrominance U component to obtain an initial transformation coefficient matrix corresponding to the chrominance U component, and perform an 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.
[0216] Exemplarily, the encoding end may use a transform kernel (DCT2, DCT2) to perform an initial transform on the residual coefficient matrix corresponding to the chrominance component (such as the chrominance U component or the chrominance V component) to obtain an initial transform coefficient matrix corresponding to the chrominance component. Of course, other transform kernels may also be used for the initial transform, and the initial transform process will not be described in detail.
[0217] Step 413: If the current block meets the second preset condition, determine whether to perform a secondary transformation on the chrominance component.
[0218] Exemplarily, the encoding end may determine whether the current block satisfies the second preset condition. If the current block does not satisfy the second preset condition, the encoding end determines not to perform a secondary transformation on the chrominance component of the current block. If the current block satisfies the second preset condition, the encoding end may also determine whether to perform a secondary transformation on the chrominance component of the current block based on the cost value corresponding to the chrominance component.
[0219] In a possible implementation, 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 chrominance component contains non-zero transformation coefficients. In summary, if it is determined that the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients, it is determined that the current block meets the second preset condition. If it is determined that the prediction mode of the current block is not an intra-frame prediction mode, and / or the initial transformation coefficient matrix corresponding to the chrominance component does not contain non-zero transformation coefficients, it is determined that the current block does not meet the second preset condition.
[0220] Exemplarily, since the chroma components of the current block include a chroma U component and a chroma V component, if the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chroma U component and / or the initial transformation coefficient matrix corresponding to the chroma V component contain non-zero transformation coefficients, it is determined that the current block meets the second preset condition. If the prediction mode of the current block is not an 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, it is determined that the current block does not meet the second preset condition.
[0221] In a possible implementation, in addition to the prediction mode of the current block being an intra-frame prediction mode, the initial transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and the second preset condition may also include but is not limited to at least one of the following: the current block does not use the intra-frame prediction filter mode (IPF mode); the current block does not use the improved intra-frame prediction mode (IIP mode); the current block uses the transform kernel (DCT2, DCT2) for initial transformation; the chrominance intra-frame prediction mode of the current block meets the preset mode condition; the size of the chrominance component of the current block meets the preset size condition; the control information allows the current block to use a secondary transform; other positions in the initial transform coefficient matrix except the upper left corner coordinate (0, 0) contain non-zero transform coefficients.
[0222] Exemplarily, the combination of the conditions in the second preset condition can refer to the combination of the conditions in the first preset condition in Example 1, and will not be repeated here. Exemplarily, the second preset condition needs to match the first preset condition. For example, when the first preset condition includes that the current block does not use the intra-frame prediction filter mode, the second preset condition also includes that the current block does not use the intra-frame prediction filter mode. When the first preset condition does not include that the current block does not use the intra-frame prediction filter mode, the second preset condition also does not include that the current block does not use the intra-frame prediction filter mode, and so on.
[0223] In the above embodiment, the chroma intra-frame prediction mode of the current block satisfies the preset mode conditions, which may include but are not limited to at least one of the following: the chroma intra-frame prediction mode of the current block is not the TSCPM mode; the chroma intra-frame prediction mode of the current block is not the PMC mode; the mode number of the chroma intra-frame prediction mode of the current block is mode number 0 to mode number 4; the chroma intra-frame prediction mode of the current block is not the Intra_Chroma_PCM mode; the chroma intra-frame prediction mode of the current block is not the DM mode.
[0224] In the above embodiment, the size of the chroma component of the current block satisfies the preset size condition, which may include but is not limited to at least one of the following: the width of the chroma component is less than or equal to n1, and the height of the chroma component is less than or equal to n2. The width of the chroma component is less than or equal to n1, or the height of the chroma component is less than or equal to n2. The width of the chroma component is greater than or equal to n3, and the height of the chroma component is greater than or equal to n4. The width of the chroma component is greater than or equal to n3, or the height of the chroma component is greater than or equal to n4. The product of the width and height of the chroma component is greater than or equal to n5. The product of the width and height of the chroma component is less than or equal to n6.
[0225] In the above embodiment, the control information allows the current block to use the secondary transformation, which may include but is not limited to the following: sequence level control information allows the current block to use the secondary transformation. Image parameter set level control information allows the current block to use the secondary transformation. Image header level control information allows the current block to use the secondary transformation. Slice header level control information allows the current block to use the secondary transformation. Of course, the above are just a few examples of control information, and there is no limitation on the level of this control information.
[0226] In the above embodiment, the chrominance components are the chrominance U component and the chrominance V component, and the non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0) in the initial transform coefficient matrix include one of the following conditions:
[0227] Condition 1: The initial transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), or the initial transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0).
[0228] Condition 2: The initial transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), and the initial transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0).
[0229] In conditions 1 and 2, since the encoder can obtain the initial transformation coefficient matrix corresponding to the chroma U component, it can be determined whether other positions in the initial transformation coefficient matrix corresponding to the chroma U component, except the position of the upper left corner coordinate (0, 0), contain non-zero transformation coefficients. Since the encoder can obtain the initial transformation coefficient matrix corresponding to the chroma V component, it can be determined whether other positions in the initial transformation coefficient matrix corresponding to the chroma V component, except the position of the upper left corner coordinate (0, 0), contain non-zero transformation coefficients.
[0230] In a possible implementation, if the current block satisfies the second preset condition, the encoding end may also determine whether to perform a secondary transformation on the chrominance component of the current block. For example, based on the cost value of the chrominance component (such as the rate-distortion cost value), determine whether to perform a secondary transformation on the chrominance component. The specific determination method is described in subsequent steps and will not be repeated here.
[0231] Step 414: After the current block satisfies the second preset condition and it is determined whether to perform a secondary transformation on the chrominance component of the current block, a secondary transformation flag of the block-level chrominance component may be encoded in the coded bit stream of the current block. Exemplarily, the secondary transformation flag is used to indicate whether to perform a secondary transformation on the chrominance component or not to perform a secondary transformation on the chrominance component.
[0232] In a possible implementation, the chrominance components of the current block are a chrominance U component and a chrominance V component, and the secondary transformation flag may be a UV component shared secondary transformation flag. When the value of the UV component shared secondary transformation flag is a first value, it is used to indicate that the chrominance U component and the chrominance V component are simultaneously secondary transformed, or when the value of the UV component shared secondary transformation flag is a second value, it is used to indicate that neither the chrominance U component nor the chrominance V component is secondary transformed. Based on this, in step 413, a first generation value when only the initial transformation is performed on the chrominance U component and the chrominance V component can be determined, and a second generation value when the initial transformation is first performed on the chrominance U component and the chrominance V component and then the secondary transformation is performed can be determined. If the second generation value is less than the first generation value, it is determined that the chrominance U component and the chrominance V component are simultaneously secondary transformed, and if the second generation value is greater than the first generation value, it is determined that neither the chrominance U component nor the chrominance V component is secondary transformed.
[0233] Exemplarily, if the second generation value is equal to the first generation value, it can be determined that neither the chrominance U component nor the chrominance V component is subjected to secondary transformation, or it can be determined that the chrominance U component and the chrominance V component are subjected to secondary transformation simultaneously.
[0234] In step 414, if it is determined that the chroma U component and the chroma V component are both secondary transformed, then when the UV component is encoded in the coded bit stream of the current block and shares the secondary transform flag, the value of the UV component shared secondary transform flag is the first value. If it is determined that neither the chroma U component nor the chroma V component is secondary transformed, then when the UV component is encoded in the coded bit stream of the current block and shares the secondary transform flag, the value of the UV component shared secondary transform flag is the second value.
[0235] In another possible implementation, the chrominance components of the current block are a chrominance U component and a chrominance V component, and the above-mentioned secondary transformation flag includes a U component secondary transformation flag and a V component secondary transformation flag. When the value of the U component secondary transformation flag is a first value, it is used to indicate that the chrominance U component is secondary transformed, or, when the value of the U component secondary transformation flag is a second value, it is used to indicate that the chrominance U component is not secondary transformed. When the value of the V component secondary transformation flag is a first value, it is used to indicate that the chrominance V component is secondary transformed, or, when the value of the V component secondary transformation flag is a second value, it is used to indicate that the chrominance V component is not secondary transformed. Based on this, in step 413, the third generation value when only the initial transformation is performed on the chrominance U component is determined, and the fourth generation value when the initial transformation is first performed on the chrominance U component and then the secondary transformation is performed is determined. If the fourth generation value is less than the third generation value, it is determined that the chroma U component is subjected to a secondary transformation; if the fourth generation value is greater than the third generation value, it is determined that the chroma U component is not subjected to a secondary transformation; if the fourth generation value is equal to the third generation value, it is determined that the chroma U component is not subjected to a secondary transformation or is subjected to a secondary transformation. Also, the fifth generation value is determined when only an initial transformation is performed on the chroma V component, and the sixth generation value is determined when the chroma V component is subjected to an initial transformation first and then a secondary transformation. If the sixth generation value is less than the fifth generation value, it is determined that the chroma V component is subjected to a secondary transformation; if the sixth generation value is greater than the fifth generation value, it is determined that the chroma V component is not subjected to a secondary transformation; if the sixth generation value is equal to the fifth generation value, it is determined that the chroma V component is not subjected to a secondary transformation or is subjected to a secondary transformation.
[0236] In step 414, if it is determined that the chroma U component is to be transformed twice, then when the U component secondary transformation flag is encoded in the coded bit stream, the value of the U component secondary transformation flag is the first value. If it is determined that the chroma U component is not to be transformed twice, then when the U component secondary transformation flag is encoded in the coded bit stream, the value of the U component secondary transformation flag is the second value. If it is determined that the chroma V component is to be transformed twice, then when the V component secondary transformation flag is encoded in the coded bit stream, the value of the V component secondary transformation flag is the first value. If it is determined that the chroma V component is not to be transformed twice, then when the V component secondary transformation flag is encoded in the coded bit stream, the value of the V component secondary transformation flag is the second value.
[0237] In a possible implementation, in step 414, the encoding end encodes the secondary transform flag in the encoded bit stream of the current block, which may include but is not limited to: the encoding end encodes the secondary transform flag using a context-based binary arithmetic coding method; or, the encoding end encodes the secondary transform flag using a bypass coding method.
[0238] Exemplarily, the encoding end uses a context-based binary arithmetic coding method to encode the secondary transform flag, which may include but is not limited to: the encoding end may select a target context model from at least two pre-configured context models based on the chroma intra-frame prediction mode of the current block, and encode the secondary transform flag based on the target context model. Alternatively, the encoding end may select a target context model from at least two pre-configured context models based on the size of the chroma component of the current block, and encode the secondary transform flag based on the target context model.
[0239] It can be seen from the above technical scheme that in the embodiment of the present application, after the chrominance components of the current block are initially transformed, it can be determined whether to perform a secondary transformation on the chrominance components of the current block. If so, the chrominance components of the current block can be secondary transformed, that is, the secondary transformation technology can also be applied to the chrominance components of the current block. When the chrominance components have a problem of insufficient energy concentration after the initial transformation, the chrominance components can also be secondary transformed, thereby improving the coding performance and coding efficiency.
[0240] Example 4: In one possible implementation, see Figure 4B FIG. 1 is a flow chart of an encoding method proposed in an embodiment of the present application. The encoding method can be applied to an encoding end. The encoding method can include the following steps:
[0241] Step 421: Obtain the residual coefficient matrix corresponding to the chrominance component of the current block.
[0242] Step 422: Perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component.
[0243] Step 423: If the current block meets the second preset condition, determine whether to perform a secondary transformation on the chrominance component.
[0244] Exemplarily, the implementation process of step 421 to step 423 can refer to embodiment 3, and will not be repeated here.
[0245] Step 424: If it is determined that the chrominance component is to be transformed twice, the initial transformation coefficient matrix corresponding to the chrominance component is transformed twice to obtain the target transformation coefficient matrix corresponding to the chrominance component. If it is determined that the chrominance component is not to be transformed twice, the initial transformation coefficient matrix corresponding to the chrominance component is determined as the target transformation coefficient matrix corresponding to the chrominance component.
[0246] In a possible implementation, the initial transformation coefficient matrix corresponding to the chrominance component may include an initial transformation coefficient matrix corresponding to the chrominance U component and an initial transformation coefficient matrix corresponding to the chrominance V component, on this basis:
[0247] If the secondary transform flag is a secondary transform flag shared by UV components, and the chroma U component and the chroma V component are simultaneously secondary transformed, the initial transform coefficient matrix corresponding to the chroma U component is secondary transformed to obtain the target transform coefficient matrix corresponding to the chroma U component, and the initial transform coefficient matrix corresponding to the chroma V component is secondary transformed to obtain the target transform coefficient matrix corresponding to the chroma V component. Alternatively, if neither the chroma U component nor the chroma V component is secondary transformed, the initial transform coefficient matrix corresponding to the chroma U component is determined as the target transform coefficient matrix corresponding to the chroma U component, and the initial transform coefficient matrix corresponding to the chroma V component is determined as the target transform coefficient matrix corresponding to the chroma V component.
[0248] If the secondary transform flag is the U component secondary transform flag and the V component secondary transform flag, and the chroma U component is secondary transformed, the initial transform coefficient matrix corresponding to the chroma U component can be secondary transformed to obtain the target transform coefficient matrix corresponding to the chroma U component. If the chroma U component is not secondary transformed, the initial transform coefficient matrix corresponding to the chroma U component can be determined as the target transform coefficient matrix corresponding to the chroma U component.
[0249] If the chroma V component is subjected to a secondary transformation, the initial transformation coefficient matrix corresponding to the chroma V component is subjected to a secondary transformation to obtain the target transformation coefficient matrix corresponding to the chroma V component. If the chroma V component is not subjected to a secondary transformation, the initial transformation coefficient matrix corresponding to the chroma V component is determined as the target transformation coefficient matrix corresponding to the chroma V component.
[0250] In a possible implementation, performing a secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component to obtain a target transformation coefficient matrix corresponding to the chroma component (such as performing a secondary transformation on the initial transformation coefficient matrix corresponding to the chroma U component to obtain a target transformation coefficient matrix corresponding to the chroma U component, or performing a 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), may include but is not limited to:
[0251] Case 1: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, then the coefficient matrix is determined based on the transform coefficients of the designated area located in the upper left corner of the initial transform coefficient matrix; the coefficient matrix is vertically transformed to obtain a vertical transform matrix; the vertical transform matrix is horizontally transformed to obtain a horizontal transform matrix; based on the horizontal transform matrix, the transform coefficients of the designated area located in the upper left corner of the initial transform coefficient matrix are updated to obtain the target transform coefficient matrix. Exemplarily, the preset threshold can be configured based on experience, such as 4, etc., and the designated area in the upper left corner can be configured based on experience, such as a 4*4 sub-area located in the upper left corner of the target transform coefficient matrix.
[0252] Case 2: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, the coefficient matrix is determined based on the transform coefficients of the designated area located in the upper left corner of the initial transform coefficient matrix; if the mode number of the chroma intra-frame prediction mode of the current block is in the first mode number interval, the coefficient matrix is horizontally transformed to obtain a horizontal transform matrix; if the mode number of the chroma intra-frame prediction mode of the current block is in the second mode number interval, the coefficient matrix is vertically transformed to obtain a vertical transform matrix. If only the coefficient matrix is horizontally transformed, the transform coefficients of the designated area located in the upper left corner of the initial transform coefficient matrix are updated based on the horizontal transform matrix to obtain the target transform coefficient matrix; if only the coefficient matrix is vertically transformed, the transform coefficients of the designated area located in the upper left corner of the initial transform coefficient matrix are updated based on the vertical transform matrix to obtain the target transform coefficient matrix.
[0253] The first mode number interval includes mode numbers 0 to 2, mode numbers 4 to 6, mode numbers 8 to 9, mode numbers 11 to 12, and mode numbers 14 to 15, and the second mode number interval includes mode numbers 0 to 1, mode numbers 3 to 5, mode numbers 7 to 8, mode numbers 10 to 11, mode numbers 13 to 14, and mode number 16. If the mode number of the chroma intra prediction mode is 0 to 2 or 4 to 6 or 8 to 9 or 11 to 12 or 14 to 15, the mode number of the chroma intra prediction mode is in the first mode number interval. If the mode number of the chroma intra prediction mode is 0 to 1 or 3 to 5 or 7 to 8 or 10 to 11 or 13 to 14 or 16, the mode number of the chroma intra prediction mode is in the second mode number interval.
[0254] Exemplarily, if the mode number of the chroma intra prediction mode of the current block is located in both the first mode number interval and the second mode number interval, the coefficient matrix can be vertically transformed to obtain a vertical transformation matrix; then, the vertical transformation matrix is horizontally transformed to obtain a horizontal transformation matrix. On this basis, the coefficient matrix is first vertically transformed and then horizontally transformed. Therefore, the transformation coefficients of the designated area located in the upper left corner of the initial transformation coefficient matrix can be updated based on the horizontal transformation matrix after horizontal transformation to obtain the target transformation coefficient matrix.
[0255] Case 3: If the width of the chrominance component is equal to a preset threshold, and the height of the chrominance component is equal to a preset threshold, the initial transformation coefficient matrix is horizontally transformed to obtain a horizontal transformation matrix; the horizontal transformation matrix is vertically transformed to obtain a vertical transformation matrix; and the target transformation coefficient matrix is determined based on the vertical transformation matrix.
[0256] To summarize, based on case 1, case 2 and case 3, if the preset threshold is 4, and the designated area is the 4*4 sub-area in the upper left corner, then in the process of secondary transformation of the chrominance component, if the width or height of the initial transformation coefficient matrix is greater than 4, the 4*4 coefficient matrix in the upper left corner is transformed secondary, and if the width and height of the initial transformation coefficient matrix are both 4, the initial transformation coefficient matrix is transformed secondary, and this secondary transformation process will not be repeated.
[0257] In summary, in step 424, the target transform coefficient matrix corresponding to the chrominance components may be obtained, that is, the target transform coefficient matrix corresponding to the chrominance U component and the target transform coefficient matrix corresponding to the chrominance V component.
[0258] 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 the final transform coefficient matrix to obtain a coded bit stream of the current block.
[0259] Step 426: encode a secondary transform flag in the coded bit stream of the current block, where the secondary transform flag is used to indicate that a secondary transform is performed on the chrominance components of the current block, or that a secondary transform is not performed on the chrominance components of the current block.
[0260] Exemplarily, before encoding the secondary transform flag in the coded bit stream of the current block, it can be determined whether the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, and if the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, the secondary transform flag is encoded in the coded bit stream of the current block. If the final transform coefficient matrix corresponding to the chrominance component does not contain non-zero transform coefficients, the secondary transform flag is not encoded in the coded bit stream of the current block.
[0261] For example, for the application scenario where the UV components share the secondary transform flag, if the final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients, and / or the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients, the UV component shared secondary transform flag is encoded in the coded bitstream. If the final transform coefficient matrix corresponding to the chroma U component does not contain non-zero transform coefficients, and the final transform coefficient matrix corresponding to the chroma V component does not contain non-zero transform coefficients, the UV component shared secondary transform flag is not encoded in the coded bitstream.
[0262] For another example, for the application scenario of the U component secondary transform flag and the V component secondary transform flag, if the final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients, the U component secondary transform flag is encoded in the coded bit stream, and if the final transform coefficient matrix corresponding to the chroma U component does not contain non-zero transform coefficients, the U component secondary transform flag is not encoded in the coded bit stream. If the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients, the V component secondary transform flag is encoded in the coded bit stream, and if the final transform coefficient matrix corresponding to the chroma V component does not contain non-zero transform coefficients, the V component secondary transform flag is not encoded in the coded bit stream.
[0263] Exemplarily, the encoding end may also encode a transform coefficient flag in the encoded bit stream of the current block, where the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients.
[0264] For example, if the transform coefficient flag is the first value, it indicates that the final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients. Alternatively, if the transform coefficient flag is the second value, it indicates that the final transform coefficient matrix corresponding to the chrominance component of the current block does not contain non-zero transform coefficients. Exemplarily, the transform coefficient flag may include a chrominance U component transform coefficient flag and a chrominance V component transform coefficient flag. When the value of the chrominance U component transform coefficient flag is the first value, it can be used to indicate that the final transform coefficient matrix corresponding to the chrominance U component of the current block contains non-zero transform coefficients; when the value of the chrominance U component transform coefficient flag is the second value, it can be used to indicate that the final transform coefficient matrix corresponding to the chrominance U component of the current block does not contain non-zero transform coefficients. In addition, when the value of the chroma V component transform coefficient flag is the first value, it can be used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients; when the value of the chroma V component transform coefficient flag is the second value, it can be used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block does not contain non-zero transform coefficients.
[0265] It can be seen from the above technical scheme that in the embodiment of the present application, after the chrominance components of the current block are initially transformed, it can be determined whether to perform a secondary transformation on the chrominance components of the current block. If so, the chrominance components of the current block can be secondary transformed, that is, the secondary transformation technology can also be applied to the chrominance components of the current block. When the chrominance components have a problem of insufficient energy concentration after the initial transformation, the chrominance components can also be secondary transformed, thereby improving the coding performance and coding efficiency.
[0266] In the above-mentioned embodiments 1 to 4, the first value may be 1 and the second value may be 0; or, the first value may be 0 and the second value may be 1; of course, the above are only examples and there is no limitation on the first value and the second value.
[0267] Example 5: In one possible implementation, see Figure 5A FIG. 1 is a flow chart of a decoding method proposed in an embodiment of the present application. The decoding method can be applied to a decoding end. The decoding method can include the following steps:
[0268] Step 511, obtain the coded bit stream of the current block, and parse the final transform coefficient matrix corresponding to the luminance component of the current block, the final transform coefficient matrix corresponding to the chrominance U component, and the final transform coefficient matrix corresponding to the chrominance V component from the coded bit stream, and parse the luminance component transform coefficient flag, the chrominance U component transform coefficient flag, and the chrominance V component transform coefficient flag from the coded bit stream. Exemplarily, the luminance component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients, the chrominance U component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients, and the chrominance V component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients.
[0269] For example, the decoding end parses the luminance component transform coefficient flag, the chrominance U component transform coefficient flag, and the chrominance V component transform coefficient flag from the coded bit stream of the current block. If the value of the luminance component transform coefficient flag is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients. If the value of the luminance component transform coefficient flag is the second value, the decoding end can determine that the final transform coefficient matrix corresponding to the luminance component does not contain non-zero transform coefficients. If the value of the chrominance U component transform coefficient flag is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients. If the value of the chrominance U component transform coefficient flag is the second value, the decoding end can determine that the final transform coefficient matrix corresponding to the chrominance U component does not contain non-zero transform coefficients. If the value of the chrominance V component transform coefficient flag is the first value, the decoding end can determine that the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients. If the value of the chroma V component transform coefficient flag is the second value, the decoding end determines that the final transform coefficient matrix corresponding to the chroma V component does not contain a non-zero transform coefficient.
[0270] Step 512: If the current block satisfies the third preset condition, a block-level luminance-chrominance secondary transformation flag is parsed from the encoded bit stream. The luminance-chrominance secondary transformation flag is a secondary transformation flag shared by the luminance component, the chrominance U component and the chrominance V component. When the value of the luminance-chrominance secondary transformation flag is a first value, it is used to indicate that a secondary inverse transformation is performed on the luminance component, the chrominance U component and the chrominance V component at the same time. Alternatively, when the value of the luminance-chrominance secondary transformation flag is a second value, it is used to indicate that a secondary inverse transformation is not performed on the luminance component, the chrominance U component and the chrominance V component.
[0271] Step 513: Determine whether to perform a secondary inverse transformation on the luminance component, chrominance U component and chrominance V component of the current block according to the luminance and chrominance secondary transformation flag, that is, to perform a secondary inverse transformation at the same time or not to perform a secondary inverse transformation on any of them.
[0272] Exemplarily, the decoding end may determine whether the current block satisfies the third preset condition. If the current block does not satisfy the third preset condition, the decoding end determines not to perform a secondary inverse transformation on the luminance component, the chrominance U component, and the chrominance V component of the current block. If the current block satisfies the third preset condition, the decoding end parses the luminance and chrominance secondary transformation flag from the coded bit stream of the current block. If the value of the luminance and chrominance secondary transformation flag is a first value, the decoding end determines to perform a secondary inverse transformation on the luminance component, the chrominance U component, and the chrominance V component of the current block at the same time. If the value of the luminance and chrominance secondary transformation flag is a second value, the decoding end determines not to perform a secondary inverse transformation on the luminance component, the chrominance U component, and the chrominance V component of the current block.
[0273] In a possible implementation, the third preset condition may at least include: the prediction mode of the current block is the intra-frame prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients. The transform coefficient flag is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients, including at least one of the following conditions: the luminance component transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients, for example, the value of the luminance component transform coefficient flag is the first value. The chrominance U component transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients, for example, the value of the chrominance U component transform coefficient flag is the first value. The chrominance V component transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients, for example, the value of the chrominance V component transform coefficient flag is the first value.
[0274] In summary, if it is determined that the prediction mode of the current block is the intra prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients (such as at least one of the luminance component transform coefficient flag, the chrominance U component transform coefficient flag, and the chrominance V component transform coefficient flag is the first value), the decoding end determines that the current block meets the third preset condition. Otherwise, the decoding end determines that the current block does not meet the third preset condition.
[0275] In a possible implementation, in addition to the prediction mode of the current block being an intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix contains non-zero transform coefficients, and the third preset condition may also include but is not limited to at least one of the following: the current block does not use the intra-frame prediction filtering mode; the current block does not use the DT partitioning mode; the current block does not use the improved intra-frame prediction mode; the current block uses the transform core (DCT2, DCT2) for initial inverse transform; the chroma intra-frame prediction mode of the current block meets the preset mode condition; the size of the current block meets the preset size condition; the control information allows the current block to use a secondary inverse transform; and other positions in the final transform coefficient matrix except the upper left corner coordinate (0, 0) contain non-zero transform coefficients.
[0276] Exemplarily, the third preset condition may include any combination of all the above conditions, which is not limited.
[0277] In the above embodiment, the chroma intra prediction mode of the current block meets the preset mode condition, which can be referred to in Example 1, and will not be repeated here. The size of the current block meets the preset size condition, which can be referred to in Example 1, and will not be repeated here. The control information allows the current block to use a secondary inverse transform, which can be referred to in Example 1, and will not be repeated here.
[0278] In the above embodiment, the positions other than the position of the upper left corner coordinate (0, 0) in the final transformation coefficient matrix contain non-zero transformation coefficients, which may include: the positions other than the position of the upper left corner coordinate (0, 0) in the final transformation coefficient matrix corresponding to the luminance component contain non-zero transformation coefficients, and the positions other than the position of the upper left corner coordinate (0, 0) in the final transformation coefficient matrix corresponding to the chrominance U component contain non-zero transformation coefficients, and the positions other than the position of the upper left corner coordinate (0, 0) in the final transformation coefficient matrix corresponding to the chrominance V component contain non-zero transformation coefficients. Or, among the final transformation coefficient matrix corresponding to the luminance component, the final transformation coefficient matrix corresponding to the chrominance U component, and the final transformation coefficient matrix corresponding to the chrominance V component, at least one of the final transformation coefficient matrices contains non-zero transformation coefficients in positions other than the position of the upper left corner coordinate (0, 0).
[0279] In a possible implementation, the decoding end parses the luminance-chrominance secondary transformation flag from the encoded bit stream, which may include but is not limited to: the decoding end uses a context-based binary arithmetic decoding method to parse the luminance-chrominance secondary transformation flag from the encoded bit stream; or, the decoding end uses a bypass decoding method to parse the luminance-chrominance secondary transformation flag from the encoded bit stream.
[0280] The decoding end adopts a context-based binary arithmetic decoding method to parse the luminance chrominance secondary transformation flag from the coded bit stream, which may include but is not limited to: the decoding end selects a target context model from at least two pre-configured context models based on the chrominance intra-frame prediction mode of the current block, and parses the luminance chrominance secondary transformation flag from the coded bit stream based on the target context model. Alternatively, the decoding end selects a target context model from at least two pre-configured context models based on the size of the chrominance component, and parses the luminance chrominance secondary transformation flag from the coded bit stream based on the target context model.
[0281] Step 514, dequantize the final transform coefficient matrix corresponding to the luminance component to obtain the target transform coefficient matrix corresponding to the luminance component, dequantize the final transform coefficient matrix corresponding to the chrominance U component to obtain the target transform coefficient matrix corresponding to the chrominance U component, dequantize the final transform coefficient matrix corresponding to the chrominance V component to obtain the target transform coefficient matrix corresponding to the chrominance V component.
[0282] Step 515: If the luminance component, chrominance U component and chrominance V component of the current block are subjected to secondary inverse transformation at the same time, the target transformation coefficient matrix corresponding to the luminance component is subjected to secondary inverse transformation to obtain the initial transformation coefficient matrix corresponding to the luminance component, the target transformation coefficient matrix corresponding to the chrominance U component is subjected to secondary inverse transformation to obtain the initial transformation coefficient matrix corresponding to the chrominance U component, and the target transformation coefficient matrix corresponding to the chrominance V component is subjected to secondary inverse transformation to obtain the initial transformation coefficient matrix corresponding to the chrominance V component. If the luminance component, chrominance U component and chrominance V component of the current block are not subjected to secondary inverse transformation, the target transformation coefficient matrix corresponding to the luminance component is determined as the initial transformation coefficient matrix corresponding to the luminance component, the target transformation coefficient matrix corresponding to the chrominance U component is determined as the initial transformation coefficient matrix corresponding to the chrominance U component, and the target transformation coefficient matrix corresponding to the chrominance V component is determined as the initial transformation coefficient matrix corresponding to the chrominance V component.
[0283] In a possible implementation, the process of performing a secondary inverse transformation on the target transformation coefficient matrix corresponding to the chrominance component (such as the chrominance U component and the chrominance V component) to obtain the initial transformation coefficient matrix corresponding to the chrominance component can be referred to step 325 and will not be repeated here. The process of performing a secondary 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 luminance component is greater than a preset threshold, or the height of the luminance component is greater than a preset threshold, then determining the coefficient matrix based on the transformation coefficients of the designated area located in the upper left corner of the target transformation coefficient matrix; performing a horizontal inverse transformation on the coefficient matrix to obtain a horizontal inverse transformation matrix; performing a vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; and updating the transformation coefficients of the designated area located in the upper left corner of the target transformation coefficient matrix based on the vertical inverse transformation matrix to obtain the initial transformation coefficient matrix.
[0284] Alternatively, if the width of the brightness component is equal to a preset threshold and the height of the brightness component is equal to a preset threshold, the target transformation coefficient matrix is vertically inverse transformed to obtain a vertical inverse transformation matrix; the vertical inverse transformation matrix is horizontally inverse transformed to obtain a horizontal inverse transformation matrix; and the initial transformation coefficient matrix is determined based on the horizontal inverse transformation matrix.
[0285] Step 516: Perform an initial inverse transformation on the initial transformation coefficient matrix corresponding to the luminance component to obtain a residual coefficient matrix corresponding to the luminance component; perform an initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain a residual coefficient matrix corresponding to the chrominance U component; perform an initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance V component to obtain a residual coefficient matrix corresponding to the chrominance V component. The method of initial inverse transformation will not be repeated here.
[0286] Step 517: Determine the reconstruction value of the luminance component according to the residual coefficient matrix corresponding to the luminance component, determine the reconstruction value of the chrominance U component according to the residual coefficient matrix corresponding to the chrominance U component, and determine the reconstruction value of the chrominance V component according to the residual coefficient matrix corresponding to the chrominance V component. At this point, 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, that is, complete the decoding process of the current block.
[0287] It can be seen from the above technical solution that in the embodiment of the present application, after the initial transformation of the brightness component and the chrominance component of the current block, it can be determined whether to perform a secondary transformation on the brightness component and the chrominance component of the current block, that is, the secondary transformation technology can be applied to the brightness component and the chrominance component of the current block at the same time. When the brightness component and the chrominance component have the problem of insufficient energy concentration after the initial transformation, the brightness component and the chrominance component can be transformed secondary to improve the coding performance and coding efficiency.
[0288] Example 6: In one possible implementation, see Figure 5B FIG. 1 is a flow chart of an encoding method proposed in an embodiment of the present application. The encoding method can be applied to an encoding end. The encoding method can include the following steps:
[0289] Step 521: Obtain the residual coefficient matrix corresponding to the luminance component of the current block, the residual coefficient matrix corresponding to the chrominance U component of the current block, and the residual coefficient matrix corresponding to the chrominance V component of the current block.
[0290] Step 522: Perform an initial transformation on the residual coefficient matrix corresponding to the luminance component to obtain an initial transformation coefficient matrix corresponding to the luminance component; perform an 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; perform an 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 method of the initial transformation will not be repeated here.
[0291] Step 523: If the current block meets the fourth preset condition, determine whether to perform secondary transformation on the luminance component, chrominance U component and chrominance V component of the current block, that is, perform secondary transformation on both at the same time, or do not perform secondary transformation on all of them.
[0292] Exemplarily, the encoding end may determine whether the current block satisfies the fourth preset condition. If the current block does not satisfy the fourth preset condition, the encoding end may determine not to perform secondary transformation on the luminance component, chrominance U component, and chrominance V component of the current block. If the current block satisfies the fourth preset condition, the encoding end may also determine whether to perform secondary transformation on the luminance component, chrominance U component, and chrominance V component of the current block based on the cost value (such as the rate-distortion cost value) of the current block.
[0293] In a possible implementation, 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 transformation coefficient matrix contains non-zero transformation coefficients, including at least one of the following conditions: the transformation coefficient matrix corresponding to the luminance component contains non-zero transformation coefficients; the transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients; the transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients. In summary, if it is determined that the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix contains non-zero transformation coefficients, it is determined that the current block meets the fourth preset condition. If it is determined that the prediction mode of the current block is not an intra-frame prediction mode, and / or the initial transformation coefficient matrix does not contain non-zero transformation coefficients, it is determined that the current block does not meet the fourth preset condition.
[0294] In a possible implementation, in addition to the prediction mode of the current block being the intra-frame prediction mode, the initial transformation coefficient matrix contains non-zero transformation coefficients, and the fourth preset condition may also include but is not limited to at least one of the following: the current block does not use the intra-frame prediction filter mode; the current block does not use the DT partition mode; the current block does not use the improved intra-frame prediction mode; the current block uses the transform core (DCT2, DCT2) for initial transformation; the chroma intra-frame prediction mode of the current block meets the preset mode condition; the size of the current block meets the preset size condition; the control information allows the current block to use a secondary transformation; the initial transformation coefficient matrix contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0). Exemplarily, the fourth preset condition needs to match the third preset condition, for example, the third preset condition includes that when the current block does not use the intra-frame prediction filter mode, the fourth preset condition also includes that the current block does not use the intra-frame prediction filter mode. The third preset condition does not include that when the current block does not use the intra-frame prediction filter mode, the fourth preset condition also does not include that the current block does not use the intra-frame prediction filter mode.
[0295] Exemplarily, the chrominance intra-frame prediction mode of the current block satisfies the preset mode condition, the size of the current block satisfies the preset size condition, the control information allows the current block to use a secondary transform, and the positions other than the upper left corner coordinate (0, 0) in the initial transform coefficient matrix contain non-zero transform coefficients. Please refer to Example 3, which will not be repeated here.
[0296] Step 524: encode a block-level luminance-chrominance secondary transform flag in the coded bit stream of the current block, where the luminance-chrominance secondary transform flag is a secondary transform flag shared by the luminance component, the chrominance U component, and the chrominance V component.
[0297] Exemplarily, when the value of the brightness-chroma secondary transformation flag is the first value, it is used to indicate that a secondary inverse transformation is performed on the brightness component, the chroma U component and the chroma V component at the same time; or, when the value of the brightness-chroma secondary transformation flag is the second value, it is used to indicate that a secondary inverse transformation is not performed on the brightness component, the chroma U component and the chroma V component.
[0298] In step 523, the seventh generation value is determined when only the initial transformation is performed on the luminance component, the chrominance U component, and the chrominance V component, and the eighth generation value is determined when the initial transformation is first performed on the luminance component, the chrominance U component, and the chrominance V component and then the secondary transformation is performed. If the eighth generation value is less than the seventh generation value, it is determined that the luminance component, the chrominance U component, and the chrominance V component are secondary transformed at the same time. If the eighth generation value is greater than the seventh generation value, it is determined that the luminance component, the chrominance U component, and the chrominance V component are not secondary transformed. If the eighth generation value is equal to the seventh generation value, it is determined that the luminance component, the chrominance U component, and the chrominance V component are secondary transformed at the same time, or the luminance component, the chrominance U component, and the chrominance V component are not secondary transformed.
[0299] In step 524, if it is determined that the luminance component, the chrominance U component, and the chrominance V component are simultaneously subjected to secondary transformation, a luminance chrominance secondary transformation flag is encoded in the coded bit stream of the current block, and the value of the luminance chrominance secondary transformation flag is the first value. If it is determined that the luminance component, the chrominance U component, and the chrominance V component are not subjected to secondary transformation, a luminance chrominance secondary transformation flag is encoded in the coded bit stream of the current block, and the value of the luminance chrominance secondary transformation flag is the second value.
[0300] In a possible implementation, the encoding end encodes the luminance chrominance secondary transform flag in the encoded bit stream of the current block, which may include but is not limited to: the encoding end uses context-based binary arithmetic coding to encode the luminance chrominance secondary transform flag; or, the encoding end uses bypass coding to encode the luminance chrominance secondary transform flag.
[0301] The encoding end uses a context-based binary arithmetic coding method to encode the brightness chromaticity secondary transformation flag, which may include but is not limited to: the encoding end may select a target context model from at least two pre-configured context models based on the chromaticity intra-frame prediction mode of the current block, and encode the brightness chromaticity secondary transformation flag based on the target context model. Alternatively, the encoding end may select a target context model from at least two pre-configured context models based on the size of the chromaticity component of the current block, and encode the brightness chromaticity secondary transformation flag based on the target context model.
[0302] In a possible implementation manner, after step 523 and before step 524, the following steps may also be included:
[0303] If it is determined that the luminance component, chrominance U component and chrominance V component of the current block are simultaneously subjected to secondary transformation, the encoding end performs 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, performs secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain the target transformation coefficient matrix corresponding to the chrominance U component, and performs secondary transformation on the initial transformation coefficient matrix corresponding to the chrominance V component to obtain the target transformation coefficient matrix corresponding to the chrominance V component. If it is determined that the luminance component, chrominance U component and chrominance V component of the current block are not subjected to secondary transformation, the encoding end determines the initial transformation coefficient matrix corresponding to the luminance component as the target transformation coefficient matrix corresponding to the luminance component, determines the initial transformation coefficient matrix corresponding to the chrominance U component as the target transformation coefficient matrix corresponding to the chrominance U component, and determines the initial transformation coefficient matrix corresponding to the chrominance V component as the target transformation coefficient matrix corresponding to the chrominance V component.
[0304] Exemplarily, the process of performing a secondary transformation on the initial transformation coefficient matrix corresponding to the chroma component (such as the chroma U component and the chroma V component) to obtain the target transformation coefficient matrix corresponding to the chroma component can be referred to step 424, which will not be repeated here. The process of performing a 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 luminance component is greater than a preset threshold, or the height of the luminance component is greater than a preset threshold, then determining the coefficient matrix based on the transformation coefficients of the designated area located in the upper left corner of the initial transformation coefficient matrix; performing a vertical transformation on the coefficient matrix to obtain a vertical transformation matrix; performing a horizontal transformation on the vertical transformation matrix to obtain a horizontal transformation matrix; updating the transformation coefficients of the designated area located in the upper left corner of the initial transformation coefficient matrix based on the horizontal transformation matrix to obtain the target transformation coefficient matrix. Alternatively, if the width of the luminance component is equal to the preset threshold, and the height of the luminance component is equal to the preset threshold, then performing a horizontal transformation on the initial transformation coefficient matrix to obtain a horizontal transformation matrix; performing a vertical transformation on the horizontal transformation matrix to obtain a vertical transformation matrix; and determining the target transformation coefficient matrix based on the vertical transformation matrix.
[0305] After obtaining 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, the target transform coefficient matrix corresponding to the luminance component is quantized to obtain the final transform coefficient matrix corresponding to the luminance component, the target transform coefficient matrix corresponding to the chrominance U component is quantized to obtain the final transform coefficient matrix corresponding to the chrominance U component, and the target transform coefficient matrix corresponding to the chrominance V component is quantized to obtain the final transform coefficient matrix corresponding to the chrominance V component. 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 encoded to obtain an encoded bit stream.
[0306] In a possible implementation, before step 524, it can also be determined whether the final transformation coefficient matrix contains non-zero transformation coefficients. If at least one of the final transformation coefficient matrix corresponding to the luminance component, the final transformation coefficient matrix corresponding to the chrominance U component, and the final transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients, a luminance chrominance secondary transformation flag is encoded in the coded bit stream of the current block. If the final transformation coefficient matrix corresponding to the luminance component, the final transformation coefficient matrix corresponding to the chrominance U component, and the final transformation coefficient matrix corresponding to the chrominance V component do not contain non-zero transformation coefficients, the luminance chrominance secondary transformation flag is not encoded in the coded bit stream of the current block.
[0307] In a possible implementation, the encoding end may further encode a luminance component transform coefficient flag, a chrominance U component transform coefficient flag, and a chrominance V component transform coefficient flag in the encoded bit stream. The luminance component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients, the chrominance U component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients, and the chrominance V component transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients.
[0308] It can be seen from the above technical solution that in the embodiment of the present application, after the initial transformation of the brightness component and the chrominance component of the current block, it can be determined whether to perform a secondary transformation on the brightness component and the chrominance component of the current block, that is, the secondary transformation technology can be applied to the brightness component and the chrominance component of the current block at the same time. When the brightness component and the chrominance component have the problem of insufficient energy concentration after the initial transformation, the brightness component and the chrominance component can be transformed secondary to improve the coding performance and coding efficiency.
[0309] In the above-mentioned Embodiment 5 and Embodiment 6, the first value may be 1 and the second value may be 0; or, the first value may be 0 and the second value may be 1; of course, the above-mentioned are only examples and there is no limitation on the first value and the second value.
[0310] Embodiment 7: A secondary transformation method is proposed in the embodiment of the present application, and the decoding process of the decoding end includes: if the current block meets the parsing condition (i.e., the first preset condition), the secondary transformation flag is parsed from the coded bit stream of the current block. When the secondary transformation flag is equal to 0 (0 is used to represent the second value), it indicates that the chrominance component does not undergo secondary inverse transformation, and when the secondary transformation flag is equal to 1 (1 is used to represent the first value), it indicates that the chrominance component undergoes secondary inverse transformation. Exemplarily, if the chrominance component undergoes secondary inverse transformation, the upper left 4*4 area of the target transformation coefficient matrix of the chrominance component is subjected to secondary inverse transformation, and the transformation coefficient of the upper left 4*4 area is updated to obtain the initial transformation coefficient matrix, and then, the initial transformation coefficient matrix is subjected to initial inverse transformation to obtain the residual coefficient matrix. If the chrominance component does not undergo secondary inverse transformation, the target transformation coefficient matrix (i.e., the target transformation coefficient matrix is used as the initial transformation coefficient matrix) is directly subjected to initial inverse transformation to obtain the residual coefficient matrix. Then, the reconstructed block is determined based on the residual coefficient matrix (i.e., the residual block), such as the reconstructed block is obtained by adding the residual block to the prediction block.
[0311] Exemplarily, the parsing conditions may include: the prediction mode of the current block is the intra prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains non-zero transform coefficients. For example, cbf_u is 1 or cbf_v is 1. cbf_u is the chroma U component transform coefficient flag, and cbf_u is 1, indicating that the final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients. cbf_v is the chroma V component transform coefficient flag, and cbf_v is 1, indicating that the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients.
[0312] The encoding process of the encoding end includes: if the current block meets the parsing condition (i.e., the second preset condition), the encoding end decides whether the chrominance component of the current block is subjected to secondary transformation through RDO, and if the chrominance component is determined not to be subjected to secondary transformation, the residual coefficient matrix (i.e., the residual block) is directly subjected to initial transformation to obtain the initial transformation coefficient matrix, the initial transformation coefficient matrix is quantized to obtain the final transformation coefficient matrix, the final transformation coefficient matrix is encoded in the coded bit stream of the current block, and the secondary transformation flag is encoded in the coded bit stream to be equal to 0 to indicate that no secondary transformation is performed. If the chrominance component is determined to be subjected to secondary transformation, the residual coefficient matrix is subjected to initial transformation to obtain the initial transformation coefficient matrix, and the transformation coefficients of the 4*4 upper left corner of the initial transformation coefficient matrix are subjected to secondary transformation to obtain the target transformation coefficient matrix after secondary transformation, the target transformation coefficient matrix is quantized to obtain the final transformation coefficient matrix, the final transformation coefficient matrix is encoded in the coded bit stream of the current block, and the secondary transformation flag is encoded in the coded bit stream to be equal to 1 to indicate that secondary transformation is performed. Exemplarily, the parsing condition may include: the prediction mode of the current block is an intra-frame prediction mode, and the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients.
[0313] Embodiment 8: The chroma U component and the chroma V component share a secondary conversion flag, which may be a UV component shared secondary conversion flag, and the UV component shared secondary conversion flag is recorded as st_chroma_flag.
[0314] The decoding process of the decoding end includes: if the current block meets the parsing condition 1 (i.e., the first preset condition), parsing st_chroma_flag from the coded bit stream of the current block. When st_chroma_flag is equal to 0, it means that neither the chroma U component nor the chroma V component undergoes a secondary inverse transformation. When st_chroma_flag is equal to 1, it means that the chroma U component and the chroma V component undergo a secondary inverse transformation at the same time. Exemplarily, if the chroma U component and the chroma V component undergo a secondary inverse transformation at the same time, the upper left 4*4 area of the target transformation coefficient matrix corresponding to the chroma U component is subjected to a secondary inverse transformation, and the transformation coefficient of the upper left 4*4 area is updated to obtain the initial transformation coefficient matrix corresponding to the chroma U component, and then the initial transformation coefficient matrix corresponding to the chroma U component is subjected to an initial inverse transformation to obtain the residual coefficient matrix corresponding to the chroma U component. Perform a secondary inverse transform on the upper left 4*4 area of the target transform coefficient matrix corresponding to the chroma V component, and update the transform coefficient of the upper left 4*4 area to obtain the initial transform coefficient matrix corresponding to the chroma V component, and then perform an initial inverse transform on the initial transform coefficient matrix corresponding to the chroma V component to obtain the residual coefficient matrix corresponding to the chroma V component. If neither the chroma U component nor the chroma V component is subjected to a secondary inverse transform, then perform an initial inverse transform on the target transform coefficient matrix corresponding to the chroma U component to obtain the residual coefficient matrix corresponding to the chroma U component, and perform an initial inverse transform on the target transform coefficient matrix corresponding to the chroma V component to obtain the residual coefficient matrix corresponding to the chroma V component. Then, the reconstructed block is determined based on the residual coefficient matrix corresponding to the chroma U component (i.e., residual block) 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 reconstructed 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 reconstructed block corresponding to the chroma V component.
[0315] Exemplarily, analysis condition 1 can refer to the first preset condition of embodiment 1, which will not be described in detail here.
[0316] The encoding process of the encoding end includes: if the current block meets the analysis condition 2, the encoding end decides through RDO not to perform secondary transformation on the chroma U component and the chroma V component of the current block, or performs secondary transformation on the chroma U component and the chroma V component of the current block at the same time. If it is decided not to perform secondary transformation on the chroma U component and the chroma V component, the residual coefficient matrix corresponding to the chroma U component (i.e., the residual block) is directly initially transformed to obtain the initial transformation coefficient matrix corresponding to the chroma U component, and the initial transformation coefficient matrix corresponding to the chroma U component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma U component. The residual coefficient matrix corresponding to the chroma V component (i.e., the residual block) is initially transformed to obtain the initial transformation coefficient matrix corresponding to the chroma V component, and the initial transformation coefficient matrix corresponding to the chroma V component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma V component. The final transformation coefficient matrix corresponding to the chroma U component and the final transformation coefficient matrix corresponding to the chroma V component are encoded in the encoded bit stream of the current block, and st_chroma_flag is encoded to be equal to 0 in the encoded bit stream.
[0317] If it is decided to perform secondary transformation on the chroma U component and the chroma V component at the same time, the residual coefficient matrix corresponding to the chroma U component is initially transformed to obtain the initial transformation coefficient matrix corresponding to the chroma U component, the 4*4 transformation coefficients at the upper left corner of the initial transformation coefficient matrix corresponding to the chroma U component are secondary transformed to obtain the target transformation coefficient matrix corresponding to the chroma U component, and the target transformation coefficient matrix corresponding to the chroma U component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma U component. The residual coefficient matrix corresponding to the chroma V component is initially transformed to obtain the initial transformation coefficient matrix corresponding to the chroma V component, the 4*4 transformation coefficients at the upper left corner of the initial transformation coefficient matrix corresponding to the chroma V component are secondary transformed to obtain the target transformation coefficient matrix corresponding to the chroma V component, and the target transformation coefficient matrix corresponding to the chroma V component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma V component. The final transformation coefficient matrix corresponding to the chroma U component and the final transformation coefficient matrix corresponding to the chroma V component are encoded in the coded bitstream, and st_chroma_flag is encoded equal to 1 in the coded bitstream.
[0318] Exemplarily, analysis condition 2 can refer to the second preset condition of embodiment 3, which will not be described in detail here.
[0319] Embodiment 9: Based on the st_chroma_flag of Embodiment 8, the encoding end may encode st_chroma_flag using a context-based binary arithmetic coding method, and the decoding end may decode st_chroma_flag using a context-based binary arithmetic decoding method. Alternatively, the encoding end may encode st_chroma_flag using a bypass coding method, and the decoding end may decode st_chroma_flag using a bypass decoding method. If a context-based binary arithmetic coding method or a decoding method is used, a context model may also be preconfigured, and the context model is described below:
[0320] Case 1: A separate context model is preconfigured, and the context model is used as the target context model for all chroma components. Based on this, for the encoder, when st_chroma_flag needs to be encoded, the encoder can encode st_chroma_flag based on the context model. For the decoder, when st_chroma_flag needs to be decoded, the decoder can decode st_chroma_flag based on the context model.
[0321] Case 2: pre-configure at least two context models based on the chroma intra prediction mode, and these context models may serve as target context models. For the encoder, when st_chroma_flag needs to be encoded, the encoder first selects the target context model from at least two pre-configured context models based on the chroma intra prediction mode of the current block, and encodes st_chroma_flag based on the target context model. For the decoder, when st_chroma_flag needs to be decoded, the decoder first selects the target context model from at least two pre-configured context models based on the chroma intra prediction mode of the current block, and decodes st_chroma_flag based on the target context model.
[0322] For example, as shown in Table 5, two context models can be preconfigured, and the two context models are context model 0 and context model 1. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 0 and 4 (DM, DC, HOR, VER, BI), context model 0 is used as the target context model, and st_chroma_flag is encoded based on context model 0. Similarly, the decoder decodes st_chroma_flag based on context model 0. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 5 and 16 (other modes except DM, DC, HOR, VER, BI), context model 1 is used as the target context model, and st_chroma_flag is encoded based on context model 1. Similarly, the decoder decodes st_chroma_flag based on context model 1.
[0323] Table 5
[0324] IntraChromaMode (chroma intra prediction mode) Context model 0-4 (DM, DC, HOR, VER, BI) 0 5-16 (other modes) 1
[0325] For another example, as shown in Table 6, three context models may be preconfigured, namely context model 0, context model 1, and context model 2. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 0 and 4 (DM, DC, HOR, VER, BI), context model 0 is used as the target context model, and st_chroma_flag is encoded based on context model 0, and the decoder decodes st_chroma_flag based on context model 0. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 5 and 7 (TSCPM, TSCPM_L, TSCPM_T), context model 1 is used as the target context model, st_chroma_flag is encoded based on context model 1, and the decoder decodes st_chroma_flag based on context model 1. For the encoding end, if the mode number of the chroma intra-frame prediction mode of the current block is between 8 and 16 (PMC, PMC_L, PMC_T, EPMC, EPMC_L, EPMC_T, EPMC2, EPMC2_L, EPMC2_T), context model 2 is used as the target context model, and st_chroma_flag is encoded based on context model 2. The decoding end decodes st_chroma_flag based on context model 2.
[0326] Table 6
[0327]
[0328] For another example, as shown in Table 7, four context models can be preconfigured, namely context model 0 to context model 3. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 0 and 4 (DM, DC, HOR, VER, BI), context model 0 is used as the target context model, st_chroma_flag is encoded based on context model 0, and the decoder decodes st_chroma_flag based on context model 0. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 5 and 7 (TSCPM, TSCPM_L, TSCPM_T), context model 1 is used as the target context model, st_chroma_flag is encoded based on context model 1, and the decoder decodes st_chroma_flag based on context model 1. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 8 and 10 (PMC, PMC_L, PMC_T), context model 2 is used as the target context model, st_chroma_flag is encoded based on context model 2, and the decoder decodes st_chroma_flag based on context model 2. For the encoder, if the mode number of the chroma intra prediction mode of the current block is between 11 and 16 (EPMC, EPMC_L, EPMC_T, EPMC2, EPMC2_L, EPMC2_T), context model 3 is used as the target context model, st_chroma_flag is encoded based on context model 3, and the decoder decodes st_chroma_flag based on context model 3.
[0329] Table 7
[0330]
[0331] Case 3: pre-configure at least two context models based on the size of the chroma component of the current block, and these context models may be used as target context models. For the encoding end, first select the target context model from the at least two pre-configured context models based on the size of the chroma component of the current block, and encode st_chroma_flag based on the target context model. For the decoding end, first select the target context model from the at least two pre-configured context models based on the size of the chroma component of the current block, and decode st_chroma_flag based on the target context model.
[0332] For example, at least two context models can be configured based on the width of the chroma component, at least two context models can be configured based on the height of the chroma component, at least two context models can be configured based on the maximum value of the width and height of the chroma component, at least two context models can be configured based on the minimum value of the width and height of the chroma component, and at least two context models can be configured based on the product of the width and height of the chroma component. Of course, the above are just a few examples and there is no limitation to this.
[0333] For example, as shown in Table 8, two context models can be configured according to the product of width and height, and the two context models are context model 0 and context model 1, respectively. For the encoding end, if the product of the width and height of the chrominance component is greater than or equal to N, context model 0 can be used as the target context model, and st_chroma_flag is encoded based on context model 0. Similarly, the decoding end decodes st_chroma_flag based on context model 0. For the encoding end, if the product of the width and height of the chrominance component is less than N, context model 1 is used as the target context model, and st_chroma_flag is encoded based on context model 1. Similarly, the decoding end decodes st_chroma_flag based on context model 1. Exemplarily, N can be configured based on experience, such as N can be set to 128.
[0334] Table 8
[0335] Size=width*height Context model Size>=N 0 Size<N 1
[0336] For another example, as shown in Table 9, two context models can be configured according to the minimum values of width and height, and the two context models are context model 0 and context model 1, respectively. For the encoding end, if the minimum value of the width and height of the chroma component is greater than or equal to M, context model 0 is used as the target context model, and st_chroma_flag is encoded based on context model 0. Similarly, the decoding end decodes st_chroma_flag based on context model 0. For the encoding end, if the minimum value of the width and height of the chroma component is less than M, context model 1 is used as the target context model, and st_chroma_flag is encoded based on context model 1. Similarly, the decoding end decodes st_chroma_flag based on context model 1. Exemplarily, M can be configured based on experience, such as M can be set to 4 or 8.
[0337] Table 9
[0338] Size = min(width, height) Context model Size>=M 0 Size<M 1
[0339] Embodiment 10: Based on Embodiment 8, for the secondary transform process, from the encoding end, the initial transform coefficient matrix is obtained after (DCT2, DCT2) transformation, and then the 4*4 transform coefficients in the upper left corner of the initial transform coefficient matrix are multiplied by the secondary transform matrix to obtain new transform coefficients, and the new transform coefficients are used to replace the 4*4 transform coefficients in the upper left corner of the initial transform coefficient matrix to obtain the target transform coefficient matrix, and then quantization is performed to obtain the final transform coefficient matrix. From the decoding end, the final transform coefficient matrix obtained from the bitstream entropy decoding is inversely quantized to obtain the target transform coefficient matrix, and the 4*4 area in the upper left corner of the target transform coefficient matrix is first inversely transformed twice to obtain new transform coefficients, and the new transform coefficients are used to replace the 4*4 transform coefficients in the upper left corner of the target transform coefficient matrix to obtain the initial transform coefficient matrix, and then the initial transform coefficient matrix is inversely transformed using (DCT2, DCT2) to obtain the residual coefficients.
[0340] For chroma components (such as chroma U component and chroma V component), the inverse transformation process at the decoding end is as follows:
[0341] Case 1: If the current block is a chroma intra-frame prediction residual block (ie, chroma component), the width or height of the chroma component is greater than 4, and the value of SecondaryTransformEnableFlag (ie, secondary transform enable flag) is equal to 1 (the value of the secondary transform enable flag is equal to 1, indicating that the sequence level or frame level allows the secondary transform to be enabled), and the value of st_chroma_flag is equal to 1 (the value of st_chroma_flag is equal to 1, indicating that the chroma component is secondary transformed), the following operations are performed on the coefficient matrix:
[0342] 1. Obtain the upper left 4*4 coefficient matrix C from the transformation coefficient matrix: c ij =coeff ij , i = 0 ~ 3, j = 0 ~ 3, in the above formula, c ij is the element of matrix C, coeff ij is an element of the transform coefficient matrix. Exemplarily, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4*4 region located at the upper left corner in the target transform coefficient matrix.
[0343] 2. Perform the following horizontal inverse transformation on the coefficient matrix C: ij =Clip3(-32768,32767,(p ij +2 6 )>>7), i=0~3, j=0~3. p ij It is an element of the 4*4 matrix P. The calculation method of matrix P is as follows: P = C × S 4 , S 4It is a 4*4 inverse transformation matrix, Clip3(-32768, 32767, (p ij +2 6 )>>7) means that if c ij If the value of is between -32768 and 32767, then c ij The value of (p ij +2 6 )>>7, if c ij If the value of is less than -32768, then c ij The value of c is -32768. ij If the value of is greater than 32767, then c ij The value of is 32767. Exemplarily, after performing horizontal inverse transformation on the coefficient matrix C, a horizontal inverse transformation matrix is obtained.
[0344] 3. Perform the following vertical inverse transformation on the horizontal inverse transformation matrix: ij =Clip3(-32768,32767,(q ij +2 6 )>>7), i=0~3, j=0~3. q ij are the elements of the 4×4 matrix Q, which is calculated as follows: Q = S 4 T ×C,S 4 T YesS 4 The transposed matrix, S 4 It is a 4*4 inverse transformation matrix. The vertical inverse transformation matrix is obtained by vertically inverse transforming the horizontal inverse transformation matrix.
[0345] 4. Modify the value of the element of the target transformation coefficient matrix according to the vertical inverse transformation moment: coeff ij =c ij , i = 0 to 3, j = 0 to 3. That is, the transform coefficients of the 4*4 area located in the upper left corner of the target transform coefficient matrix are replaced based on the vertical inverse transform matrix.
[0346] Case 2: If the current block is a chroma intra prediction residual block, the width and height of the chroma component are both equal to 4, the value of SecondaryTransformEnableFlag is equal to 1, and the value of st_chroma_flag is equal to 1, then:
[0347] 1. Perform the following vertical inverse transformation on the transformation coefficient matrix to obtain the matrix 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, and k ij is an element of matrix K. Matrix V is calculated as follows: V = D 4 T × CoeffMatrix, where D 4 T is the transpose matrix of the inverse transform matrix D 4 and CoeffMatrix is the transform coefficient. Exemplarily, after performing a vertical inverse transform on the target transform coefficient matrix, the obtained matrix K is the vertical inverse transform matrix.
[0348] 2. Perform the following horizontal inverse transform on matrix K to obtain matrix H: h ij = Clip3(-MaxValue - 1, MaxValue, (w ij + 2 shift1-1 ) >> shift1), where i = 0 to M 1 - 1, j = 0 to M 2 - 1, and w i,j is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, shift1 is equal to 22 - BitDepth, and matrix W is: W = K × D 4 , where D 4 is the inverse transform matrix. Exemplarily, after performing a horizontal inverse transform on the vertical inverse transform matrix, the obtained matrix H is the horizontal inverse transform matrix, and the initial transform coefficient matrix can be determined based on matrix H, that is, directly determining matrix H as the initial transform coefficient matrix.
[0349] Exemplarily, for a 4 * 4 block, no initial inverse transform is required after performing the secondary inverse transform.
[0350] Example 11: Based on Examples 8 and 10, for chrominance components (such as chrominance U component and chrominance V component), during the secondary inverse transform process, it is also possible to decide whether to perform horizontal and vertical inverse transforms based on the chrominance of the current block for the prediction mode. On this basis, the inverse transform process at the decoding end is as follows:
[0351] Case 1: If the current block is a chrominance intra - prediction residual block, the width or height value of the chrominance component is greater than 4, and the value of SecondaryTransformEnableFlag is equal to 1, and st_chroma_flag is equal to 1, perform the following operations on the coefficient matrix:
[0352] 1. Obtain the top - left 4 * 4 coefficient matrix C from the transform coefficient matrix: c ij = coeff ij, i = 0 ~ 3, j = 0 ~ 3, in the above formula, c ij is the element of matrix C, coeff ij is an element of the transform coefficient matrix. Exemplarily, the coefficient matrix C is a coefficient matrix determined based on the transform coefficients of the 4*4 region located at the upper left corner in the target transform coefficient matrix.
[0353] 2. If the value of IntraChromaPredMode is 0 to 2 or 4 to 6 or 8 to 9 or 11 to 12 or 14 to 15, perform the following horizontal inverse transformation on the coefficient matrix C: ij =Clip3(-32768,32767,(p ij +2 6 )>>7), i=0~3, j=0~3. p ij It is an element of the 4*4 matrix P. The calculation method of matrix P is as follows: P = C × S 4 , S 4 is a 4*4 inverse transformation matrix. Exemplarily, the horizontal inverse transformation matrix is obtained after the coefficient matrix C is horizontally inversely transformed. The value of IntraChromaPredMode is 0 to 2 or 4 to 6 or 8 to 9 or 11 to 12 or 14 to 15, indicating that the mode number of the chroma intra prediction mode is in the first mode number interval.
[0354] 3. If the value of IntraChromaPredMode is 0 to 1 or 3 to 5 or 7 to 8 or 10 to 11 or 13 to 14 or 16, perform the following vertical inverse transform on the coefficient matrix: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7), i=0~3, j=0~3. q ij are the elements of the 4×4 matrix Q, which is calculated as follows: Q = S 4 T ×C,S 4 T YesS 4 The transposed matrix, S 4 It is a 4*4 inverse transformation matrix. After vertical inverse transformation of the coefficient matrix, what is obtained is the vertical inverse transformation matrix. The value of IntraChromaPredMode is 0~1 or 3~5 or 7~8 or 10~11 or 13~14 or 16, indicating that the mode number of the chrominance intra-frame prediction mode is in the second mode number interval. Exemplarily, if before step 3, the coefficient matrix C has not been horizontally inverse transformed, then in step 3, the coefficient matrix C is directly vertically inverse transformed. If before step 3, the coefficient matrix C has been horizontally inverse transformed to obtain a horizontal inverse transformation matrix, then in step 3, the horizontal inverse transformation matrix is vertically inverse transformed.
[0355] 4. Modify the values of the elements of the target transformation coefficient matrix according to the coefficient matrix: coeff ij =c ij , i=0~3, j=0~3. Exemplarily, if only the coefficient matrix C is subjected to horizontal inverse transformation to obtain a horizontal inverse transformation matrix, and the horizontal inverse transformation matrix is not subjected to vertical inverse transformation, the horizontal inverse transformation matrix is used to modify the values of the elements of the target transformation coefficient matrix. If only the coefficient matrix C is subjected to vertical inverse transformation to obtain a vertical inverse transformation matrix, and the coefficient matrix C is not subjected to horizontal inverse transformation, the vertical inverse transformation matrix is used to modify the values of the elements of the target transformation coefficient matrix. If the coefficient matrix C is first 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 vertical inverse transformation matrix (i.e., the matrix after horizontal inverse transformation and vertical inverse transformation) is used to modify the values of the elements of the target transformation coefficient matrix.
[0356] Case 2: If the current block is a chroma intra prediction residual block, the width and height of the chroma component are both equal to 4, the value of SecondaryTransformEnableFlag is equal to 1, and the value of st_chroma_flag is equal to 1, then:
[0357] 1. Perform the following vertical inverse transformation on the transformation coefficient matrix to obtain the matrix K: k ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1, j = 0 ~ M 2 -1, v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows: V = D 4 T ×CoeffMatrix,D 4 T is the inverse transformation matrix D 4 The transposed matrix of , CoeffMatrix is the transformation coefficient. Exemplarily, after the target transformation coefficient matrix is vertically inversely transformed, the obtained matrix K is the vertical inverse transformation matrix.
[0358] 2. Perform the following horizontal inverse transformation on the matrix K to obtain the matrix H: ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1), i=0~M 1 -1, j = 0 ~ M 2 -1,wi,j is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, shift1 is equal to 22 - BitDepth, and matrix W is: W = K × D 4 , D 4 is an inverse transformation matrix. Exemplarily, after horizontally inverse-transforming the vertical inverse transformation matrix, the obtained matrix H is a horizontal inverse transformation matrix, and the initial transformation coefficient matrix can be determined based on matrix H, that is, directly determining matrix H as the initial transformation coefficient matrix.
[0359] Exemplarily, for a 4 * 4 block, no initial inverse transformation is required after the second inverse transformation.
[0360] Embodiment 12: The chrominance U component and the chrominance V component use different second transformation flag bits. The second transformation flag bit of the chrominance U component is the U component second transformation flag bit, which is denoted as st_cb_flag, and the second transformation flag bit of the chrominance V component is the V component second transformation flag bit, which is denoted as st_cr_flag.
[0361] The decoding process at the decoding end includes: If the current block meets parsing condition 3 (i.e., the first preset condition), then parse 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 does not undergo the second inverse transformation. When st_cb_flag is equal to 1, it means that the chrominance U component undergoes the second inverse transformation. If the chrominance U component undergoes the second inverse transformation, perform the second inverse transformation on the upper left 4 * 4 region of the target transformation coefficient matrix corresponding to the chrominance U component, and update the transformation coefficients of the upper left 4 * 4 region to obtain the initial transformation coefficient matrix corresponding to the chrominance U component, and then perform the initial inverse transformation on the initial transformation coefficient matrix corresponding to the chrominance U component to obtain the residual coefficient matrix corresponding to the chrominance U component. If the chrominance U component does not undergo the second inverse transformation, directly perform the initial inverse transformation on the target transformation coefficient matrix corresponding to the chrominance U component to obtain the residual coefficient matrix corresponding to the chrominance U component. Based on the residual coefficient matrix corresponding to the chrominance U component, obtain the reconstructed block corresponding to the chrominance U component.
[0362] If the current block satisfies parsing condition 4 (i.e., the first preset condition), st_cr_flag is parsed from the coded bit stream of the current block. When st_cr_flag is equal to 0, it indicates that the chroma V component does not undergo a secondary inverse transform, and when st_cr_flag is equal to 1, it indicates that the chroma V component undergoes a secondary inverse transform. If the chroma V component undergoes a secondary inverse transform, a secondary inverse transform is performed on the 4*4 area in the upper left corner of the target transform coefficient matrix corresponding to the chroma V component, and the transform coefficient of the 4*4 area in the upper left corner is updated to obtain the initial transform coefficient matrix corresponding to the chroma V component, and then the initial transform coefficient matrix corresponding to the chroma V component is initially inversely transformed to obtain the residual coefficient matrix corresponding to the chroma V component. If the chroma V component does not undergo a secondary inverse transform, the initial inverse transform is directly performed on the target transform coefficient matrix corresponding to the chroma V component to obtain the residual coefficient matrix corresponding to the chroma V component. Based on the residual coefficient matrix corresponding to the chroma V component (i.e., the residual block), the reconstructed block corresponding to the chroma V component is obtained.
[0363] Exemplarily, parsing condition 3 may include: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients, such as cbf_u is 1. Parsing condition 4 may include: the prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients, such as cbf_v is 1. Parsing condition 3 and parsing condition 4 may also include optional parsing conditions, and these optional parsing conditions refer to the first preset condition of embodiment 1, which will not be repeated here.
[0364] The encoding process of the encoding end includes: if the current block meets the analysis condition 5, the encoding end decides through RDO whether to perform a secondary transformation on the chroma U component or to perform a secondary transformation. If it is decided not to perform a secondary transformation on the chroma U component, the residual coefficient matrix corresponding to the chroma U component is directly initially transformed to obtain the initial transformation coefficient matrix corresponding to the chroma U component, and the initial transformation coefficient matrix corresponding to the chroma U component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma U component. The final transformation coefficient matrix corresponding to the chroma U component is encoded in the encoded bit stream, and st_cb_flag is encoded as 0 in the encoded bit stream. If it is decided to perform a secondary transform on the chroma U component, then the residual coefficient matrix corresponding to the chroma U component is initially transformed to obtain the initial transform coefficient matrix corresponding to the chroma U component, the 4*4 transform coefficients in the upper left corner of the initial transform coefficient matrix corresponding to the chroma U component are secondary transformed to obtain the target transform coefficient matrix corresponding to the chroma U component, the target transform coefficient matrix corresponding to the chroma U component is quantized to obtain the final transform coefficient matrix corresponding to the chroma U component, the final transform coefficient matrix corresponding to the chroma U component is encoded in the coded bit stream, and st_cb_flag is encoded as 1 in the coded bit stream.
[0365] If the current block meets the analysis condition 6, the encoder can also decide whether to perform a secondary transformation on the chroma V component or perform a secondary transformation through RDO. If it is decided not to perform a secondary transformation on the chroma V component, the residual coefficient matrix corresponding to the chroma V component is directly transformed initially to obtain the initial transformation coefficient matrix corresponding to the chroma V component, and the initial transformation coefficient matrix corresponding to the chroma V component is quantized to obtain the final transformation coefficient matrix corresponding to the chroma V component. The final transformation coefficient matrix corresponding to the chroma V component is encoded in the coded bit stream of the current block, and st_cr_flag is encoded as 0 in the coded bit stream. If it is decided to perform a secondary transform on the chroma V component, then the residual coefficient matrix corresponding to the chroma V component is initially transformed to obtain the initial transform coefficient matrix corresponding to the chroma V component, the 4*4 transform coefficients in the upper left corner of the initial transform coefficient matrix corresponding to the chroma V component are secondary transformed to obtain the target transform coefficient matrix corresponding to the chroma V component, the target transform coefficient matrix corresponding to the chroma V component is quantized to obtain the final transform coefficient matrix corresponding to the chroma V component, the final transform coefficient matrix corresponding to the chroma V component is encoded in the coded bit stream of the current block, and st_cr_flag is encoded as 1 in the coded bit stream.
[0366] Exemplarily, parsing condition 5 may include: the prediction mode of the current block is an intra-frame prediction mode, and the final transform coefficient matrix corresponding to the chrominance U component contains non-zero transform coefficients. Parsing condition 6 may include: the prediction mode of the current block is an intra-frame prediction mode, and the final transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients. Parsing condition 5 and parsing condition 6 may also include optional parsing conditions, and these optional parsing conditions refer to the second preset condition of embodiment 3.
[0367] Embodiment 13: On the basis of st_cb_flag in Embodiment 12, the encoding end encodes st_cb_flag using a context-based binary arithmetic coding method, and the decoding end decodes st_cb_flag using a context-based binary arithmetic decoding method. Alternatively, the encoding end encodes st_cb_flag using a bypass coding method, and the decoding end decodes st_cb_flag using a bypass decoding method. If a context-based binary arithmetic coding method or a decoding method is adopted, the context model can also be pre-configured. For example, a separate context model is pre-configured, and the context model serves as the target context model for all chrominance U components. For another example, at least two context models based on the chrominance intra-frame prediction mode are pre-configured, and these context models may all serve as target context models. For another example, at least two context models based on the size of the chrominance component of the current block are pre-configured, and these context models may all serve as target context models.
[0368] Exemplarily, regarding the configuration method of the context model, and the encoding and decoding methods of st_cb_flag, please refer to Example 9, and replace st_chroma_flag with st_cb_flag. It will not be repeated in this Example 13.
[0369] On the basis of st_cr_flag in Example 12, the encoding end encodes st_cr_flag using a context-based binary arithmetic coding method, and the decoding end decodes st_cr_flag using a context-based binary arithmetic decoding method. Alternatively, the encoding end encodes st_cr_flag using a bypass coding method, and the decoding end decodes st_cr_flag using a bypass decoding method. If a context-based binary arithmetic coding method or a decoding method is adopted, the context model can also be pre-configured. For example, a separate context model is pre-configured, and the context model serves as the target context model for all chrominance V components. For another example, at least two context models based on the chrominance intra-frame prediction mode are pre-configured, and these context models may all serve as target context models. For another example, at least two context models based on the size of the chrominance component of the current block are pre-configured, and these context models may all serve as target context models.
[0370] Exemplarily, regarding the configuration method of the context model, and the encoding and decoding methods of st_cr_flag, please refer to Example 9, and replace st_chroma_flag with st_cr_flag. It will not be repeated in this Example 13.
[0371] Example 14: On the basis of Example 12, for the chroma U component, the inverse transformation process at the decoding end is similar to the inverse transformation process of Example 10 or Example 11, and the condition of Case 1 of Example 10 or Example 11 is replaced by "If the current block is a chroma intra-frame 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 SecondaryTransformEnableFlag is equal to 1, and the current chroma component is a chroma U component and the value of st_cb_flag is equal to 1", and the condition of Case 2 of Example 10 or Example 11 is replaced by "If the current block is a chroma intra-frame prediction residual block, the values of the width and height of the chroma component are both equal to 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the current chroma component is a chroma U component and the value of st_cb_flag is equal to 1". The specific inverse transformation process is the same as Case 1 and Case 2 of Example 10 or Example 11, and will not be repeated here.
[0372] Similarly, on the basis of Example 12, for the chroma V component, the inverse transformation process at the decoding end is similar to the inverse transformation process of Example 10 or Example 11, and the condition of Case 1 of Example 10 or Example 11 is replaced by "If the current block is a chroma intra-frame 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 SecondaryTransformEnableFlag is equal to 1, and the current chroma component is a chroma V component and the value of st_cr_flag is equal to 1", and the condition of Case 2 of Example 10 or Example 11 is replaced by "If the current block is a chroma intra-frame prediction residual block, the values of the width and height of the chroma component are both equal to 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the current chroma component is a chroma V component and the value of st_cr_flag is equal to 1". The specific inverse transformation process is the same as Case 1 and Case 2 of Example 10 or Example 11, and will not be repeated here.
[0373] Embodiment 15: The luminance component, the chrominance U component and the chrominance V component share a secondary transformation flag, which may be a luminance chrominance secondary transformation flag, and the luminance chrominance secondary transformation flag is recorded as st_tu_flag.
[0374] The decoding process of the decoding end includes: if the current block meets the parsing condition 7 (i.e., the third preset condition), then parse st_tu_flag from the coded bit stream of the current block. When st_tu_flag is equal to 0, it means that the luminance component, the chrominance U component, and the chrominance V component are not subjected to secondary inverse transformation. When st_tu_flag is equal to 1, it means that the luminance component, the chrominance U component, and the chrominance V component are subjected to secondary inverse transformation at the same time. Exemplarily, if the luminance component, the chrominance U component, and the chrominance V component are subjected to secondary inverse transformation at the same time, the upper left 4*4 area of the target transformation coefficient matrix corresponding to the luminance component is subjected to secondary inverse transformation, and the transformation coefficient of the upper left 4*4 area is updated to obtain the initial transformation coefficient matrix corresponding to the luminance component, and then the initial transformation coefficient matrix corresponding to the luminance component is subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the luminance component. Similarly, the residual coefficient matrix corresponding to the chrominance U component and the 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 do not undergo secondary inverse transformation, the target transformation coefficient matrix corresponding to the luminance component is directly subjected to initial inverse transformation to obtain the residual coefficient matrix corresponding to the luminance component. Similarly, the residual coefficient matrix corresponding to the chrominance U component and the residual coefficient matrix corresponding to the chrominance V component can be obtained. Then, the reconstructed block of the current block can 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.
[0375] Exemplarily, parsing condition 7 may include: the prediction mode of the current block is the intra-frame prediction mode, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients, and / or the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, for example, cbf_y is 1 or cbf_u is 1 or cbf_v is 1, and cbf_y is 1 to indicate that the final transform coefficient matrix corresponding to the luminance component contains non-zero transform coefficients. Parsing condition 7 may also include optional parsing conditions, which refer to the third preset conditions of embodiment 5 and are not repeated here.
[0376] The encoding process of the encoding end includes: if the current block meets the analysis condition 8 (i.e., the fourth preset condition), the encoding end decides through RDO not to perform secondary transformation on the luminance component, chrominance U component, and chrominance V component of the current block, or performs secondary transformation on the luminance component, chrominance U component, and chrominance V component of the current block at the same time. If the decision is not to perform secondary transformation on the luminance component, chrominance U component, and chrominance V component, the encoding end directly performs an initial transformation on the residual coefficient matrix (i.e., residual block) corresponding to the luminance component to obtain the initial transformation coefficient matrix corresponding to the luminance component, and quantizes the initial transformation coefficient matrix corresponding to the luminance component to obtain the final transformation coefficient matrix corresponding to the luminance component. Similarly, the final transformation coefficient matrix corresponding to the chrominance U component and the final transformation coefficient matrix corresponding to the chrominance V component can be obtained. The encoding end encodes the final transformation coefficient matrix corresponding to the luminance component, the final transformation coefficient matrix corresponding to the chrominance U component, and the final transformation coefficient matrix corresponding to the chrominance V component in the coded bit stream of the current block, and encodes st_tu_flag equal to 0 in the coded bit stream.
[0377] If it is decided to perform secondary transformation on the luma component, chroma U component and chroma V component at the same time, the residual coefficient matrix corresponding to the luma component is initially transformed to obtain the initial transformation coefficient matrix corresponding to the luma component, the 4*4 transformation coefficients in the upper left corner of the initial transformation coefficient matrix corresponding to the luma component are secondary transformed to obtain the target transformation coefficient matrix corresponding to the luma component, and the target transformation coefficient matrix corresponding to the luma component is quantized to obtain the final transformation coefficient matrix corresponding to the luma component. Similarly, the final transformation coefficient matrix corresponding to the chroma U component and the final transformation coefficient matrix corresponding to the chroma V component can be obtained. The final transformation coefficient matrix corresponding to the luma component, the final transformation coefficient matrix corresponding to the chroma U component and the final transformation coefficient matrix corresponding to the chroma V component are encoded in the coded bit stream, and st_tu_flag is encoded as 1 in the coded bit stream.
[0378] Exemplarily, parsing condition 8 may include: the prediction mode of the current block is an intra-frame prediction mode, and the initial transform coefficient matrix corresponding to the luminance component or the initial transform coefficient matrix corresponding to the chrominance U component or the initial transform coefficient matrix corresponding to the chrominance V component contains non-zero transform coefficients. Parsing condition 8 may also include optional parsing conditions, which refer to the fourth preset condition of embodiment 6 and are not repeated here.
[0379] Example 16: Based on the st_tu_flag of Example 15, the encoding end may encode the st_tu_flag using a context-based binary arithmetic coding method, and the decoding end may decode the st_tu_flag using a context-based binary arithmetic decoding method. Alternatively, the encoding end may encode the st_tu_flag using a bypass coding method, and the decoding end may decode the st_tu_flag using a bypass decoding method. If a context-based binary arithmetic coding method or a decoding method is used, the context model may also be pre-configured. For example, a separate context model may be pre-configured, and the context model serves as the target context model for all luminance components and chrominance components. For another example, at least two context models based on the size of the current block may be pre-configured, and these context models may all serve as target context models.
[0380] Regarding the configuration method of the context model, and the encoding and decoding methods of st_tu_flag, please refer to Example 9, and replace st_chroma_flag with st_tu_flag. It will not be repeated in this Example 13.
[0381] Example 17: On the basis of Example 10, for chroma components (such as chroma U component and chroma V component), the inverse transformation process at the decoding end is consistent with the inverse transformation process of Example 10. For luminance components, the condition of Case 1 of Example 10 is replaced by "If the current block is an intra-frame luminance prediction residual block, the value of the width or height of the current block is greater than 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the value of est_tu_flag is equal to 1", and the condition of Case 2 of Example 10 is replaced by "If the current block is an intra-frame luminance prediction residual block, the values of the width and height of the current block are both equal to 4, and the value of SecondaryTransformEnableFlag is equal to 1, and the value of est_tu_flag is equal to 1". The specific inverse transformation process is the same as Case 1 and Case 2 of Example 10, and will not be repeated here.
[0382] In a possible implementation manner, for the current block, including a luminance component and a chrominance component (such as a chrominance U component and a chrominance V component), in this case, the inverse transformation process at the decoding end is as follows:
[0383] a) If the current block is an intra-frame prediction residual block, M 1 or M 2 If the value of is greater than 4 and the value of SecondaryTransformEnableFlag is equal to 1, the following operations are performed on CoeffMatrix:
[0384] 1) Obtain a 4×4 matrix C from the transform coefficient matrix:
[0385] c ij =coeff ij ,i=0~3,j=0~3
[0386] Where c ij is the element of matrix C, coeff ij are the elements of the transform coefficient matrix.
[0387] 2) If the current block meets one of the following conditions:
[0388] Condition 1: The current block is a luma prediction residual block, EstEnableFlag is non-zero and the value of TransformSplitDirection of the current block is 0 and the value of EstTuFlag is equal to 1, or EstEnableFlag is 0 and the value of IntraLumaPredMode is 0 to 2 or 13 to 32 or 44 to 65, and the reference sample with coordinates (x0-1, y0+j-1) (j=1 to N) is "available";
[0389] Condition 2: the current block is a chroma prediction residual block, and the value of st_chroma_flag is equal to 1 (the value of st_chroma_flag is equal to 1, indicating that a secondary transformation is performed on the chroma component).
[0390] Then: c ij =Clip3(-32768,32767,(p ij +2 6 )>>7),i=0~3,j=0~3
[0391] Where p ij are the elements of the 4×4 matrix P. The matrix P is calculated as follows:
[0392] P=C×S 4
[0393] Where S 4 is the 4×4 inverse transform matrix.
[0394] 3) If the current block meets one of the following conditions:
[0395] Condition 1: The current block is a luma prediction residual block. If EstEnableFlag is non-zero and the value of TransformSplitDirection of the current block is 0 and the value of EstTuFlag is equal to 1, or EstEnableFlag is 0 and the value of IntraLumaPredMode is 0 to 23 or 34 to 57, and the reference sample with coordinates (x0+i-1, y0-1) (i=1 to M) is "available";
[0396] Condition 2: the current block is a chroma prediction residual block, and the value of st_chroma_flag is equal to 1 (the value of st_chroma_flag is equal to 1, indicating that a secondary transformation is performed on the chroma component).
[0397] Then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7),i=0~3,j=0~3
[0398] Where q ij are the elements of the 4×4 matrix Q. The matrix Q is calculated as follows:
[0399] Q=S 4 T ×C
[0400] Where S 4 T YesS 4 The transpose of .
[0401] 4) Modify the values of the elements of the transform coefficient matrix according to the matrix C:
[0402] coeff ij =c ij ,i=0~3,j=0~3
[0403] b) Perform the following vertical inverse transformation on the transform coefficient matrix to obtain the matrix K:
[0404] 1) If the current block is an intra-frame prediction residual block, M 1 and M 2 The value of is equal to 4 and the value of SecondaryTransformEnableFlag is equal to 1, and one of the following conditions is met:
[0405] Condition 1: The current block is a luminance prediction residual block, and EstEnableFlag is 0 or EstEnableFlag is non-zero and the value of EstTuFlag is equal to 1;
[0406] Condition 2: the current block is a chroma prediction residual block, and the value of st_chroma_flag is equal to 1 (the value of st_chroma_flag is equal to 1, indicating that a secondary transformation is performed on the chroma component).
[0407] Then: k ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1,j=0~M 2 -1
[0408] Where v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows:
[0409] V=D 4 T ×CoeffMatrix
[0410] Where D 4 T is the inverse transformation matrix D 4 The transposed matrix of .
[0411] 2) Otherwise, determine the values of PbtCuFlag, SbtCuFlag, SbtDirFlag, and SbtPosFlag.
[0412] First, if the value of PbtCuFlag is 1 and the sequence number of the transform block is 0, 1, 2, or 3:
[0413] k ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1,j=0~M 2 -1
[0414] Where v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows:
[0415] If the transform block sequence number is 0 or 1:
[0416] V=DCT8 M2 T ×CoeffMatrix
[0417] Where DCT8 M2 T It is DCT8 M2 The transposed matrix, DCT8M2 It is M 2 ×M 2 Inverse transformation matrix.
[0418] Otherwise, if the transform block sequence number is 2 or 3: Then
[0419] V=DST7 M2 T ×CoeffMatrix
[0420] Where DST7 M2 T It is DST7 M2 The transposed matrix, DST7 M2 It is M 2 ×M 2 Inverse transformation matrix.
[0421] 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:
[0422] k ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1,j=0~M 2 -1
[0423] Where v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows:
[0424] If SbtDirFlag is 1 and SbtPosFlag is 0: Then
[0425] V=DCT8 M2 T ×CoeffMatrix
[0426] Where DCT8 M2 T It is DCT8 M2 The transposed matrix, DCT8 M2 It is M 2 ×M 2 Inverse transformation matrix.
[0427] otherwise:
[0428] V=DST7 M2 T ×CoeffMatrix
[0429] Where DST7 M2T It is DST7 M2 The transposed matrix, DST7 M2 It is M 2 ×M 2 Inverse transformation matrix.
[0430] Third, otherwise:
[0431] k ij =Clip3(-32768,32767,(v ij +2 4 )>>5), i=0~M 1 -1,j=0~M 2 -1
[0432] Where v ij is the element of matrix V, k ij are the elements of the matrix K. The matrix V is calculated as follows:
[0433] V=DCT2 M2 T ×CoeffMatrix
[0434] Where DCT2 M2 T It is DCT2 M2 The transposed matrix, DCT2 M2 It is M 2 ×M 2 Inverse transformation matrix.
[0435] c) Perform the following horizontal inverse transformation on the matrix K to obtain the matrix H:
[0436] 1) If the current transform block is an intra-frame prediction residual block, M 1 and M 2 The value of is equal to 4 and the value of SecondaryTransformEnableFlag is equal to 1, and one of the following conditions is met:
[0437] Condition 1: The current block is a luminance prediction residual block, and EstEnableFlag is 0 or EstEnableFlag is non-zero and the value of EstTuFlag is equal to 1;
[0438] Condition 2: the current block is a chroma prediction residual block, and the value of st_chroma_flag is equal to 1 (the value of st_chroma_flag is equal to 1, indicating that a secondary transformation is performed on the chroma component).
[0439] but:
[0440] h ij =Clip3(-MaxValue-1,MaxValue,(wij +2 shift1-1 ) >> shift1), i = 0 to M 1 -1, j = 0 to M 2 -1 where w i,j is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, and shift1 is equal to 22 - BitDepth. The calculation of matrix W is as follows:
[0441] W = K × D 4
[0442] where D 4 is the inverse transform matrix.
[0443] 2) Otherwise, judge the values of PbtCuFlag, SbtCuFlag, SbtDirFlag, and SbtPosFlag
[0444] First, if the value of PbtCuFlag is 1 and the sequence number of the transform block is 0, 1, 2, or 3:
[0445] h ij = Clip3(-MaxValue - 1, MaxValue, (w ij + 2 shift1-1 ) >> shift1) i = 0 to M 1 -1, j = 0 to M 2 -1 where w ij is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, and shift1 is equal to 20 - BitDepth. The calculation of matrix W is as follows:
[0446] If the sequence number of the transform block is 0 or 2: then
[0447] W = K × DCT8 M1
[0448] Otherwise, if the sequence number of the transform block is 1 or 3: then
[0449] W = K × DST7 M1
[0450] where DCT8 M1 , DST7 M1 is an M 1 × M 1 inverse transform matrix.
[0451] 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:
[0452] h ij = Clip3(-MaxValue - 1, MaxValue, (w ij + 2 shift1-1 )) >> shift1) for i = 0 to M 1 - 1, j = 0 to M 2 - 1 where w ij is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, and shift1 is equal to 20 - BitDepth. The calculation of matrix W is as follows:
[0453] If SbtDirFlag is 0 and SbtPosFlag is 0: Then
[0454] W = K × DCT8 M1
[0455] Otherwise:
[0456] W = K × DST7 M1
[0457] where DCT8 M1 and DST7 M1 are M 1 × M 1 inverse transform matrices.
[0458] Third, otherwise:
[0459] h ij = Clip3(-MaxValue - 1, MaxValue, (w ij + 2 shift1-1 )) >> shift1) for i = 0 to M 1 - 1, j = 0 to M 2 - 1 where w ij is an element of matrix W, and h ij is an element of matrix H. The value of MaxValue is (1 << BitDepth) - 1, and shift1 is equal to 20 - BitDepth. The calculation of matrix W is as follows:
[0460] W = K × DCT2 M1
[0461] where DCT2 M1 is M 1 × M 1 inverse transform matrix.
[0462] d) Use the matrix H directly as the residual sample matrix ResidueMatrix to end the inverse transform operation.
[0463] Embodiment 18: For an improved intra prediction (IIP) mode, if it is determined to perform IIP on the current block, the luminance component and the chrominance component of the current block are respectively performed IIP, including:
[0464] 1. If the prediction mode of the luminance component or chrominance component of the current block is the angular intra prediction mode:
[0465] Luminance component: Use an 8-tap interpolation filter to generate sub-pixel reference pixels, and when MIPF is enabled, use 3 types of 8-tap filters, the filter index value is implicitly derived based on the size of the current block and the row and column index numbers. The filter index is derived using the following formula: filter_idx = mipf_enable_flag? (j<1?((w*h<64)+1:w*h<64)):3. j represents the index number of the column where the current pixel is located, and w and h represent the width and height of the current luminance component, respectively.
[0466] Chroma component: Use an 8-tap interpolation filter to generate sub-pixel reference pixels. When MIPF is enabled, use 3 types of 8-tap filters. The filter index value is implicitly derived based on the size of the current block and the row and column index numbers. The filter index is derived using the following formula: filter_idx = mipf_enable_flag? (j<2?((w*h<32)+1:w*h<32)):3. j represents the index number of the column where the current pixel is located, and w and h represent the width and height of the current chroma component, respectively.
[0467] 2. If the prediction mode of the luminance component or chrominance component of the current block is DC mode:
[0468] For the luminance component and the chrominance component, the following operations are performed: the pixels inside the current block and the pixels near the boundary have different prediction values. For the internal pixels (not the pixels in the first two rows or columns), the traditional DC value is still used; for the pixels near the boundary (the pixels in the first two rows or columns), as shown in Figure 1G and Figure 1H As shown, the weighted average of (DC value and reference pixel value) is used as the final prediction value, and the luminance and chrominance have their own reference pixels.
[0469] For example, see Figure 1GAs shown in the figure, if the current pixel is located at position a in the first row, the weighted average of reference pixels A0, A1, A2 and DC is used as the prediction value of position a; if the current pixel is located at position b in the first column, the weighted average of reference pixels B0, B1, B2 and DC is used as the prediction value of position b; if the current pixel is located at position c in the upper left corner of the current block, the weighted average of reference pixels C0, C1, C2, C3, C4 and DC is used as the prediction value of position c. Figure 1H As shown, if the current pixel is located at position d in the second row, the weighted average of reference pixels D and DC is used as the prediction value of position d; if the current pixel is located at position e in the second column, the weighted average of reference pixels E and DC is used as the prediction value of position e; if the current pixel is located at position f in the upper left corner of the current block, the weighted average of reference pixels F0, F1 and DC is used as the prediction value of position f.
[0470] The weights of positions a, b, c, d, e, and f are shown in Table 4, and the last weight may be the weight of the DC value.
[0471] 3. If the prediction mode of the luminance component or chrominance component of the current block is Plane mode:
[0472] For the luminance component and chrominance component, the following operations are performed: the internal pixels of the current block and the pixels near the boundary have different prediction values. For the internal pixels (not the pixels in the first two rows or columns), the plane prediction value is still used; for the pixels near the boundary (the pixels in the first two rows or columns), the weighted average of (plane prediction value and reference pixel value) is used as the final prediction value. Luminance and chrominance have their own reference pixels, and the specific weights are consistent with the improved DC mode.
[0473] 4. If the prediction mode of the luminance component or chrominance component of the current block is Bilinear mode:
[0474] For the luminance component and chrominance component, the following operations are performed: replace the original reference pixel value with the weighted average of 5 reference pixels, and the weights of the 5 reference pixels are: {82, 252, 356, 252, 82}. Luminance and chrominance have their own reference pixels. Then the bilinear prediction process is performed.
[0475] Of course, the above-mentioned embodiments 1 to 18 can be implemented separately or in combination. For example, each embodiment can be implemented separately, embodiment 1 and embodiment 3 can be implemented in combination, embodiment 2 and embodiment 4 can be implemented in combination, embodiment 5 and embodiment 6 can be implemented in combination, embodiment 8 and embodiment 9 can be implemented in combination, embodiment 8 and embodiment 10 can be implemented in combination, embodiment 8 and embodiment 11 can be implemented in combination, embodiment 8, embodiment 9 and embodiment 10 can be implemented in combination, embodiment 8, embodiment 9 and embodiment 11 can be implemented in combination, embodiment 12 and embodiment 13 can be implemented in combination, embodiment 12 and embodiment 14 can be implemented in combination, embodiment 12, embodiment 13 and embodiment 14 can be implemented in combination, embodiment 15 and embodiment 16 can be implemented in combination, embodiment 15 and embodiment 17 can be implemented in combination, embodiment 15, embodiment 16 and embodiment 17 can be implemented in combination. Of course, the above are just a few examples, and there is no limitation on the combination of the embodiments.
[0476] Based on the same application concept as the above method, the embodiment of the present application also proposes a decoding device, which is applied to a decoding end, such as Fig. 6A As shown, it is a structural diagram of the device, and the device includes:
[0477] An acquisition module 611 is used to acquire a coded bit stream of a current block;
[0478] A parsing module 612, configured to parse a final transform coefficient matrix corresponding to the chrominance component of the current block from the coded bit stream, and parse a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0479] If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0480] The determination module 613 is used to determine whether to perform a secondary inverse transformation on the chrominance component according to the secondary transformation flag.
[0481] In a possible implementation manner, the first preset condition further includes at least one of the following:
[0482] The current block does not use the intra-frame prediction filtering mode;
[0483] The current block does not use the improved intra prediction mode;
[0484] The current block is initially inversely transformed using a transform kernel (discrete cosine transform DCT2, DCT2);
[0485] The chroma intra prediction mode of the current block meets a preset mode condition;
[0486] The size of the chrominance component of the current block meets a preset size condition;
[0487] The control information allows the current block to use a secondary inverse transform;
[0488] The final transform coefficient matrix contains non-zero transform coefficients at positions other than the position of the upper left corner coordinate (0, 0).
[0489] In a possible implementation manner, the transform coefficient flag includes a chroma U component transform coefficient flag and a chroma V component transform coefficient flag; when the value of the chroma U component transform coefficient flag is a first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients; when the value of the chroma U component transform coefficient flag is a second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component does not contain non-zero transform coefficients; when the value of the chroma V component transform coefficient flag is a first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients; when the value of the chroma V component transform coefficient flag is a second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component does not contain non-zero transform coefficients; wherein the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chroma component contains non-zero transform coefficients, including: the value of the chroma U component transform coefficient flag is a first value, and / or the value of the chroma V component transform coefficient flag is a first value.
[0490] In a possible implementation manner, the chroma components are a chroma U component and a chroma V component, and the secondary transformation flag is a UV component shared secondary transformation flag; when the value of the UV component shared secondary transformation flag is a first value, it is used to indicate that the chroma U component and the chroma V component are both subjected to secondary inverse transformation, or when the value of the UV component shared secondary transformation flag is a second value, it is used to indicate that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation. The determination module 613 determines whether to perform secondary inverse transformation on the chroma component according to the secondary transformation flag, specifically: if the value of the UV component shared secondary transformation flag is a first value, it is determined that the chroma U component and the chroma V component are both subjected to secondary inverse transformation; if the value of the UV component shared secondary transformation flag is a second value, it is determined that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation.
[0491] In a possible implementation, the chrominance components are a chrominance U component and a chrominance V component, and the secondary transformation flag includes a U component secondary transformation flag and a V component secondary transformation flag; when the value of the U component secondary transformation flag is a first value, it is used to indicate that a secondary inverse transformation is performed on the chrominance U component, or, when the value of the U component secondary transformation flag is a second value, it is used to indicate that a secondary inverse transformation is not performed on the chrominance U component; when the value of the V component secondary transformation flag is a first value, it is used to indicate that a secondary inverse transformation is performed on the chrominance V component, or, when the value of the V component secondary transformation flag is a second value, it is used to indicate that a secondary inverse transformation is not performed on the chrominance V component. The determination module 613 is specifically used to determine whether to perform a secondary inverse transformation on the chroma component according to the secondary transformation flag: if the U component secondary transformation flag is a first value, it is determined that the chroma U component is subjected to a secondary inverse transformation; if the U component secondary transformation flag is a second value, it is determined that the chroma U component is not subjected to a secondary inverse transformation; if the V component secondary transformation flag is a first value, it is determined that the chroma V component is subjected to a secondary inverse transformation; if the V component secondary transformation flag is a second value, it is determined that the chroma V component is not subjected to a secondary inverse transformation.
[0492] Based on the same application concept as the above method, the embodiment of the present application also proposes a coding device, which is applied to the coding end, such as Figure 6B As shown, it is a structural diagram of the device, and the device includes:
[0493] An acquisition module 621 is used to acquire a residual coefficient matrix corresponding to the chrominance component of the current block; a processing module 622 is used to perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; a determination module 623 is used to determine whether to perform a secondary transformation on the chrominance component if the current block satisfies a second preset condition; an encoding module 624 is used to encode a secondary transformation flag of a block-level chrominance component in the encoded bit stream of the current block; wherein the secondary transformation flag is used to indicate whether to perform a secondary transformation on the chrominance component, or not to perform a secondary transformation on the chrominance component; wherein the second preset condition includes at least: the prediction mode of the current block is an intra-frame prediction mode, and the initial transformation coefficient matrix corresponding to the chrominance component contains non-zero transformation coefficients.
[0494] In a possible implementation manner, the second preset condition includes at least one of the following:
[0495] The current block does not use the intra-frame prediction filtering mode;
[0496] The current block does not use the improved intra prediction mode;
[0497] The current block is initially transformed using a transform kernel (discrete cosine transform DCT2, DCT2);
[0498] The chroma intra prediction mode of the current block meets a preset mode condition;
[0499] The size of the chrominance component of the current block meets a preset size condition;
[0500] The control information allows the current block to use a secondary transform;
[0501] The positions of the initial transformation coefficient matrix other than the position of the upper left corner coordinate (0, 0) contain non-zero transformation coefficients.
[0502] In a possible implementation, the chroma components are chroma U components and chroma V components, and the secondary transformation flag is a UV component shared secondary transformation flag; when the UV component shared secondary transformation flag is a first value, it is used to indicate that the chroma U component and the chroma V component are simultaneously secondary transformed, or when the UV component shared secondary transformation flag is a second value, it is used to indicate that neither the chroma U component nor the chroma V component is secondary transformed. When the determination module 623 determines whether to perform secondary transformation on the chroma components, it is specifically used to: determine a first generation value when only initial transformation is performed on the chroma U component and the chroma V component; determine a second generation value when the chroma U component and the chroma V component are first initially transformed and then secondary transformed; if the second generation value is less than the first generation value, it is determined that the chroma U component and the chroma V component are simultaneously secondary transformed; if the second generation value is greater than the first generation value, it is determined that neither the chroma U component nor the chroma V component is secondary transformed.
[0503] In a possible implementation, the chrominance components are a chrominance U component and a chrominance V component, and the secondary transformation flag includes a U component secondary transformation flag and a V component secondary transformation flag; when the value of the U component secondary transformation flag is a first value, it is used to indicate that a secondary transformation is performed on the chrominance U component, or, when the value of the U component secondary transformation flag is a second value, it is used to indicate that no secondary transformation is performed on the chrominance U component; when the value of the V component secondary transformation flag is a first value, it is used to indicate that a secondary transformation is performed on the chrominance V component, or, when the value of the V component secondary transformation flag is a second value, it is used to indicate that no secondary transformation is performed on the chrominance V component. When the determination module 623 determines whether to perform a secondary transformation on the chroma component, it is specifically used to: determine the third-generation value when only an initial transformation is performed on the chroma U component; determine the fourth-generation value when the chroma U component is first initially transformed and then a secondary transformation is performed; if the fourth-generation value is less than the third-generation value, determine to perform a secondary transformation on the chroma U component; if the fourth-generation value is greater than the third-generation value, determine not to perform a secondary transformation on the chroma U component; determine the fifth-generation value when only an initial transformation is performed on the chroma V component; determine the sixth-generation value when the chroma V component is first initially transformed and then a secondary transformation is performed; if the sixth-generation value is less than the fifth-generation value, determine to perform a secondary transformation on the chroma V component; if the sixth-generation value is greater than the fifth-generation value, determine not to perform a secondary transformation on the chroma V component.
[0504] In a possible implementation, the encoding module 624 is specifically used to encode the secondary transform flag in the encoded bit stream of the current block: if the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, then encode the secondary transform flag in the encoded bit stream of the current block.
[0505] The decoding end device provided in the embodiment of the present application (the decoding end device may be a video decoder) has a hardware architecture schematic diagram, which can be specifically referred to in Fig. 7A The system comprises: a processor 711 and a machine-readable storage medium 712, wherein the machine-readable storage medium 712 stores machine-executable instructions that can be executed by the processor 711; the processor 711 is used to execute the machine-executable instructions to implement the method disclosed in the above example of the present application.
[0506] For example, the processor is used to execute machine executable instructions to implement the following steps:
[0507] Obtaining a coded bit stream of a current block, parsing a final transform coefficient matrix corresponding to a chrominance component of the current block from the coded bit stream, and parsing a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0508] If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient;
[0509] Whether to perform a secondary inverse transform on the chrominance component is determined according to the secondary transform flag.
[0510] The encoding end device provided in the embodiment of the present application (the encoding end device may be a video encoder) has a hardware architecture diagram, which can be specifically referred to in the following table. Figure 7B The system comprises: a processor 721 and a machine-readable storage medium 722, wherein the machine-readable storage medium 722 stores machine-executable instructions that can be executed by the processor 721; the processor 721 is used to execute the machine-executable instructions to implement the method disclosed in the above example of the present application.
[0511] For example, the processor is used to execute machine executable instructions to implement the following steps:
[0512] Get the residual coefficient matrix corresponding to the chrominance component of the current block;
[0513] Performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component;
[0514] If the current block satisfies a second preset condition, determining whether to perform a secondary transformation on the chrominance component;
[0515] Encoding a secondary transform flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component;
[0516] 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 chrominance component contains non-zero transformation coefficients.
[0517] Based on the same application concept as the above method, a camera device is also provided in an embodiment of the present application. The camera device may include the encoding device and / or decoding device in any of the above embodiments.
[0518] Based on the same application concept as the above method, the embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by the processor, the encoding and decoding method disclosed in the above example of the present application can be implemented. Among them, the above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state hard disk, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0519] Based on the same application concept as the above method, an embodiment of the present application further provides a computer application, which, when executed by a processor, can implement the encoding and decoding method disclosed in the above example of the present application.
[0520] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a tablet computer, a wearable device or a combination of any of these devices.
[0521] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0522] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0523] The present application is described with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that the combination of each flow and / or box in the flow chart and / or block diagram and the flow chart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart or multiple flows and / or one box or multiple boxes of the block diagram. Moreover, these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which realizes the function specified in one flow chart or multiple flows and / or one box or multiple boxes of the block diagram.
[0524] These computer program instructions may also be loaded onto a computer or other programmable data processing device, so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes of the flowchart and / or one or more boxes of the block diagram. The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of the claims of the present application.
Claims
1. A decoding method, characterized in that: Applied to a decoding end, the method comprises: Obtaining a coded bit stream of a current block, parsing a final transform coefficient matrix corresponding to a chrominance component of the current block from the coded bit stream, and parsing a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; Determining whether to perform a secondary inverse transform on the chrominance component according to the secondary transform flag; Dequantizing the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; If the chroma component is subjected to a secondary inverse transformation, the target transformation coefficient matrix is subjected to a secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chroma component; if the chroma component is not subjected to a secondary inverse transformation, the target transformation coefficient matrix is determined as the initial transformation coefficient matrix corresponding to the chroma component; Performing an initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the chrominance component; The reconstructed values of the chrominance components are determined according to the residual coefficient matrix.
2. The method according to claim 1, characterized in that The first preset condition also includes at least one of the following: The current block does not use the intra-frame prediction filtering mode; The current block does not use the improved intra prediction mode; The current block is initially inversely transformed using a transform kernel (discrete cosine transform DCT2, DCT2); 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 current block to use a secondary inverse transform; The final transform coefficient matrix contains non-zero transform coefficients at positions other than the position of the upper left corner coordinate (0, 0).
3. The method according to claim 2, characterized in that The chroma intra prediction mode of the current block satisfies the preset mode condition, including at least one of the following: The chroma intra prediction mode of the current block is not TSCPM mode; The chroma intra prediction mode of the current block is not the PMC mode; The mode number of the chroma intra prediction mode of the current block is mode number 0 to mode number 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.
4. The method according to claim 2, characterized in that: The size of the chrominance component of the current block satisfies the preset size condition, which includes 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 greater than or equal to n3, and the height of the chrominance component is greater than or equal to n4; The product of the width and height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
5. The method according to claim 2, characterized in that: The size of the chrominance component of the current block satisfies the preset size condition, which includes 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 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 height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
6. The method according to claim 2, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes at least one of the following: 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 greater than or equal to n3, and the height of the chrominance component is greater than or equal to n4; The product of the width and height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
7. The method according to claim 2, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes at least one of the following: 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 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 height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
8. The method according to claim 2, characterized in that: The chroma components are chroma U components and chroma V components, and the positions other than the upper left corner coordinate (0, 0) in the final transform coefficient matrix contain non-zero transform coefficients, including one of the following conditions: Condition 1: The final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0), or the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0); Condition 2: The final transform coefficient matrix corresponding to the chroma U component contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0), and the final transform coefficient matrix corresponding to the chroma V component contains non-zero transform coefficients at positions other than the upper left corner coordinate (0, 0); Condition 3: the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance U component are not both 0, or the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance V component are not both 0; Condition 4: the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance U component are not both 0, and the horizontal coordinate and the vertical coordinate of the scanning area corresponding to the chrominance V component are not both 0; The horizontal coordinate of the scanning area corresponding to the chroma U component represents the maximum horizontal coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma U component, and the vertical coordinate of the scanning area corresponding to the chroma U component represents the maximum vertical coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma U component; The horizontal coordinate of the scanning area corresponding to the chroma V component represents the maximum horizontal coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma V component, and the vertical coordinate of the scanning area corresponding to the chroma V component represents the maximum vertical coordinate of all non-zero transformation coefficients in the final transformation coefficient matrix corresponding to the chroma V component.
9. The method according to any one of claims 1 to 8, characterized in that: The transform coefficient flag includes a chroma U component transform coefficient flag and a chroma V component transform coefficient flag; When the value of the chroma U component transform coefficient flag is the first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients; When the value of the chroma U component transform coefficient flag is the second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient; When the value of the chroma V component transform coefficient flag is the first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients; When the value of the chroma V component transform coefficient flag is the second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component does not contain a non-zero transform coefficient; Among them, the transform coefficient flag is used to indicate that the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, including: the value of the chrominance U component transform coefficient flag is a first value, and / or the value of the chrominance V component transform coefficient flag is a first value.
10. The method according to any one of claims 1 to 8, characterized in that: The chroma components are a chroma U component and a chroma V component, and the secondary transformation flag is a secondary transformation flag shared by UV components; When the value of the UV component shared secondary transformation flag is the first value, it is used to indicate that the chroma U component and the chroma V component are simultaneously subjected to secondary inverse transformation, or, when the value of the UV component shared secondary transformation flag is the second value, it is used to indicate that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation.
11. The method according to claim 10, characterized in that The determining whether to perform a secondary inverse transformation on the chrominance component according to the secondary transformation flag bit comprises: If the value of the UV component shared secondary transformation flag is the first value, it is determined that the chroma U component and the chroma V component are simultaneously subjected to secondary inverse transformation; if the value of the UV component shared secondary transformation flag is the second value, it is determined that neither the chroma U component nor the chroma V component is subjected to secondary inverse transformation.
12. The method according to any one of claims 1 to 8, characterized in that: The chrominance components are a chrominance U component and a chrominance V component, and the secondary transformation flag bits include a U component secondary transformation flag bit and a V component secondary transformation flag bit; When the value of the U component secondary transformation flag is a first value, it is used to indicate that the chrominance U component is subjected to a secondary inverse transformation, or when the value of the U component secondary transformation flag is a second value, it is used to indicate that the chrominance U component is not subjected to a secondary inverse transformation; When the value of the V component secondary transformation flag is the first value, it is used to indicate that the chrominance V component is subjected to a secondary inverse transformation, or, when the value of the V component secondary transformation flag is the second value, it is used to indicate that the chrominance V component is not subjected to a secondary inverse transformation.
13. The method according to claim 12, characterized in that The determining whether to perform a secondary inverse transformation on the chrominance component according to the secondary transformation flag bit comprises: If the U component secondary transformation flag is a first value, it is determined that the chrominance U component is subjected to secondary inverse transformation; if the U component secondary transformation flag is a second value, it is determined that the chrominance U component is not subjected to secondary inverse transformation; If the V component secondary transformation flag is a first value, it is determined that the chrominance V component is subjected to a secondary inverse transformation; if the V component secondary transformation flag is a second value, it is determined that the chrominance V component is not subjected to a secondary inverse transformation.
14. The method according to claim 1, characterized in that The performing a secondary inverse transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, determining a coefficient matrix based on the transform coefficients of a designated area located at the upper left corner of the target transform coefficient matrix; Performing an inverse horizontal transformation on the coefficient matrix to obtain an inverse horizontal transformation matrix; Performing a vertical inverse transformation on the horizontal inverse transformation matrix to obtain a vertical inverse transformation matrix; The transformation coefficients of a designated area located in the upper left corner of the target transformation coefficient matrix are updated based on the vertical inverse transformation matrix to obtain the initial transformation coefficient matrix.
15. The method according to claim 1, characterized in that The performing a secondary inverse transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chroma component is greater than a preset threshold, or the height of the chroma component is greater than a preset threshold, determining a coefficient matrix based on the transform coefficients of a designated area located at the upper left corner of the target transform coefficient matrix; If the mode number of the chroma intra prediction mode of the current block is in the first mode number interval, the coefficient matrix is horizontally inversely transformed to obtain a horizontal inverse transformation matrix; if the mode number of the chroma intra prediction mode of the current block is in the second mode number interval, the coefficient matrix is vertically inversely transformed to obtain a vertical inverse transformation matrix; If the coefficient matrix is subjected to a horizontal inverse transform, the transform coefficients of a designated area located in the upper left corner of the target transform coefficient matrix are updated based on the horizontal inverse transform matrix to obtain the initial transform coefficient matrix; If the coefficient matrix is subjected to a vertical inverse transformation, the transformation coefficients of a designated area located in the upper left corner of the target transformation coefficient matrix are updated based on the vertical inverse transformation matrix to obtain the initial transformation coefficient matrix.
16. The method according to claim 1, characterized in that The performing a secondary inverse transformation on the target transformation coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chroma component is equal to a preset threshold, and the height of the chroma component is equal to a preset threshold, performing a vertical inverse transformation on the target transformation coefficient matrix to obtain a vertical inverse transformation matrix; Performing a 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.
17. The method according to any one of claims 1 to 8, characterized in that: The step of parsing a secondary transformation flag from the coded bit stream comprises: parsing a secondary transformation flag from the coded bit stream using a context-based binary arithmetic decoding method; Alternatively, a bypass decoding method is used to parse the secondary transformation flag from the encoded bit stream.
18. The method according to claim 17, characterized in that The adopting context-based binary arithmetic decoding method to parse the secondary transformation flag from the coded bit stream includes: Selecting a target context model from at least two pre-configured context models based on the chroma intra prediction mode of the current block, and parsing a secondary transform flag from the coded bit stream based on the target context model; or Based on the size of the chrominance component, a target context model is selected from at least two pre-configured context models, and a secondary transform flag is parsed from the coded bit stream based on the target context model.
19. A coding method, characterized in that: Applied to the encoding end, the method includes: Get the residual coefficient matrix corresponding to the chrominance component of the current block; Performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; If the current block satisfies a second preset condition, determining whether to perform a secondary transformation on the chrominance component; Encoding a secondary transform flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component; 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 chrominance component contains non-zero transformation coefficients; After determining whether to perform a secondary transformation on the chrominance component, the method further includes: If yes, performing a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component; if no, determining the initial transformation coefficient matrix as the target transformation coefficient matrix corresponding to the chrominance component; quantizing the target transform coefficient matrix to obtain a final transform coefficient matrix corresponding to the chrominance component; The final transform coefficient matrix is encoded to obtain an encoded bit stream of the current block.
20. The method according to claim 19, characterized in that The second preset condition includes at least one of the following: The current block does not use the intra-frame prediction filtering mode; The current block does not use the improved intra prediction mode; The current block is initially transformed using a transform kernel (discrete cosine transform DCT2, DCT2); 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 current block to use a secondary transform; The positions other than the upper left corner coordinate (0, 0) in the initial transformation coefficient matrix contain non-zero transformation coefficients.
21. The method according to claim 20, characterized in that The chroma intra prediction mode of the current block satisfies the preset mode condition, including at least one of the following: The chroma intra prediction mode of the current block is not TSCPM mode; The chroma intra prediction mode of the current block is not the PMC mode; The mode number of the chroma intra prediction mode of the current block is mode number 0 to mode number 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.
22. The method according to claim 20, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes 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 greater than or equal to n3, and the height of the chrominance component is greater than or equal to n4; The product of the width and height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
23. The method according to claim 20, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes 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 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 height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
24. The method according to claim 20, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes at least one of the following: 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 greater than or equal to n3, and the height of the chrominance component is greater than or equal to n4; The product of the width and height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
25. The method according to claim 20, characterized in that The size of the chrominance component of the current block satisfies the preset size condition, which includes at least one of the following: 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 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 height of the chrominance component is greater than or equal to n5; The product of the width and height of the chrominance component is less than or equal to n6.
26. The method according to claim 20, characterized in that The chroma components are chroma U components and chroma V components, and the positions other than the upper left corner coordinate (0, 0) in the initial transform coefficient matrix contain non-zero transform coefficients, including one of the following conditions: Condition 1: The initial transformation coefficient matrix corresponding to the chroma U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), or the initial transformation coefficient matrix corresponding to the chroma V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0); Condition 2: The initial transformation coefficient matrix corresponding to the chrominance U component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0), and the initial transformation coefficient matrix corresponding to the chrominance V component contains non-zero transformation coefficients at positions other than the upper left corner coordinate (0, 0).
27. The method according to any one of claims 19 to 26, characterized in that: The chroma components are a chroma U component and a chroma V component, and the secondary transformation flag is a secondary transformation flag shared by UV components; When the value of the UV component shared secondary transformation flag is the first value, it is used to indicate that the chroma U component and the chroma V component are simultaneously subjected to secondary transformation, or, when the value of the UV component shared secondary transformation flag is the second value, it is used to indicate that neither the chroma U component nor the chroma V component is subjected to secondary transformation.
28. The method according to claim 27, characterized in that The determining whether to perform a secondary transformation on the chrominance component comprises: Determine the first generation value when only initial transformation is performed on the chroma U component and the chroma V component; Determine the second generation value of the chroma U component and the chroma V component when the initial transformation is first performed and then the secondary transformation is performed; If the second generation value is less than the first generation value, it is determined that the chrominance U component and the chrominance V component are simultaneously subjected to secondary transformation; If the second generation value is greater than the first generation value, it is determined that neither the chrominance U component nor the chrominance V component is subjected to secondary transformation.
29. The method according to any one of claims 19 to 26, characterized in that: The chrominance components are a chrominance U component and a chrominance V component, and the secondary transformation flag bits include a U component secondary transformation flag bit and a V component secondary transformation flag bit; When the value of the U component secondary transformation flag is a first value, it is used to indicate that the chrominance U component is secondary transformed, or when the value of the U component secondary transformation flag is a second value, it is used to indicate that the chrominance U component is not secondary transformed; When the value of the V component secondary transformation flag is the first value, it is used to indicate that the chrominance V component is secondary transformed, or when the value of the V component secondary transformation flag is the second value, it is used to indicate that the chrominance V component is not secondary transformed.
30. The method according to claim 29, characterized in that The determining whether to perform a secondary transformation on the chrominance component comprises: Determine the third generation value when only the initial transformation is performed on the chromaticity U component; determine the fourth generation value when the chromaticity U component is first initially transformed and then secondarily transformed; if the fourth generation value is less than the third generation value, determine to perform the second transformation on the chromaticity U component; if the fourth generation value is greater than the third generation value, determine not to perform the second transformation on the chromaticity U component; Determine the fifth generation value when only the initial transformation is performed on the chroma V component; determine the sixth generation value when the chroma V component is first initially transformed and then subjected to a secondary transformation; if the sixth generation value is less than the fifth generation value, determine to perform a secondary transformation on the chroma V component; if the sixth generation value is greater than the fifth generation value, determine not to perform a secondary transformation on the chroma V component.
31. The method according to claim 19, characterized in that The performing a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chrominance component is greater than a preset threshold, or the height of the chrominance component is greater than a preset threshold, determining a coefficient matrix based on the transform coefficients of a designated area located in the upper left corner of the initial transform coefficient matrix; Performing a vertical transformation on the coefficient matrix to obtain a vertical transformation matrix; Performing a horizontal transformation on the vertical transformation matrix to obtain a horizontal transformation matrix; The transform coefficients of a designated area located in the upper left corner of the initial transform coefficient matrix are updated based on the horizontal transform matrix to obtain the target transform coefficient matrix.
32. The method according to claim 19, characterized in that The performing a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chrominance component is greater than a preset threshold, or the height of the chrominance component is greater than a preset threshold, determining a coefficient matrix based on the transform coefficients of a designated area located in the upper left corner of the initial transform coefficient matrix; If the mode number of the chroma intra prediction mode of the current block is in the first mode number interval, the coefficient matrix is horizontally transformed to obtain a horizontal transformation matrix; if the mode number of the chroma intra prediction mode of the current block is in the second mode number interval, the coefficient matrix is vertically transformed to obtain a vertical transformation matrix; If the coefficient matrix is horizontally transformed, the transform coefficients of a designated area located in the upper left corner of the initial transform coefficient matrix are updated based on the horizontal transform matrix to obtain the target transform coefficient matrix; If the coefficient matrix is transformed vertically, the transform coefficients of a designated area located in the upper left corner of the initial transform coefficient matrix are updated based on the vertical transform matrix to obtain the target transform coefficient matrix.
33. The method according to claim 19, characterized in that The performing a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component includes: If the width of the chrominance component is equal to a preset threshold, and the height of the chrominance component is equal to a preset threshold, 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.
34. The method according to any one of claims 19, 31-33, characterized in that: The encoding of the secondary transformation flag in the coded bit stream of the current block comprises: If the final transform coefficient matrix corresponding to the chrominance component contains non-zero transform coefficients, a secondary transform flag is encoded in the coded bit stream of the current block.
35. The method according to any one of claims 19 to 26, characterized in that: The method further comprises: A transform coefficient flag is encoded in the encoded bit stream of the current block; wherein the transform coefficient flag is used to indicate whether a final transform coefficient matrix corresponding to the chrominance component of the current block contains non-zero transform coefficients.
36. The method according to claim 35, characterized in that The transform coefficient flag includes a chroma U component transform coefficient flag and a chroma V component transform coefficient flag; When the value of the chroma U component transform coefficient flag is the first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component of the current block contains non-zero transform coefficients; When the value of the chroma U component transform coefficient flag is the second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma U component does not contain a non-zero transform coefficient; When the value of the chroma V component transform coefficient flag is the first value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component of the current block contains non-zero transform coefficients; When the value of the chroma V component transform coefficient flag is the second value, it is used to indicate that the final transform coefficient matrix corresponding to the chroma V component does not contain non-zero transform coefficients.
37. The method according to any one of claims 19 to 26, characterized in that: The encoding of the secondary transformation flag in the coded bit stream of the current block comprises: Encoding the secondary transformation flag bit by using a context-based binary arithmetic coding method; Alternatively, the secondary transformation flag is encoded using a bypass encoding method.
38. The method according to claim 37, characterized in that The adopting of a context-based binary arithmetic coding method to encode the secondary transformation flag bit includes: Based on the chroma intra prediction mode of the current block, a target context model is selected from at least two pre-configured context models, and the secondary transform flag is encoded based on the target context model; or, Based on the size of the chrominance component, a target context model is selected from at least two pre-configured context models, and the secondary transform flag is encoded based on the target context model.
39. A decoding device, characterized in that: Applied to a decoding end, the device comprises: An acquisition module, used for acquiring a coded bit stream of a current block; A parsing module, configured to parse a final transform coefficient matrix corresponding to the chrominance component of the current block from the coded bit stream, and parse a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; A determination module is used to determine whether to perform a secondary inverse transform on the chroma component according to the secondary transform flag; perform inverse quantization on the final transform coefficient matrix corresponding to the chroma component to obtain a target transform coefficient matrix corresponding to the chroma component; if the chroma component is subjected to a secondary inverse transform, then the target transform coefficient matrix is subjected to a secondary inverse transform to obtain an initial transform coefficient matrix corresponding to the chroma component; if the chroma component is not subjected to a secondary inverse transform, then the target transform coefficient matrix is determined as the initial transform coefficient matrix corresponding to the chroma component; perform an initial inverse transform on the initial transform coefficient matrix to obtain a residual coefficient matrix corresponding to the chroma component; and determine a reconstructed value of the chroma component according to the residual coefficient matrix.
40. A coding device, characterized in that: Applied to the encoding end, the device includes: An acquisition module, used to acquire a residual coefficient matrix corresponding to the chrominance component of the current block; A processing module, used for performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; A determination module, configured to determine whether to perform a secondary transformation on the chrominance component if the current block satisfies a second preset condition; if so, perform a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component; if not, determine the initial transformation coefficient matrix as the target transformation coefficient matrix corresponding to the chrominance component; quantize the target transformation coefficient matrix to obtain a final transformation coefficient matrix corresponding to the chrominance component; an encoding module, configured to encode the final transform coefficient matrix to obtain a coded bit stream of the current block, and encode a secondary transform flag of a block-level chrominance component in the coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component; 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 chrominance component contains non-zero transformation coefficients.
41. A decoding end device, characterized in that: include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the following steps: Obtaining a coded bit stream of a current block, parsing a final transform coefficient matrix corresponding to a chrominance component of the current block from the coded bit stream, and parsing a transform coefficient flag from the coded bit stream, wherein the transform coefficient flag is used to indicate whether the final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; If the current block satisfies a first preset condition, a secondary transform flag of a block-level chrominance component is parsed from the coded bit stream, wherein the secondary transform flag is used to indicate that a secondary inverse transform is performed on the chrominance component, or that a secondary inverse transform is not performed on the chrominance component; wherein the first preset condition at least includes: a prediction mode of the current block is an intra-frame prediction mode, and the transform coefficient flag is used to indicate that a final transform coefficient matrix corresponding to the chrominance component contains a non-zero transform coefficient; Determining whether to perform a secondary inverse transform on the chrominance component according to the secondary transform flag; Dequantizing the final transform coefficient matrix corresponding to the chrominance component to obtain a target transform coefficient matrix corresponding to the chrominance component; If the chroma component is subjected to a secondary inverse transformation, the target transformation coefficient matrix is subjected to a secondary inverse transformation to obtain an initial transformation coefficient matrix corresponding to the chroma component; if the chroma component is not subjected to a secondary inverse transformation, the target transformation coefficient matrix is determined as the initial transformation coefficient matrix corresponding to the chroma component; Performing an initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the chrominance component; The reconstructed values of the chrominance components are determined according to the residual coefficient matrix.
42. A coding end device, characterized in that: include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the following steps: Get the residual coefficient matrix corresponding to the chrominance component of the current block; Performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix corresponding to the chrominance component; If the current block satisfies a second preset condition, determining whether to perform a secondary transformation on the chrominance component; Encoding a secondary transform flag of a block-level chrominance component in a coded bit stream of the current block; wherein the secondary transform flag is used to indicate whether to perform a secondary transform on the chrominance component or not to perform a secondary transform on the chrominance component; 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 chrominance component contains non-zero transformation coefficients; wherein, after determining whether to perform a secondary transformation on the chrominance component, if so, performing a secondary transformation on the initial transformation coefficient matrix to obtain a target transformation coefficient matrix corresponding to the chrominance component; if not, determining the initial transformation coefficient matrix as the target transformation coefficient matrix corresponding to the chrominance component; quantizing the target transform coefficient matrix to obtain a final transform coefficient matrix corresponding to the chrominance component; The final transform coefficient matrix is encoded to obtain an encoded bit stream of the current block.
