Encoding method, decoding method, encoder, decoder and storage medium
By determining multiple candidate intra-prediction modes under chroma intra-prediction mode, the problem of low compression efficiency of transform technology in the prior art is solved, and more efficient encoding and decoding performance is achieved.
Patent Information
- Application Number
- PCT/CN2024/126554
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2026-04-30
AI Technical Summary
Existing technologies only provide one angle prediction mode in the chroma intra-frame prediction mode, resulting in low compression efficiency of the transform technology and its inability to effectively play its role.
When the current block meets the preset conditions, at least two candidate intra-frame prediction modes are determined, and the transform set and transform kernel are determined based on these modes, thereby improving the accuracy of transform prediction.
By providing multiple candidate intra-frame prediction modes, the compression efficiency of transform technology is improved, and the encoding and decoding performance is enhanced.
Smart Images

Figure CN2024126554_30042026_PF_FP_ABST
Abstract
Description
Encoding / decoding methods, encoders, decoders, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, encoder, decoder, and storage medium. Background Technology
[0002] As people's demands for video display quality have increased, high-resolution video, such as HD and UHD, has emerged. However, high-resolution video typically contains more information, thus requiring more bandwidth. To reduce bandwidth requirements, video coding standards involving video compression have been introduced.
[0003] In video coding standards, each intra-frame prediction mode can correspond to a set of transforms. When the current chroma block uses transform technology in chroma intra-frame prediction mode, the relevant technology only provides one angle prediction mode to determine the specific transform set. The choice is relatively limited, which cannot effectively utilize the transform technology and reduces its compression efficiency.
[0004] Summary of the Invention
[0005] This application provides an encoding / decoding method, encoder, decoder, and storage medium, which can improve the compression efficiency of transformation technology and thus enhance encoding / decoding performance.
[0006] The technical solution of this application embodiment can be implemented as follows:
[0007] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:
[0008] When the current block meets the preset conditions, parse the first syntax element in the code stream;
[0009] Determine at least two candidate intra-prediction modes for the current block;
[0010] Determine the transform set of the current block based on the value of the first syntax element and at least two candidate intra-prediction modes;
[0011] Determine the transform kernel of the current block based on the transform set of the current block;
[0012] The inverse transformation of the inverse quantization coefficients of the current block is performed based on the transform kernel to determine the residual sample of the current block.
[0013] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:
[0014] When the current block meets the preset conditions, determine at least two candidate intra-prediction modes for the current block;
[0015] Determine the transform set of the current block based on at least two candidate intra-prediction modes;
[0016] Determine the transform kernel of the current block based on the transform set of the current block;
[0017] The quantization coefficients of the current block are determined based on the transform kernel and the residual samples of the current block.
[0018] The quantization coefficients of the current block are encoded, and the resulting encoded bits are written into the bitstream.
[0019] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit and an encoding unit, wherein:
[0020] The first determining unit is configured to, when the current block meets preset conditions, determine at least two candidate intra-prediction modes of the current block; determine the transform set of the current block based on the at least two candidate intra-prediction modes; determine the transform kernel of the current block based on the transform set of the current block; and determine the quantization coefficients of the current block based on the transform kernel and the residual samples of the current block.
[0021] The encoding unit is configured to encode the quantization coefficients of the current block and write the resulting encoded bits into the bitstream.
[0022] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor, wherein:
[0023] A first memory for storing computer programs that can run on a first processor;
[0024] A first processor is configured to execute the method described in the second aspect when running a computer program.
[0025] Fifthly, embodiments of this application provide a decoder, which includes a decoding unit and a second determining unit, wherein:
[0026] The decoding unit is configured to parse the first syntax element in the code stream when the current block meets preset conditions;
[0027] The second determining unit is configured to: determine at least two candidate intra-prediction modes for the current block; determine the transform set for the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes; determine the transform kernel for the current block based on the transform set for the current block; and perform an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual samples of the current block.
[0028] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor, wherein:
[0029] The second memory is used to store computer programs that can run on the second processor;
[0030] A second processor is configured to execute the method described in the first aspect when running a computer program.
[0031] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect or the method described in the second aspect.
[0032] Eighthly, embodiments of this application provide a computer program product, including a computer program or instructions that, when executed by a processor, implement the method described in the first aspect or the method described in the second aspect.
[0033] In a ninth aspect, embodiments of this application provide a computer-readable storage medium having a bitstream stored thereon, the bitstream being generated by performing the steps of the encoding method as described in the second aspect.
[0034] This application provides an encoding / decoding method, an encoder, a decoder, and a storage medium. At the encoding end, when the current block meets preset conditions, at least two candidate intra-prediction modes for the current block are determined; based on the at least two candidate intra-prediction modes, a transform set for the current block is determined; based on the transform set, a transform kernel for the current block is determined; based on the transform kernel and the residual samples of the current block, quantization coefficients for the current block are determined; the quantization coefficients of the current block are encoded, and the resulting encoded bits are written into the bitstream. At the decoding end, when the current block meets preset conditions, a first syntax element in the bitstream is parsed; at least two candidate intra-prediction modes for the current block are determined; based on the value of the first syntax element and the at least two candidate intra-prediction modes, a transform set for the current block is determined; based on the transform set, a transform kernel for the current block is determined; and based on the transform kernel, an inverse transform is performed on the inverse quantization coefficients of the current block to determine the residual samples of the current block. In other words, whether at the encoding or decoding end, when the current block meets the preset conditions, it is first necessary to determine at least two candidate intra-prediction modes for the current block. Then, the transform set of the current block is determined based on these at least two candidate intra-prediction modes. Since at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thereby enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique, and thus enhancing the encoding and decoding performance. Attached Figure Description
[0035] Figure 1 is a schematic diagram of a video coding framework;
[0036] Figure 2 is a schematic diagram of a Sobel filter;
[0037] Figure 3 is a histogram diagram of an intra-frame prediction mode and amplitude value;
[0038] Figure 4 is a schematic diagram of the positional relationship between luminance blocks and chrominance blocks;
[0039] Figure 5 is a schematic diagram illustrating the principle of model parameter derivation in CCLM mode;
[0040] Figure 6 is a schematic diagram illustrating the principle of model parameter adjustment in CCLM_SLOPE mode;
[0041] Figure 7 is a schematic diagram illustrating the principle of model parameter derivation under the MMLM mode;
[0042] Figure 8 is a schematic diagram of the spatial components of a convolutional filter;
[0043] Figure 9 is a schematic diagram of the chromaticity reference template area in a CCCM mode;
[0044] Figure 10 is a schematic diagram of a wide-angle intra-frame prediction mode;
[0045] Figure 11 is a schematic diagram of an LFNST encoding and decoding process;
[0046] Figure 12 is a schematic diagram of an application of NSPT;
[0047] Figure 13 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application;
[0048] Figure 14 is a schematic block diagram of the system composition of an encoder provided in an embodiment of this application;
[0049] Figure 15 is a schematic block diagram of a decoder system provided in an embodiment of this application;
[0050] Figure 16 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0051] Figure 17 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0052] Figure 18 is a schematic diagram of a sliding window in a chromaticity prediction block provided in an embodiment of this application;
[0053] Figure 19 is a schematic diagram of candidate samples in a chromaticity prediction block provided in an embodiment of this application;
[0054] Figure 20 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0055] Figure 21 is a schematic diagram illustrating the derivation of a transform set for the joint use of two chromaticity prediction blocks according to an embodiment of this application;
[0056] Figure 22 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0057] Figure 23 is a flowchart illustrating an encoding method provided in an embodiment of this application;
[0058] Figure 24 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;
[0059] Figure 25 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application;
[0060] Figure 26 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;
[0061] Figure 27 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application;
[0062] Figure 28 is a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application. Detailed Implementation
[0063] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0065] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0066] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0067] In video images, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB). These three color components are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0068] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application will be explained. The nouns and terms used in the embodiments of this application shall be interpreted as follows:
[0069] H.264 / Advanced Video Coding (AVC);
[0070] H.265 / High Efficiency Video Coding (HEVC);
[0071] H.266 / Versatile Video Coding (VVC);
[0072] VVC's reference software testing platform (VVC Test Model, VTM);
[0073] Enhanced Compression Model (ECM);
[0074] Joint Video Experts Team (JVET);
[0075] Coding Unit (CU);
[0076] Prediction Unit (PU);
[0077] Transform Unit (TU);
[0078] Coding Tree Unit (CTU);
[0079] Largest Coding Unit (LCU);
[0080] Direct export mode (DM);
[0081] Decoder-side intra-mode derivation (DIMD);
[0082] Convolutional Cross-Component Model (CCCM);
[0083] Cross-Component Linear Mode (CCLM);
[0084] Histogram of Gradient (HoG);
[0085] Discrete Cosine Transform (DCT);
[0086] Discrete Sine Transform (DST);
[0087] Multiple Transform Selection (MTS);
[0088] Multiple Transform Set Selection (MTSS);
[0089] Low-Frequency Non-Separable Transform (LFNST);
[0090] Non-Separable Primary Transform (NSPT);
[0091] Cross-Component Prediction (CCP);
[0092] Extrapolation filter-based intra prediction (EIP);
[0093] Template-based Intra Mode Derivation (TIMD);
[0094] Template-based Multiple Reference Line intra prediction (TMRL).
[0095] It should be understood that, with the aim of exploring next-generation digital video compression technology, a new generation of reference software model ECM is being developed based on the reference software VTM of the latest video coding standard H.266 / VVC. Currently, video compression technology is also based on traditional block-based encoding and decoding. For the input video, blocks are divided to be encoded, and then processed through multiple modules such as intra-frame prediction module 11, inter-frame prediction module 12, transform module 13, quantization module 14, entropy coding module 15, inverse quantization module 16, inverse transform module 17, loop filtering module 18, and decoding image buffer module 19. The general framework is shown in Figure 1. Most mainstream video compression standards describe block-based compression techniques. A video clip, a frame, or a series of images is divided into basic units called CTUs, which are further divided into blocks called CUs. Intra-frame blocks are predicted using samples from the block's perimeter as a reference, while inter-frame blocks reference information from neighboring blocks in space and reference information from other frames. In contrast to the predicted signal, the residual information is transformed, quantized, and entropy-coded into a bitstream on a block-by-block basis. These technologies are described in standards and implemented in various fields related to video compression. Major international standards include H.264 / AVC, H.265 / HEVC, H.266 / VVC, and their extensions. Video devices can achieve more efficient video encoding / decoding, transmission, and storage by implementing these technologies. Here, a sample can also be called a pixel; a sample includes both location information and value.
[0096] Intra-frame prediction encompasses various techniques, which can be categorized into luma intra-frame prediction mode and chroma intra-frame prediction mode based on color channels. The transform module typically includes a primary transform and a secondary transform, generally selecting the appropriate transform kernel based on the directional information provided by the intra-frame angle prediction mode. This application proposes a multi-transform set selection technique for the chroma intra-frame prediction mode.
[0097] (1) DIMD method.
[0098] DIMD is a method that uses reconstructed information from the surrounding area of the current block to construct an input template, and then uses the gradients of samples in the input template to derive the intra-frame prediction mode, thus saving transmission space to express the intra-frame mode of the current block. The DIMD method uses a 3×3 horizontal Sobel filter (Gx) and a vertical Sobel filter (Gy), as shown in Figure 2, to calculate the horizontal gradient G for the samples at the center of the template. x and vertical gradient G y Then, through arctan(G) x / G y This allows us to calculate the angle of the corresponding template center sample and convert it into the angle of the corresponding angle prediction pattern existing in the standard. Here, arctan is a function that uses the ratio of the opposite side and the adjacent side of a right triangle to calculate the included angle; it is a fundamental special function in advanced mathematics. Then, through |G... x |+|G y The amplitude value of an angle is calculated by summing the absolute values of the two values. This process is repeated for each input sample, and the amplitude value for each angle is accumulated, resulting in a gradient histogram (HoG) showing the accumulated amplitude values for different angles, as shown in Figure 3. Generally, the angle patterns with higher amplitude values in the HoG are recorded for reference in subsequent processes. In the gradient histogram, the horizontal axis represents the angle pattern, denoted by `ipm`; the vertical axis represents the amplitude value, denoted by `amp(ipm)`.
[0099] The input templates in typical DIMD methods include, but are not limited to, the following: ① reconstructed samples adjacent to the current block; ② prediction samples in the prediction block. In the Chroma DIMD prediction mode, a HoG is constructed using reconstructed samples adjacent to the current block and partial reconstructed samples of the same-position lumen block. Based on this HoG, a corresponding traditional intra-frame prediction angle mode is determined to generate the prediction block.
[0100] (2) DM method.
[0101] Direct export mode is a commonly used chromaticity prediction mode. When predicting chromaticity blocks, the luminance blocks have usually already been predicted. In this case, the chromaticity mode of the current block can borrow the already completed luminance prediction mode. As shown in Figure 4, the prediction mode of the luminance block containing the center point C of the corresponding luminance block is determined and used for the prediction of the current chromaticity block. As shown in Figure 4, this includes blocks at five luminance sample positions, specifically: C, TL, TR, BL, and BR. For example, the prediction mode of the block containing the center point C of the luminance block is selected here, but no limitations are imposed.
[0102] (3) Cross-component prediction mode.
[0103] The core idea of cross-component prediction mode is to reduce cross-component redundancy. Cross-component prediction mainly utilizes the reconstructed luminance samples from the same coding block to construct the predicted values of chrominance samples. The linear relationship of CCLM mode is roughly as shown in formula (1): pred C (i,j)=a·rec L ′(i,j)+ b (1)
[0104] Here, predc(i,j) represents the chroma prediction sample of the current CU, recL'(i,j) represents the downsampled reconstructed luminance sample of the current CU, and a and b are called linear model parameters (e.g., a is the scaling parameter, and b is the offset parameter), which are calculated and derived from adjacent chroma and luminance samples. Since the linear model here can be calculated at the encoding and decoding end, it does not need to be written into the bitstream.
[0105] For example, Figure 5 shows an example of the current block and adjacent reconstructed chroma and luminance samples in CCLM mode. As shown in Figure 5, the larger, bolded box on the left highlights chroma block 21, while the solid gray circle indicates the adjacent reference value of chroma block 21; the larger, bolded box on the right highlights luminance block 22, while the solid gray circle indicates the adjacent reference value of luminance block 22. Chroma block 21 is N×N in size, and luminance block 22 is 2N×2N in size. Here, the adjacent reference values of chroma block 21 and luminance block 22 are used to derive model parameters a and b. Besides using all the upper and left reference samples to jointly calculate the parameters of the linear model, there are two other ways to calculate the model parameters, i.e., CCLM has two other modes, called CCLM-T and CCLM-L modes.
[0106] In CCLM-T mode, the linear model parameters are calculated using only the reference sample above.
[0107] In CCLM-L mode, the linear model parameters are calculated using only the reference sample on the left.
[0108] To further improve the coding efficiency of CCLM, many improvements have been made to the CCLM mode in ECM, including CCLM_SLOPE, MMLM, CCCM, etc. Some of these improvements are briefly introduced below.
[0109] In CCLM_SLOPE, the calculated linear model parameters can be adjusted. The adjustment method is as follows: a′=a+u,b′=bu*yr (2)
[0110] The updated linear model parameters a′ and b′ are then used to calculate predicted samples. This improvement tilts or rotates the mapping function around a point with a brightness value of yr. Here, yr is typically the average value of the reference brightness samples. Figure 6 illustrates the principle of model parameter adjustment in CCLM_SLOPE mode.
[0111] In CCLM mode, there is only one linear model between luminance and chrominance for the same CU. In MMLM mode, multiple models can be provided for the same CU. Adjacent luminance and chrominance samples are classified into different categories based on a classification threshold, and samples in each category are used to calculate different model parameters. Figure 7 shows an example of calculating the model parameters of multiple linear models for sample classification in MMLM mode.
[0112] Another major category of cross-component prediction modes is the CCCM mode. In this mode, predicted samples are obtained through a set of convolutional filters. For example, a 7-tap convolutional filter typically contains 5 spatial components, a nonlinear term, and a bias term. The generation of sample values is roughly as follows: pred C (i,j)=c0C+c1N+c2S+c3E+c4W+c5P+c6B (3)
[0113] For example, the spatial components of the filter are shown in Figure 8, where C represents the corresponding luminance sample, and N, S, W, and E represent the samples above, below, to the left, and to the right of the corresponding sample, respectively.
[0114] Here, the nonlinear term P is represented as the square of the center brightness sample C, scaled proportionally to the range of sample values for the content. P = (C*C + midVal) >> bitDepth (4)
[0115] The bias term B is set to the median value of the chromaticity, as shown below: B = midVal (5)
[0116] Here, bitDepth represents the bit depth, and the value of midVal is determined based on the bit depth value. For example, when the bit depth is 10, the value of midVal is 512.
[0117] The parameters of the convolutional filter are also obtained through adjacent reconstructed samples. Unlike the CCLM mode, the reference template region of the CCCM mode is shown in Figure 9. The reference region typically includes 6 rows and 6 columns of reconstructed samples surrounding the current block, as well as extended regions in the upper right and lower left. The diagonally filled region represents the spatial component extension portion used in the convolutional filter. The filter coefficients are calculated by minimizing the MSE between the predicted and reconstructed chromaticity samples in the reference region. Furthermore, MSE minimization is achieved by calculating the autocorrelation matrix of the luminance input and the cross-correlation vector between the luminance input and the chromaticity output.
[0118] There are also various derivative variations of cross-component derivation modes based on convolutional models, such as the Gradient Linear Model (GLM) mode.
[0119] Similar to the CCLM mode, the CCCM mode can choose to use different reference region shapes, i.e., there are CCCM-T and CCCM-L modes. Likewise, the CCCM mode can also choose to use a multi-parameter model, i.e., there is the MM-CCCM mode, in which the current input sample determines the specific convolutional filter used to obtain the final predicted sample value based on a threshold.
[0120] By using a certain cross-component prediction mode, the predicted values of chromaticity components Cb and Cr can be obtained.
[0121] (4) Classification of prediction blocks and selection of transformation kernel.
[0122] Different angle prediction modes are suitable for different transformations, including the first-order transformation MTS, NSPT and the second-order transformation LFNST.
[0123] MTS includes some traditional transforms, such as DCT transform and DST transform. NSPT and LFNST are a series of transform coefficients obtained from a universal training set based on the optimal transform. The difference between NSPT and LFNST is that NSPT is directly used to transform the residual coefficients, while LFNST further transforms the transform coefficients after DCT2 transform.
[0124] Both NSPT and LFNST have multiple sets of transform kernels. To determine which set of NSPT / LFNST transforms to use for a given prediction, ECM establishes a mapping that maps traditional prediction modes (PLANAR, DC, and angle modes) to a set of NSPT / LFNST transforms. This allows the ECM to determine which set of NSPT / LFNST transforms to use based on the prediction mode corresponding to the current block.
[0125] In the reference software ECM, traditional intra-frame prediction modes include:
[0126] (a) PLANAR mode: Intra-prediction mode index is 0;
[0127] (b) DC mode: Intra-prediction mode index is 1;
[0128] (c) Angle mode: Intra-frame prediction mode index is 2 to 66.
[0129] For example, Figure 10 is a schematic diagram of a wide-angle intra-frame prediction mode. As shown in Figure 10, intra-frame prediction modes 2 to 66 are provided, along with wide-angle modes of -1 to 14 and 67 to 80. The arrows in Figure 10 point to the directions of the angle mode predictions present in VVC, and the prediction mode indices used during encoding and decoding are 2 to 66. When the current prediction block is a non-square block, some angle directions are replaced with wide angles, such as the -1 to -14 and 67 to 80 mode indices in Figure 10.
[0130] In the reference software of ECM, NSPT and LFNST each divide the traditional models into 35 groups, with 3 selectable transform kernels in each group. Table 1 shows the correspondence between the traditional prediction models and the transform sets, that is, it provides a mapping table (or "mapping relationship") between the traditional prediction models and the NSPT / LFNST transform sets.
[0131] Table 1
[0132] In addition, the basic transformation can also be divided into multiple groups according to different traditional prediction modes, and then the transformation kernel of the corresponding group can be selected according to the traditional prediction mode.
[0133] In one possible implementation, LFNST (Low-Frequency Inseparable Transform) applies the inseparable transform based on direct matrix multiplication, enabling it to be implemented in a single iteration instead of multiple iterations. Figure 11 illustrates a detailed encoding and decoding process for LFNST. As shown in Figure 11, at the encoding end, a main transform is performed first, followed by a secondary transform of the low-frequency coefficients in the upper left corner of the main transform using LFNST. For example, a 4×4 LFNST has 16 input coefficients, and an 8×8 LFNST has 64 input coefficients. The coefficients after the LFNST transform are then quantized, and the quantized coefficients are written into the bitstream. At the decoding end, the inverse quantization coefficients are obtained by decoding the bitstream and performing inverse quantization. Then, in the inverse LFNST transform, there are 8 input coefficients for a 4×4 inverse LFNST and 16 input coefficients for an 8×8 inverse LFNST. Finally, the inverse main transform yields the residual block.
[0134] In other words, as shown in Figure 11, LFNST typically operates between the main transform and quantization at the encoding end, while in the existing standard VVC, LFNST operates between inverse quantization and the inverse main transform. For some coding units using traditional intra-frame prediction modes, the selection of the LFNST transform kernel is based on the prediction mode and the mapping relationship shown in Table 1 to find the corresponding transform set, and then the final transform kernel to be used is determined from the transform set according to the transform kernel index. However, for some non-traditional angle prediction modes, a traditional prediction mode needs to be derived first using a special method before the corresponding transform set can be selected according to Table 1. Currently, the index identifier lfnstIdx is used to indicate whether LFNST technology is used. When lfnstIdx is greater than 0, it indicates that the current block uses LFNST technology, and the specific transform kernel is determined from the selected transform set according to the specific value of lfnstIdx. When lfnstIdx is equal to 0, it indicates that the current block does not use LFNST technology.
[0135] In another possible implementation, NSPT (Inseparable Master Transform) is a non-separable master transform used to replace the combination of separable DCT-II master transform and LFNST transform. That is, if the current block uses LFNST and the master transform is DCT-II, and a specific block size condition is met, an NSPT transform scheme will be directly used to replace the original transform scheme. The application is shown in Figure 12. The method for determining the transform kernel is basically the same as LFNST. Currently, the index lfnstIdx and block size are used to indicate whether NSPT is used. Specifically, when lfnstIdx is greater than 0 and the NSPT replacement condition is met, the current block uses NSPT, and the specific transform kernel is determined from the selected transform set based on the specific value of lfnstIdx. Otherwise, the current block does not use NSPT.
[0136] In related technologies, taking cross-component prediction mode as an example, cross-component prediction mode generates predicted values for chrominance blocks based on information from luma blocks. It is a non-traditional prediction mode, therefore, Table 1 cannot be directly used to determine which NSPT / LFNST transform kernel to use for the current chrominance block. To determine which NSPT / LFNST transform kernel to use, a traditional prediction mode is usually derived using the DM method. The process can be as follows:
[0137] First, obtain the corresponding luma block of the current chroma block using the DM method. Then, derive the traditional prediction mode of the current chroma block to guide the transform set based on the intra-frame prediction mode of this luma block. The specific settings are as follows:
[0138] If the intra-frame prediction mode of the same luma block is EIP mode, then the traditional prediction mode saved by EIP technology is exported.
[0139] If the intra-frame prediction mode of the same brightness block is TIMD mode, then export the high-precision angle prediction mode saved by TIMD technology and convert it into a traditional prediction mode according to certain rules.
[0140] If the intra-frame prediction mode of the same brightness block is TMRL mode, then export the high-precision angle prediction mode saved by TMRL technology and convert it into a traditional prediction mode according to certain rules.
[0141] If the intra-frame prediction mode of the same luma block is MIP mode, then directly export the Planar mode.
[0142] If the intra-prediction mode of the same luma block is intraTMP mode, then directly export the Planar mode.
[0143] If it is another prediction mode, the intra-prediction mode saved under that prediction mode is directly exported. This usually ensures that the exported mode is a traditional intra-prediction mode.
[0144] After deriving the traditional prediction mode using the above method, the mapping relationship shown in Table 1 can be used to determine which set of NSPT / LFNST transform kernels to use for the current chroma block.
[0145] In other words, when the current chroma block uses transform technology in the intra-chroma prediction mode, the relevant technology only provides one angle prediction mode to determine the specific transform set. The choice is relatively simple, which cannot effectively play the role of transform technology and reduces the compression efficiency of transform technology.
[0146] Based on this, embodiments of this application provide an encoding method that, when the current block meets preset conditions, determines at least two candidate intra-prediction modes for the current block; determines the transform set of the current block based on the at least two candidate intra-prediction modes; determines the transform kernel of the current block based on the transform set of the current block; determines the quantization coefficients of the current block based on the transform kernel and the residual samples of the current block; encodes the quantization coefficients of the current block, and writes the obtained encoded bits into the bitstream. Embodiments of this application also provide a decoding method that, when the current block meets preset conditions, parses a first syntax element in the bitstream; determines at least two candidate intra-prediction modes for the current block; determines the transform set of the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes; determines the transform kernel of the current block based on the transform set of the current block; and performs an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual samples of the current block.
[0147] In other words, whether at the encoding or decoding end, when the current block meets the preset conditions, it is first necessary to determine at least two candidate intra-prediction modes for the current block. Then, the transform set of the current block is determined based on these at least two candidate intra-prediction modes. Since at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thereby enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique, and thus enhancing the encoding and decoding performance.
[0148] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0149] Figure 13 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application. As shown in Figure 13, the network architecture includes one or more electronic devices 31 to 3N and a communication network 01, wherein the electronic devices 31 to 3N can perform video interaction through the communication network 01. The electronic devices can be various types of devices with video encoding and decoding capabilities, such as mobile phones, tablets, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., and this embodiment of the application does not limit the scope of the application.
[0150] This application provides a network architecture for a video encoding / decoding system that includes decoding and encoding methods. The decoder or encoder in this application can be the aforementioned electronic device. That is, the electronic device in this application has video encoding / decoding capabilities and generally includes a video encoder and a video decoder.
[0151] Figure 14 is a schematic block diagram of an encoder system according to an embodiment of this application. As shown in Figure 14, the encoder 100 may include: a segmentation unit 101, a prediction unit 102, a first adder 107, a transform unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transform unit 111, a second adder 112, a filtering unit 113, a Decoded Picture Buffer (DPB) unit 114, and an entropy coding unit 115. Here, the input of the encoder 100 can be a video composed of a series of images or a single static image, and the output of the encoder 100 can be a bitstream (also called a "bitstream") representing a compressed version of the input video.
[0152] The segmentation unit 101 segments the images in the input video into one or more Coding Tree Units (CTUs). The segmentation unit 101 divides the image into multiple tiles, and can further divide a tile into one or more bricks. Here, a tile or a brick can include one or more complete and / or partial CTUs. Additionally, the segmentation unit 101 can form one or more slices, where a slice can include one or more tiles arranged in raster order in the image, or one or more tiles covering a rectangular area of the image. The segmentation unit 101 can also form one or more sub-images, where a sub-image can include one or more slices, tiles, or bricks.
[0153] During the encoding process of encoder 100, segmentation unit 101 transmits the CTU to prediction unit 102. Typically, prediction unit 102 may consist of block segmentation unit 103, motion estimation (ME) unit 104, motion compensation (MC) unit 105, and intra-prediction unit 106. Specifically, block segmentation unit 103 iteratively uses quadtree segmentation, binary tree segmentation, and ternary tree segmentation to further divide the input CTU into smaller coding units (CUs). Prediction unit 102 can use ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks of the CUs. Intra-prediction unit 106 can use various intra-prediction modes, including MIP modes, to obtain intra-frame prediction blocks of the CUs. In the example, rate-distortion optimized motion estimation can be invoked by ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks, and rate-distortion optimized mode determination can be invoked by intra-prediction unit 106 to obtain intra-frame prediction blocks.
[0154] Prediction unit 102 outputs the predicted block of the CU. First adder 107 calculates the difference between the CU in the output of segmentation unit 101 and the predicted block of the CU, i.e., the residual CU. Transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. Quantization unit 109 quantizes the coefficients and outputs quantization coefficients (i.e., levels). Inverse quantization unit 110 performs scaling operations on the quantization coefficients to output reconstructed coefficients. Inverse transform unit 111 performs one or more inverse transforms corresponding to the transforms in transform unit 108 and outputs the reconstructed residual. Second adder 112 calculates the reconstructed CU by adding the reconstructed residual to the predicted block of the CU from prediction unit 102. Second adder 112 also sends its output to prediction unit 102 as an intra-frame prediction reference. After all CUs in the image or sub-image are reconstructed, filtering unit 113 performs loop filtering on the reconstructed image or sub-image. Here, the filtering unit 113 includes one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping with chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, when the filtering unit 113 determines that the CU is not used as a reference for encoding other CUs, the filtering unit 113 performs loop filtering on one or more target samples in the CU.
[0155] The output of filtering unit 113 is a decoded image or sub-image, which is buffered in DPB unit 114. DPB unit 114 outputs the decoded image or sub-image according to timing and control information. Here, the image stored in DPB unit 114 can also be used as a reference for prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, entropy coding unit 115 converts the parameters (such as control parameters and supplementary information) necessary for decoding the image from encoder 100 into binary form, and writes such binary form into the bitstream according to the syntax structure of each data unit, which is the final output bitstream of encoder 100.
[0156] Furthermore, encoder 100 may be a first memory having a first processor and a computer program for recording. When the first processor reads and runs the computer program, encoder 100 reads the input video and generates a corresponding bitstream. Alternatively, encoder 100 may also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have connection and data exchange functions similar to the corresponding units in Figure 14.
[0157] Figure 15 is a schematic block diagram of a decoder system according to an embodiment of this application. As shown in Figure 15, the decoder 200 may include: a decoding unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded image buffer unit 209. Here, the input of the decoder 200 is a bitstream representing a compressed version of a video or a still image, and the output of the decoder 200 may be a decoded video composed of a series of images or a decoded still image.
[0158] The input bitstream to decoder 200 can be the bitstream generated by encoder 100. Decoding unit 201 parses the input bitstream and obtains the values of syntax elements from it. Decoding unit 201 converts the binary representation of the syntax elements into digital values and sends these digital values to units within decoder 200 to obtain one or more decoded images. Decoding unit 201 can also parse one or more syntax elements from the input bitstream to display the decoded images.
[0159] During the decoding process of decoder 200, decoding unit 201 sends the value of the syntax element and one or more variables set or determined according to the value of the syntax element for obtaining one or more decoded images to the unit in decoder 200.
[0160] Prediction unit 202 determines the prediction block of the current decoded block (e.g., CU). Here, prediction unit 202 may include motion compensation unit 203 and intra-prediction unit 204. Specifically, when an inter-frame decoding mode is indicated for decoding the current decoded block, prediction unit 202 transmits relevant parameters from decoding unit 201 to motion compensation unit 203 to obtain inter-frame prediction blocks; when an intra-frame prediction mode (including MIP mode indicated by MIP mode index value) is indicated for decoding the current decoded block, prediction unit 202 transmits relevant parameters from decoding unit 201 to intra-prediction unit 204 to obtain intra-frame prediction blocks.
[0161] The dequantization unit 205 has the same function as the dequantization unit 110 in the encoder 100. The dequantization unit 205 performs a scaling operation on the quantization coefficients (i.e., levels) from the decoding unit 201 to obtain reconstruction coefficients. The inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The inverse transform unit 206 performs one or more transform operations (i.e., the inverse operations of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain reconstruction residuals. The adder 207 performs an addition operation on its inputs (the predicted block from the prediction unit 202 and the reconstruction residuals from the inverse transform unit 206) to obtain the reconstructed block of the current decoded block. The reconstructed block is also sent to the prediction unit 202 as a reference for other blocks encoded in intra-frame prediction mode.
[0162] After all CUs in an image or sub-image are reconstructed, filtering unit 208 performs loop filtering on the reconstructed image or sub-image. Filtering unit 208 includes one or more filters, such as deblocking filters, sampling adaptive compensation filters, adaptive loop filters, luminance mapping and chroma scaling filters, and neural network-based filters. Alternatively, when filtering unit 208 determines that a reconstructed block is not used as a reference for decoding other blocks, filtering unit 208 performs loop filtering on one or more target samples in the reconstructed block. Here, the output of filtering unit 208 is a decoded image or sub-image, which is buffered in DPB unit 209. DPB unit 209 outputs the decoded image or sub-image based on timing and control information. The image stored in DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by prediction unit 202.
[0163] Furthermore, the decoder 200 can be a second memory having a second processor and a computer program for recording. When the first processor reads and runs the computer program, the decoder 200 reads the input bitstream and generates the corresponding decoded video. Alternatively, the decoder 200 can also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have similar connection and data exchange functions to the corresponding units in Figure 15.
[0164] It should also be noted that when the embodiments of this application are applied to the encoder 100, the "current block" specifically refers to the block to be encoded in the video image (which can also be simply referred to as the "encoded block"); when the embodiments of this application are applied to the decoder 200, the "current block" specifically refers to the block to be decoded in the video image (which can also be simply referred to as the "decoded block").
[0165] In one embodiment of this application, Figure 16 is a schematic flowchart of a decoding method provided in this application. As shown in Figure 16, the method may include:
[0166] S1601: When the current block meets the preset conditions, parse the first syntax element in the code stream.
[0167] It should be noted that in this embodiment, the method is applied to the decoder. Specifically, based on the structure of the decoder 200 shown in Figure 15, the decoding method of this embodiment can be applied to the inverse transform unit 206, specifically a multi-transform set selection technique under chroma blocks, which can improve the compression efficiency of the transform technique.
[0168] In some embodiments, the current block satisfies preset conditions, which may include at least one of the following: the current block is a chroma block; the prediction mode of the current block is a first chroma mode; the value of the second syntax element in the parsed bitstream is greater than 0.
[0169] In this embodiment, the current block is a chroma block. For example, the current block can be a Cr chroma block or a Cb chroma block. In addition, the first chroma mode can be a cross-component prediction mode, or other chroma prediction modes, or it can be some other non-traditional intra-chroma prediction modes, such as the Direct Block Vector (DBV) mode, etc., without any limitation.
[0170] In other words, in this embodiment, the current block can be applied to all chromaticity modes, including but not limited to cross-component prediction modes. This embodiment will use cross-component prediction mode as an example for description, but it can also be used for other chromaticity prediction modes.
[0171] It should also be noted that, in the embodiments of this application, the first syntax element and the second syntax element are different. The first syntax element is used to indicate the index number corresponding to the intra-prediction mode of the current block. Since different intra-prediction modes correspond to different transform sets, the first syntax element can also be called a "transform set index identifier". The second syntax element is used to indicate whether the current block uses a low-frequency non-separable transform method or whether the current block uses a non-separable master transform method. Typically, the second syntax element can be represented by lfnstIdx.
[0172] In one possible implementation, taking the second syntax element indicating whether the current block uses the low-frequency inseparable transform method as an example, the value of lfnstIdx can be used to determine whether the current block uses the low-frequency inseparable transform method. Specifically, if the value of the second syntax element is greater than 0, it is determined that the current block uses the low-frequency inseparable transform method; if the value of the second syntax element is equal to 0, it is determined that the current block does not use the low-frequency inseparable transform method.
[0173] In the embodiments of this application, if the second syntax element indicates that the current block uses a low-frequency non-separable transform method and the size parameters of the current block meet certain conditions, then it can be determined that the current block uses a non-separable master transform method.
[0174] In another possible implementation, suppose the third syntax element is used to indicate whether the current block uses the non-separable main transformation mode. Specifically, if the value of the third syntax element is greater than 0, it is determined that the current block uses the non-separable main transformation mode; if the value of the third syntax element is equal to 0, it is determined that the current block does not use the non-separable main transformation mode.
[0175] It should be noted that, in the embodiments of this application, the second syntax element and the third syntax element can be the same syntax element, or they can be different syntax elements. In other words, in the embodiments of this application, whether the current block uses the low-frequency inseparable transform method and whether the current block uses the inseparable master transform method can be represented by the same syntax element, such as the same second syntax element; or they can be represented by different syntax elements, such as different second syntax elements and third syntax elements, without any limitation.
[0176] In one specific embodiment, the current block meeting the preset conditions may include: the current block is a chroma block, the prediction mode of the current block is a cross-component prediction mode and the value of lfnstIdx is greater than 0, then it can be determined that the current block meets the preset conditions.
[0177] It should also be noted that, in this embodiment, whether the current block meets the preset conditions is used to determine whether the current block uses multi-transform set candidate construction. If the current block meets the preset conditions, it indicates that the current block uses multi-transform set candidate construction, and at this time, the first syntax element in the bitstream can be parsed. That is, during the bitstream parsing stage, it is determined whether to parse the first syntax element based on specific conditions. Only when the current block meets the preset conditions, i.e., the current block uses multi-transform set candidate construction, will the parsing of the first syntax element in the bitstream be performed, thereby reducing unnecessary operations and improving decoding efficiency.
[0178] S1602, determine at least two candidate intra-prediction modes for the current block.
[0179] It should be noted that, in the embodiments of this application, when constructing the current block using multiple transform set candidates, it is first necessary to determine at least two candidate intra-prediction modes for the current block. Since each candidate intra-prediction mode can correspond to a different candidate transform set, at least two sets of candidate transform sets can be obtained for the current block, thus making the selection range of transform sets no longer singular.
[0180] It should also be noted that, in the embodiments of this application, these at least two candidate intra-frame prediction modes can be represented in the form of lists, arrays, sets, etc., without any limitation. The following describes in detail the acquisition of candidate intra-frame prediction modes in conjunction with several implementation methods.
[0181] In one possible implementation, to determine at least two candidate intra-prediction modes for the current block, as shown in Figure 17, the method may include:
[0182] S1701, determine the chroma prediction block for the current block.
[0183] S1702, determine the gradient histogram of the current block based on the candidate samples in the chromaticity prediction block.
[0184] S1703, Based on the gradient histogram of the current block, determine at least two candidate intra-prediction modes for the current block.
[0185] It should be noted that, in the embodiments of this application, the determination of the chromaticity prediction block of the current block can be based on the cross-component prediction mode to perform chromaticity prediction on the current block, such as the aforementioned formula (1); or it can be based on other chromaticity prediction modes to perform chromaticity prediction on the current block to obtain the chromaticity prediction block of the current block.
[0186] Thus, after obtaining the chroma prediction block of the current block, the gradient histogram (HoG) of the current block can be constructed based on the DIMD method. In some embodiments, determining the gradient histogram of the current block based on candidate samples in the chroma prediction block may include:
[0187] Determine the horizontal and vertical gradient values of the candidate samples; based on the horizontal and vertical gradient values of the candidate samples, determine the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples; based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples, determine the gradient histogram of the current block.
[0188] It should be noted that, in the embodiments of this application, the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample are determined based on the horizontal gradient value and vertical gradient value of the candidate sample. In one possible implementation, this may include: performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the candidate intra-frame prediction mode corresponding to the candidate sample; and performing absolute value summation operation based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the gradient magnitude value corresponding to the candidate sample.
[0189] In this embodiment of the application, the candidate intra-frame prediction mode corresponding to the candidate sample is determined by performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample. This may include: using a preset function to calculate the angle of the horizontal gradient value and vertical gradient value to determine the calculation angle corresponding to the candidate sample; and converting the calculation angle into the candidate intra-frame prediction mode corresponding to the candidate sample.
[0190] For example, assuming the horizontal gradient value is represented by Gx and the vertical gradient value by Gy, the preset function is represented as arctan(Gx / Gy). That is, the calculated angle corresponding to the candidate sample can be obtained by using arctan(Gx / Gy), and this calculated angle can be converted into the angle of the corresponding angle prediction mode existing in the standard to obtain the candidate intra-frame prediction mode corresponding to the candidate sample.
[0191] In this embodiment of the application, the gradient magnitude value corresponding to the candidate sample is determined by summing the absolute values of the horizontal gradient value and the vertical gradient value. This may include: adding the absolute values of the horizontal gradient value and the absolute values of the vertical gradient value to determine the gradient magnitude value corresponding to the candidate sample.
[0192] For example, assuming the gradient magnitude value corresponding to the candidate sample is represented by amp, then amp = abs(Gx) + abs(Gy), or amp = |Gx| + |Gy|.
[0193] It should also be noted that, in the embodiments of this application, the horizontal and vertical gradient values of the candidate samples can be calculated using a Sobel filter (or "Sobel operator"). For example, the Sobel filter is specifically as follows:
[0194] The horizontal gradient values are calculated using a 3×3 horizontal Sobel filter, as shown below:
[0195] The vertical gradient value is calculated using a 3×3 vertical Sobel filter, as shown below:
[0196] In other words, in this embodiment of the application, for the construction of the histogram of the current block, a 3×3 sliding window as shown in Figure 18 can be used to calculate the horizontal gradient value and vertical gradient value of each 3×3 sliding window in the chroma prediction block of the current block. Specifically, it can be obtained by multiplying the predicted value within the window position by the 3×3 horizontal Sobel filter and the vertical Sobel filter as shown in Figure 2.
[0197] It should also be noted that, in this embodiment, the candidate samples may not include the samples in the outermost row and column of the chroma prediction block, as shown in the white-filled area of Figure 19. Considering that the Sobel filter uses the samples in the row and column of the current sample, this embodiment may set the horizontal and vertical gradient values of the samples in the outermost row and column of the current chroma block not to be calculated, but only the candidate samples in the grid-filled area shown in Figure 19.
[0198] In some embodiments, determining the gradient histogram of the current block based on the candidate intra-prediction modes and gradient magnitude values corresponding to the candidate samples may include: when the number of candidate samples is at least one, determining at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value; determining at least one reference intra-prediction mode with distinct characteristics and their respective cumulative magnitude values based on the at least one candidate intra-prediction mode and their respective cumulative magnitude values; and determining the gradient histogram of the current block based on the at least one reference intra-prediction mode and their respective cumulative magnitude values.
[0199] In other words, in this embodiment of the application, when the number of candidate samples is at least one, at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value are determined; then, at least one reference intra-prediction mode with distinct characteristics is determined based on at least one candidate intra-prediction mode, and the gradient magnitude values belonging to the same reference intra-prediction mode are accumulated to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode; then, the gradient histogram of the current block is determined based on at least one reference intra-prediction mode and its corresponding magnitude accumulation value.
[0200] For example, taking at least some pixels in the chroma prediction block as candidate samples, the DIMD method is used here. First, a horizontal Sobel filter and a vertical Sobel filter of size 3×3, as shown in Figure 2, are used to calculate the horizontal gradient value G for the candidate samples in the chroma prediction block. x and vertical gradient value G y Then, through arctan(G) x / G y This allows us to calculate the corresponding angle, which is then converted into the angle of the corresponding angle prediction mode in the standard to obtain the candidate intra-frame prediction mode corresponding to the candidate sample. Then, through |G... x |+|G y The gradient magnitude value corresponding to the candidate sample is obtained by summing the absolute values of the two values. This process is repeated for each candidate sample, and the gradient magnitude values corresponding to the same candidate intra-prediction mode are accumulated to obtain at least one reference intra-prediction mode and its corresponding accumulated magnitude value, thereby obtaining the gradient histogram of the current block.
[0201] In some embodiments, determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block may include: sorting the gradient histogram of the current block in descending order of magnitude accumulation value, and determining at least two reference intra-prediction modes that rank higher; and determining the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0202] In other words, in this embodiment of the application, after the gradient histogram of the current block is constructed, at least two reference intra-prediction modes that are ranked first can be selected in descending order of magnitude based on the accumulated magnitude values to determine at least two candidate intra-prediction modes for the current block, thereby reducing complexity.
[0203] It can also be understood that, in the embodiments of this application, the chromaticity prediction block of the current block can be the first chromaticity prediction block Cb, or it can be the second chromaticity prediction block Cr, or it can be the first chromaticity prediction block Cb and the second chromaticity prediction block Cr. In this case, the gradient histogram of the current block can be the sum of the gradient histograms corresponding to the two chromaticity prediction blocks.
[0204] In another possible implementation, for determining at least two candidate intra-prediction modes for the current block, as shown in Figure 20, the method may include:
[0205] S2001, determine the first chromaticity prediction block and the second chromaticity prediction block of the current block.
[0206] S2002, determine the first gradient histogram based on the candidate samples in the first chromaticity prediction block, and determine the second gradient histogram based on the second chromaticity prediction block.
[0207] S2003, determine the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram.
[0208] S2004, Based on the gradient histogram of the current block, determine at least two candidate intra-prediction modes for the current block.
[0209] It should be noted that, in the embodiments of this application, the gradient histogram construction method described above can be used to determine the first gradient histogram based on candidate samples in the first chromaticity prediction block, and the second gradient histogram based on the second chromaticity prediction block. Assuming that both the first and second chromaticity prediction blocks are blocks of size (W, H), then a 3×3 sliding window can calculate the horizontal and vertical gradient values of 2*(W-2)*(H-2) sample positions at the center of these two chromaticity prediction blocks.
[0210] It should also be noted that, in the embodiments of this application, for the first chroma prediction block, the gradient magnitude values corresponding to at least one candidate sample in the first chroma prediction block can be accumulated on the derived intra-frame prediction mode category to obtain a gradient histogram (i.e., the first gradient histogram) corresponding to the first chroma prediction block Cb; similarly, for the second chroma prediction block, a gradient histogram (i.e., the second gradient histogram) corresponding to the second chroma prediction block Cr can be obtained in the same way.
[0211] In some embodiments, determining the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram may include: summing the gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding summed magnitude value; and determining the gradient histogram of the current block based on the at least one reference intra-prediction mode and its corresponding summed magnitude value.
[0212] It should be noted that, in the embodiments of this application, the first gradient histogram can represent at least one reference intra-prediction mode derived by the first chroma prediction block and its corresponding cumulative amplitude value, and the second gradient histogram can represent at least one reference intra-prediction mode derived by the second chroma prediction block and its corresponding cumulative amplitude value. The two gradient histograms are added together, which can be done by accumulating the gradient amplitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding cumulative amplitude value; then, based on the obtained at least one reference intra-prediction mode and its corresponding cumulative amplitude value, the gradient histogram of the current block can be obtained.
[0213] For example, as shown in Figure 21, the first chroma prediction block 2101 is obtained by performing chroma prediction on the first chroma component Cb of the current block, and the second chroma prediction block 2102 is obtained by performing chroma prediction on the second chroma component Cr of the current block. Then, a gradient histogram is calculated based on the DIMD Derivation module 2103 to obtain the final gradient histogram; wherein, in the gradient histogram, the horizontal axis represents the intra-prediction mode, denoted by ipm; and the vertical axis represents the amplitude value, denoted by amp(ipm). The LFNST / NSPT transform set of the current block can be derived from this gradient histogram.
[0214] In other words, in this embodiment, the gradient histogram of the current block can be applied simultaneously to the first chroma component Cb and the second chroma component Cr. That is, regardless of whether it's the first chroma component Cb or the second chroma component Cr, the same gradient histogram is used, and this gradient histogram is obtained by adding the gradient histograms corresponding to the two chroma prediction blocks. In this case, whether it's the first chroma prediction block or the second chroma prediction block, the at least two candidate intra-frame prediction modes determined are unified, and the first syntax element (i.e., the "transform set index identifier") used by both is also the same.
[0215] In some embodiments, determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block may include: sorting the gradient histogram of the current block in descending order of magnitude accumulation value, and determining at least two reference intra-prediction modes that rank higher; and determining the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0216] In this embodiment of the application, taking the gradient histogram shown in FIG21 as an example, at least two reference intra-prediction modes with the highest cumulative magnitude values can be selected as at least two candidate intra-prediction modes for the current block, thereby determining the transform set of the current block.
[0217] For example, based on the gradient histogram of the current block, the three reference intra-prediction modes with the highest cumulative amplitude values can be selected as the three candidate intra-prediction modes for the current block, denoted as dimdMode0, dimdMode1, and dimdMode2, respectively. Among them, dimdMode0 has the highest cumulative amplitude value, dimdMode1 has the second highest cumulative amplitude value, and dimdMode2 has the next highest cumulative amplitude value.
[0218] In yet another possible implementation, for determining at least two candidate intra-prediction modes for the current block, as shown in Figure 22, the method may further include:
[0219] S2201, when the current block uses the direct export mode, determine the corresponding luminance block of the current block.
[0220] S2202, determine at least one candidate intra-frame prediction mode for the current block based on the luminance prediction mode used by the co-position luminance block.
[0221] It should be noted that, in the embodiments of this application, the above-mentioned implementation methods can be combined with each other to determine at least two candidate intra-prediction modes for the current block. That is, when determining at least two candidate intra-prediction modes for the current block, it can be based on the gradient histogram of the current block, for example, selecting at least two candidate intra-prediction modes with the highest amplitude accumulation value according to the magnitude of the amplitude accumulation value; or it can be based on the co-position lumen blocks of the current block, for example, deriving at least one candidate intra-prediction mode from the co-position lumen blocks according to the DM method, thereby obtaining at least two candidate intra-prediction modes for the current block.
[0222] In one possible implementation, the gradient histogram of the current block is obtained by adding the first gradient histogram corresponding to the first chroma prediction block and the second gradient histogram corresponding to the second chroma prediction block. The three intra-prediction modes with the highest cumulative amplitude values are selected and denoted as dimdMode0, dimdMode1, and dimdMode2, respectively. Then, according to the DM method, a candidate intra-prediction mode, denoted as dmMode, is derived from the co-position luma blocks. These four candidate intra-prediction modes—dimdMode0, dimdMode1, dimdMode2, and dmMode—are determined as at least two candidate intra-prediction modes for the current block.
[0223] S1603, determine the transform set of the current block based on the value of the first syntax element and at least two candidate intra-prediction modes.
[0224] It should be noted that, in the embodiments of this application, when the current block is constructed using multiple transform set candidates, the transform set of the current block can be determined from multiple candidate transform sets based on the mapping relationship between the intra-prediction mode and the transform set, as shown in Table 1; or the intra-prediction mode of the current block can be determined based on at least two candidate intra-prediction modes, thereby determining the transform set of the current block.
[0225] In one possible implementation, determining the transform set of the current block based on the value of the first syntax element and at least two candidate intra-prediction modes may include: determining at least two candidate transform sets of the current block based on at least two candidate intra-prediction modes and the mapping relationship between the intra-prediction modes and the transform sets; and determining the transform set of the current block based on the value of the first syntax element and at least two candidate transform sets.
[0226] In this implementation, the first syntax element can indicate the index number of the transform set of the current block in at least two candidate transform sets. After determining at least two candidate intra-prediction modes, at least two candidate transform sets of the current block can be determined first based on the mapping relationship between the intra-prediction modes and transform sets; then, based on the value of the first syntax element, the transform set of the current block can be determined from these at least two candidate transform sets.
[0227] In another possible implementation, determining the transform set of the current block based on the value of the first syntax element and at least two candidate intra-prediction modes may include: determining the intra-prediction mode of the current block based on the value of the first syntax element and at least two candidate intra-prediction modes; and determining the transform set of the current block based on the intra-prediction mode of the current block and the mapping relationship between the intra-prediction mode and the transform set.
[0228] In this implementation, the first syntax element can indicate the index number of the intra prediction mode of the current block among at least two candidate intra prediction modes. After determining at least two candidate intra prediction modes, the intra prediction mode of the current block can be determined from these at least two candidate intra prediction modes based on the value of the first syntax element, and then the transform set of the current block can be determined based on the mapping relationship between the intra prediction mode and the transform set.
[0229] It should also be noted that, in the embodiments of this application, the multi-transform set candidates can be constructed in the form of arrays, lists, or sets. For example, taking the first candidate list as an example, the first candidate list can be represented as a list, array, or set. In some embodiments, the method may further include: determining the first candidate list for the current block based on at least two candidate intra-frame prediction modes.
[0230] In this embodiment, it is assumed that the first candidate list can indicate at least two sets of candidate transforms. Here, since each candidate intra-prediction mode corresponds to a set of candidate transforms, the first candidate list can include at least two candidate intra-prediction modes; or it can include at least two sets of candidate transforms, without any limitation.
[0231] In one possible implementation, the first syntax element may indicate the index number of the intra-prediction mode of the current block in the first candidate list. Specifically, if the first candidate list includes only two candidate intra-prediction modes, the value of the first syntax element may include two values, such as 0 or 1; if the first candidate list includes three candidate intra-prediction modes, the value of the first syntax element may include three values, such as 0, 1, or 2; if the first candidate list includes four or more candidate intra-prediction modes, the value of the first syntax element may include four or more values, such as 0, 1, 2, 3, 4, etc., without any limitation.
[0232] It is also understood that, in the embodiments of this application, in order to reduce complexity, only two candidate intra-prediction modes can be selected from these at least two candidate intra-prediction modes to form the first candidate list of the current block, thereby saving the encoding bits of the first syntax element. In some embodiments, determining the intra-prediction mode of the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes may include: determining two candidate intra-prediction modes of the current block from the at least two candidate intra-prediction modes; and determining the intra-prediction mode of the current block based on the value of the first syntax element and the two candidate intra-prediction modes.
[0233] It should be noted that, in this embodiment, two candidate intra-prediction modes can be selected from these at least two candidate intra-prediction modes to form a first candidate list, and then the intra-prediction mode of the current block can be determined from it. In this case, the value of the first syntax element only includes two values, such as 0 or 1. For example, if the value of the first syntax element is 0, the candidate intra-prediction mode at the first position in the first candidate list can be determined as the intra-prediction mode of the current block; if the value of the first syntax element is 1, the candidate intra-prediction mode at the second position in the first candidate list can be determined as the intra-prediction mode of the current block.
[0234] It should also be noted that, in this embodiment, after determining at least two candidate intra-prediction modes for the current block, such as dimdMode0, dimdMode1, dimdMode2, and dmMode, these four candidate intra-prediction modes can be determined as the first candidate list for the current block. However, considering the complexity and list length, two candidate intra-prediction modes for the current block can be determined from these at least two candidate intra-prediction modes to form the first candidate list for the current block, thereby shortening the list length. For example, the length of the first candidate list can be equal to 2.
[0235] In some embodiments, determining two candidate intra-prediction modes for the current block from at least two candidate intra-prediction modes may include: determining a first candidate intra-prediction mode for the current block from at least two candidate intra-prediction modes; determining a second candidate intra-prediction mode, whose indicated candidate transform set is different from the first candidate transform set, from at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, based on a first candidate transform set indicated by the first candidate intra-prediction mode; and determining two candidate intra-prediction modes for the current block based on the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0236] It should be noted that, in the embodiments of this application, any one of the at least two candidate intra-prediction modes can be selected as the first candidate intra-prediction mode, or the candidate intra-prediction mode in the first position among the at least two candidate intra-prediction modes can be selected as the first candidate intra-prediction mode, or the intra-prediction mode corresponding to the highest magnitude accumulation value in the gradient histogram of the current block can be selected as the first candidate intra-prediction mode, without any limitation.
[0237] It should also be noted that, for these at least two candidate intra-prediction modes, if there is a candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the other candidate intra-prediction modes besides the first candidate intra-prediction mode, then it is determined as the second candidate intra-prediction mode, and then the first candidate intra-prediction mode and the second candidate intra-prediction mode are determined as the two candidate intra-prediction modes of the current block to form the first candidate list.
[0238] Furthermore, in this embodiment, if among the candidate intra-prediction modes other than the first candidate intra-prediction mode, there are multiple candidate intra-prediction modes whose indicated candidate transform sets are different from the first candidate transform set, then the first candidate intra-prediction mode found that is different from the first candidate transform set can be determined as the second candidate intra-prediction mode. That is, the transform sets indicated by the first candidate intra-prediction mode and the second candidate intra-prediction mode are different.
[0239] It should also be noted that in the first candidate list, the first candidate intra-prediction mode can be represented by modeForTrans0, and the second candidate intra-prediction mode can be represented by modeForTrans1.
[0240] In some embodiments, the method may further include: when there is no second candidate intra-prediction mode among at least two candidate intra-prediction modes other than the first candidate intra-prediction mode that has a different candidate transform set from the first candidate transform set, adjusting the first candidate intra-prediction mode according to a preset offset to determine the second candidate intra-prediction mode; and determining two candidate intra-prediction modes for the current block according to the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0241] In the embodiments of this application, if there is no second candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the other candidate intra-prediction modes besides the first candidate intra-prediction mode, that is, the candidate transform sets corresponding to at least two candidate intra-prediction modes are the same, then a new second candidate intra-prediction mode can be obtained by adding a preset offset to the first candidate intra-prediction mode, and the indicated transform set is different from the first candidate transform set.
[0242] For example, the preset offset can be set to 2, but this is not limited in any way. In one possible implementation, if the mode index of the first candidate intra-prediction mode is 51 and the index identifier of its corresponding first candidate transform set is 17, then the mode index of the second candidate intra-prediction mode is 53 and the index identifier of its corresponding second candidate transform set is 15; then the first candidate intra-prediction mode and the second candidate intra-prediction mode can be determined as the two candidate intra-prediction modes of the current block to form the first candidate list.
[0243] In this way, based on the value of the first syntax element and at least two sets of candidate intra-frame prediction modes, the transform set used by the current block can be determined, thereby making the selection range of the transform set no longer singular, and thus improving the accuracy of transform prediction.
[0244] It is also understood that, in the embodiments of this application, for the first chromaticity prediction block Cb and the second chromaticity prediction block Cr of the current block, different chromaticity prediction blocks can use the same transform set, that is, the same transform set index identifier (first syntax element) is used to indicate the operation of the chromaticity blocks corresponding to the two chromaticity components Cb and Cr. Alternatively, different chromaticity prediction blocks can also use different transform sets, that is, different transform set index identifiers are used. In this case, two transform set index identifiers can be set to indicate the operation of the chromaticity blocks corresponding to the two chromaticity components Cb and Cr respectively; there are no limitations on this.
[0245] S1604, Determine the transform kernel of the current block based on the transform set of the current block.
[0246] In this embodiment, after determining the transform set of the current block, the transform kernel of the current block can then be determined. In some embodiments, the method may include: determining the transform kernel of the current block based on the value of the second syntax element and the transform set of the current block.
[0247] It should be noted that the second syntax element is represented by lfnstIdx. If the value of lfnstIdx is greater than 0, then it is determined that the current block uses either a low-frequency non-separable transform or a non-separable master transform. That is, in this embodiment, if the value of the second syntax element is greater than 0, then the value of the second syntax element can also indicate the index number of the transform kernel of the current block in the transform set. In this case, the transform kernel of the current block can be determined based on the actual value of the second syntax element.
[0248] For example, assuming the transform set includes 3 candidate transform kernels, if the value of the second syntax element is equal to 1, then the candidate transform kernel at the first position in the transform set of the current block can be used as the transform kernel of the current block; if the value of the second syntax element is equal to 2, then the candidate transform kernel at the second position in the transform set of the current block can be used as the transform kernel of the current block; if the value of the second syntax element is equal to 3, then the candidate transform kernel at the third position in the transform set of the current block can be used as the transform kernel of the current block.
[0249] S1605, perform inverse transformation on the inverse quantization coefficients of the current block according to the transformation kernel, and determine the residual sample of the current block.
[0250] It should be noted that, in this embodiment, it is also necessary to determine the inverse quantization coefficient of the current block. In some embodiments, the method may further include: parsing the quantization coefficient of the current block in the bitstream; performing inverse quantization on the quantization coefficient of the current block to determine the inverse quantization coefficient of the current block.
[0251] It should also be noted that, in the embodiments of this application, when performing an inverse transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual sample of the current block, it may include: performing a non-separable principal transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual sample of the current block; or, performing a low-frequency non-separable transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the inverse transform coefficients of the current block; and performing a discrete cosine transform on the inverse transform coefficients of the current block to determine the residual sample of the current block.
[0252] In one possible implementation, when the current block uses a low-frequency non-separable transform method and the size parameters of the current block meet the first condition, a non-separable master transform is performed on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual samples of the current block.
[0253] In another possible implementation, if the current block uses a low-frequency non-separable transform method and the size parameters of the current block satisfy the second condition, the low-frequency non-separable transform is performed on the inverse quantization coefficients of the current block according to the transform kernel to determine the inverse transform coefficients of the current block; and the discrete cosine transform is performed on the inverse transform coefficients of the current block to determine the residual samples of the current block.
[0254] Here, the size parameter of the current block satisfies the first condition, which may include: the size parameter of the current block is small, for example, the size parameter of the current block is less than a certain threshold. That is, for smaller blocks, the NSPT transform kernel is used here, that is, the inverse NSPT transform is performed on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual samples of the current block. For example, as shown in Figure 12, when the size parameter of the current block is 4×4, 4×8, 8×4, 4×16, 16×4; or 8×8, 8×16, 16×8, the current block uses the NSPT transform.
[0255] Here, the size parameter of the current block satisfies the second condition, which may include: the size parameter of the current block is relatively large, for example, the size parameter of the current block is greater than a certain threshold. That is, for larger blocks, the LFNST transform kernel is used here, that is, the inverse LFNST transform is performed on the inverse quantization coefficients of the current block according to the transform kernel to determine the inverse transform coefficients of the current block; and the inverse DCT2 transform is performed on the inverse transform coefficients of the current block to determine the residual samples of the current block. For example, as shown in Figure 12, when the size parameter of the current block is M×N (M, N≥16), the current block uses DCT+LFNST transform.
[0256] It should also be noted that, in the embodiments of this application, the "inverse transformation" of the inverse quantization coefficients at the decoding end can also be referred to as "transformation" in the standard text. In this document, "transformation" and "inverse transformation" correspond to two opposite processes. For example, "transformation" converts spatial domain values to frequency domain coefficients, while "inverse transformation" converts frequency domain coefficients back to spatial domain values. "Inverse" is relative to "positive," and they are essentially both transformations. It should be noted that if the standard only specifies decoding, then the "transformation" in the standard text refers to the decoding part, specifically the "inverse transformation" in this document. That is to say, the "inverse transformation" of the inverse quantization coefficients at the decoding end can also be referred to as "transformation" in the standard text.
[0257] In some embodiments, the method may further include: performing intra-frame prediction on the current block to determine the prediction samples of the current block; and determining the reconstruction samples of the current block based on the prediction samples and the residual samples of the current block.
[0258] It should be noted that, in the embodiments of this application, after determining the predicted sample of the current block (e.g., the first chromaticity prediction block or the second chromaticity prediction block), the predicted sample of the current block and the residual sample of the current block can be added together to determine the reconstructed sample of the current block.
[0259] This embodiment provides a decoding method, primarily focusing on improving the transform kernel derivation method in chroma prediction mode. When the current block meets preset conditions, the first syntax element in the bitstream is parsed; at least two candidate intra-prediction modes for the current block are determined; based on the value of the first syntax element and the at least two candidate intra-prediction modes, the transform set for the current block is determined; based on the transform set, the transform kernel for the current block is determined; and based on the transform kernel, the inverse quantization coefficients of the current block are inversely transformed to determine the residual samples of the current block. In other words, whether at the encoding or decoding end, when the current block meets preset conditions, at least two candidate intra-prediction modes for the current block must first be determined. Then, the transform set for the current block is determined based on these at least two candidate intra-prediction modes. Because at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thus enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique and ultimately enhancing encoding and decoding performance.
[0260] In one embodiment of this application, FIG23 is a flowchart illustrating an encoding method provided in this application. As shown in FIG23, the method may include:
[0261] S2301, when the current block meets the preset conditions, determine at least two candidate intra-prediction modes for the current block.
[0262] It should be noted that in this embodiment, the method is applied to the encoder. Specifically, based on the structure of the encoder 100 shown in FIG14, the encoding method of this embodiment can be applied to the transform unit 108, specifically the multi-transform set selection technique under chroma blocks, which can improve the compression efficiency of the transform technique.
[0263] In some embodiments, the current block satisfies preset conditions, which may include at least one of the following: the current block is a chroma block; the prediction mode of the current block is a first chroma mode; and the value of the second syntax element is greater than 0. The second syntax element is used to indicate whether the current block uses a low-frequency inseparable transform or whether the current block uses an inseparable master transform.
[0264] In this embodiment, the current block is a chroma block. For example, the current block can be a Cr chroma block or a Cb chroma block. In addition, the first chroma mode can be a cross-component prediction mode, or other chroma prediction modes, or it can be some other non-traditional chroma intra-frame prediction modes, such as DBV mode, etc., without any limitation.
[0265] In other words, in this embodiment, the current block can be applied to all chromaticity modes, including but not limited to cross-component prediction modes. This embodiment will use cross-component prediction mode as an example for description, but it can also be used for other chromaticity prediction modes.
[0266] In some embodiments, the method may further include: determining the value of a second syntax element; encoding the value of the second syntax element; and writing the obtained encoded bits into a bitstream.
[0267] In one possible implementation, taking the second syntax element indicating whether the current block uses a low-frequency indivisible transform as an example, the value of the second syntax element can be determined based on whether the current block uses a low-frequency indivisible transform. In this embodiment, the second syntax element can be represented by lfnstIdx. Specifically, if the current block uses a low-frequency indivisible transform, the value of lfnstIdx is determined to be greater than 0; if the current block does not use a low-frequency indivisible transform, the value of lfnstIdx is determined to be equal to 0.
[0268] It should also be noted that, under this implementation, if the value of lfnstIdx is greater than 0 and the size parameter of the current block meets certain conditions, then it can be determined that the current block uses the non-separable master transformation method.
[0269] In another possible implementation, suppose the third syntax element is used to indicate whether the current block uses the non-separable master transformation mode. Specifically, if the current block uses the non-separable master transformation mode, the value of the third syntax element is greater than 0; if the current block does not use the non-separable master transformation mode, the value of the third syntax element is equal to 0.
[0270] It should be noted that, in the embodiments of this application, the second syntax element and the third syntax element can be the same syntax element, or they can be different syntax elements. In other words, in the embodiments of this application, whether the current block uses the low-frequency inseparable transform method and whether the current block uses the inseparable master transform method can be represented by the same syntax element, such as the same second syntax element; or they can be represented by different syntax elements, such as different second syntax elements and third syntax elements, without any limitation.
[0271] In one specific embodiment, the current block meeting the preset conditions may include: the current block is a chroma block, the prediction mode of the current block is a cross-component prediction mode and the value of lfnstIdx is greater than 0, then it can be determined that the current block meets the preset conditions.
[0272] It should also be noted that, in this embodiment, whether the current block meets the preset conditions is used to determine whether the current block uses multiple transform set candidates for construction. If the current block meets the preset conditions, it indicates that the current block uses multiple transform set candidates for construction, and then it is necessary to determine at least two candidate intra-prediction modes for the current block. Since each candidate intra-prediction mode can correspond to a different candidate transform set, at least two sets of candidate transform sets can be obtained for the current block, making the selection range of transform sets no longer singular.
[0273] It should also be noted that, in the embodiments of this application, these at least two candidate intra-frame prediction modes can be represented in the form of lists, arrays, sets, etc., without any limitation. The following describes in detail the acquisition of candidate intra-frame prediction modes in conjunction with several implementation methods.
[0274] In one possible implementation, for determining at least two candidate intra-prediction modes for the current block, the method may include: determining a chroma prediction block for the current block; determining a gradient histogram for the current block based on candidate samples in the chroma prediction block; and determining at least two candidate intra-prediction modes for the current block based on the gradient histogram for the current block.
[0275] It should be noted that, in the embodiments of this application, the determination of the chromaticity prediction block of the current block can be based on the cross-component prediction mode to perform chromaticity prediction on the current block, such as the aforementioned formula (1); or it can be based on other chromaticity prediction modes to perform chromaticity prediction on the current block to obtain the chromaticity prediction block of the current block.
[0276] Thus, after obtaining the chroma prediction block of the current block, the gradient histogram (HoG) of the current block can be constructed based on the DIMD method. In some embodiments, determining the gradient histogram of the current block based on candidate samples in the chroma prediction block may include:
[0277] Determine the horizontal and vertical gradient values of the candidate samples; based on the horizontal and vertical gradient values of the candidate samples, determine the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples; based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples, determine the gradient histogram of the current block.
[0278] It should be noted that, in the embodiments of this application, the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample are determined based on the horizontal gradient value and vertical gradient value of the candidate sample. In one possible implementation, this may include: performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the candidate intra-frame prediction mode corresponding to the candidate sample; and performing absolute value summation operation based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the gradient magnitude value corresponding to the candidate sample.
[0279] In this embodiment of the application, the candidate intra-frame prediction mode corresponding to the candidate sample is determined by performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample. This may include: using a preset function to calculate the angle of the horizontal gradient value and vertical gradient value to determine the calculation angle corresponding to the candidate sample; and converting the calculation angle into the candidate intra-frame prediction mode corresponding to the candidate sample.
[0280] For example, assuming the horizontal gradient value is represented by Gx and the vertical gradient value by Gy, the preset function is represented as arctan(Gx / Gy). That is, the calculated angle corresponding to the candidate sample can be obtained by using arctan(Gx / Gy), and this calculated angle can be converted into the angle of the corresponding angle prediction mode existing in the standard to obtain the candidate intra-frame prediction mode corresponding to the candidate sample.
[0281] In this embodiment of the application, the gradient magnitude value corresponding to the candidate sample is determined by summing the absolute values of the horizontal gradient value and the vertical gradient value. This may include: adding the absolute values of the horizontal gradient value and the absolute values of the vertical gradient value to determine the gradient magnitude value corresponding to the candidate sample.
[0282] For example, assuming the gradient magnitude value corresponding to the candidate sample is represented by amp, then amp = abs(Gx) + abs(Gy), or amp = |Gx| + |Gy|.
[0283] It should also be noted that, in the embodiments of this application, the horizontal and vertical gradient values of the candidate samples can be calculated using a Sobel filter (or "Sobel operator"). For example, the Sobel filter is specifically as follows:
[0284] The horizontal gradient values are calculated using a 3×3 horizontal Sobel filter, as shown below:
[0285] The vertical gradient value is calculated using a 3×3 vertical Sobel filter, as shown below:
[0286] In other words, in this embodiment of the application, for the construction of the histogram of the current block, a 3×3 sliding window as shown in Figure 18 can be used to calculate the horizontal gradient value and vertical gradient value of each 3×3 sliding window in the chroma prediction block of the current block. Specifically, it can be obtained by multiplying the predicted value within the window position by the 3×3 horizontal Sobel filter and the vertical Sobel filter as shown in Figure 2.
[0287] It should also be noted that, in this embodiment, the candidate samples may not include the samples in the outermost row and column of the chroma prediction block, as shown in the white-filled area of Figure 19. Considering that the Sobel filter uses the samples in the row and column of the current sample, this embodiment may set the horizontal and vertical gradient values of the samples in the outermost row and column of the current chroma block not to be calculated, but only the candidate samples in the grid-filled area shown in Figure 19.
[0288] In some embodiments, determining the gradient histogram of the current block based on the candidate intra-prediction modes and gradient magnitude values corresponding to the candidate samples may include: when the number of candidate samples is at least one, determining at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value; determining at least one reference intra-prediction mode with distinct characteristics and their respective cumulative magnitude values based on the at least one candidate intra-prediction mode and their respective cumulative magnitude values; and determining the gradient histogram of the current block based on the at least one reference intra-prediction mode and their respective cumulative magnitude values.
[0289] In other words, in this embodiment of the application, when the number of candidate samples is at least one, at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value are determined; then, at least one reference intra-prediction mode with distinct characteristics is determined based on at least one candidate intra-prediction mode, and the gradient magnitude values belonging to the same reference intra-prediction mode are accumulated to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode; then, the gradient histogram of the current block is determined based on at least one reference intra-prediction mode and its corresponding magnitude accumulation value.
[0290] For example, taking at least some pixels in the chroma prediction block as candidate samples, the DIMD method is used here. First, a horizontal Sobel filter and a vertical Sobel filter of size 3×3, as shown in Figure 2, are used to calculate the horizontal gradient value G for the candidate samples in the chroma prediction block. x and vertical gradient value G y Then, through arctan(G) x / G yThis allows us to calculate the corresponding angle, which is then converted into the angle of the corresponding angle prediction mode in the standard to obtain the candidate intra-frame prediction mode corresponding to the candidate sample. Then, through |G... x |+|G y The gradient magnitude value corresponding to the candidate sample is obtained by summing the absolute values of the two values. This process is repeated for each candidate sample, and the gradient magnitude values corresponding to the same candidate intra-prediction mode are accumulated to obtain at least one reference intra-prediction mode and its corresponding accumulated magnitude value, thereby obtaining the gradient histogram of the current block.
[0291] In some embodiments, determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block may include: sorting the gradient histogram of the current block in descending order of magnitude accumulation value, and determining at least two reference intra-prediction modes that rank higher; and determining the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0292] In other words, in this embodiment of the application, after the gradient histogram of the current block is constructed, at least two reference intra-prediction modes that are ranked first can be selected in descending order of magnitude based on the accumulated magnitude values to determine at least two candidate intra-prediction modes for the current block, thereby reducing complexity.
[0293] It can also be understood that, in the embodiments of this application, the chromaticity prediction block of the current block can be the first chromaticity prediction block Cb, or it can be the second chromaticity prediction block Cr, or it can be the first chromaticity prediction block Cb and the second chromaticity prediction block Cr. In this case, the gradient histogram of the current block can be the sum of the gradient histograms corresponding to the two chromaticity prediction blocks.
[0294] In another possible implementation, for determining at least two candidate intra-prediction modes for the current block, the method may include: determining a first chroma prediction block and a second chroma prediction block for the current block; determining a first gradient histogram based on candidate samples in the first chroma prediction block, and determining a second gradient histogram based on the second chroma prediction block; determining a gradient histogram for the current block based on the first gradient histogram and the second gradient histogram; and determining at least two candidate intra-prediction modes for the current block based on the gradient histogram for the current block.
[0295] It should be noted that, in the embodiments of this application, the gradient histogram construction method described above can be used to determine the first gradient histogram based on candidate samples in the first chromaticity prediction block, and the second gradient histogram based on the second chromaticity prediction block. Assuming that both the first and second chromaticity prediction blocks are blocks of size (W, H), then a 3×3 sliding window can calculate the horizontal and vertical gradient values of 2*(W-2)*(H-2) sample positions at the center of these two chromaticity prediction blocks.
[0296] It should also be noted that, in the embodiments of this application, for the first chroma prediction block, the gradient magnitude values corresponding to at least one candidate sample in the first chroma prediction block can be accumulated on the derived intra-frame prediction mode category to obtain a gradient histogram (i.e., the first gradient histogram) corresponding to the first chroma prediction block Cb; similarly, for the second chroma prediction block, a gradient histogram (i.e., the second gradient histogram) corresponding to the second chroma prediction block Cr can be obtained in the same way.
[0297] In some embodiments, determining the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram may include: summing the gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding summed magnitude value; and determining the gradient histogram of the current block based on the at least one reference intra-prediction mode and its corresponding summed magnitude value.
[0298] It should be noted that, in the embodiments of this application, the first gradient histogram can represent at least one reference intra-prediction mode derived by the first chroma prediction block and its corresponding cumulative amplitude value, and the second gradient histogram can represent at least one reference intra-prediction mode derived by the second chroma prediction block and its corresponding cumulative amplitude value. The two gradient histograms are added together, which can be done by accumulating the gradient amplitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding cumulative amplitude value; then, based on the obtained at least one reference intra-prediction mode and its corresponding cumulative amplitude value, the gradient histogram of the current block can be obtained.
[0299] For example, as shown in Figure 21, the first chroma prediction block 2101 is obtained by performing chroma prediction on the first chroma component Cb of the current block, and the second chroma prediction block 2102 is obtained by performing chroma prediction on the second chroma component Cr of the current block. Then, a gradient histogram is calculated based on the DIMD Derivation module 2103 to obtain the final gradient histogram; wherein, in the gradient histogram, the horizontal axis represents the intra-frame prediction mode, denoted by ipm; and the vertical axis represents the amplitude value, denoted by amp(ipm).
[0300] In other words, in this embodiment, the gradient histogram of the current block can be applied simultaneously to the first chroma component Cb and the second chroma component Cr. That is, regardless of whether it's the first chroma component Cb or the second chroma component Cr, the same gradient histogram is used, and this gradient histogram is obtained by adding the gradient histograms corresponding to the two chroma prediction blocks. In this case, whether it's the first chroma prediction block or the second chroma prediction block, the at least two candidate intra-frame prediction modes determined are unified, and the first syntax element (i.e., the "transform set index identifier") used by both is also the same.
[0301] In some embodiments, determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block may include: sorting the gradient histogram of the current block in descending order of magnitude accumulation value, and determining at least two reference intra-prediction modes that rank higher; and determining the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0302] In this embodiment of the application, taking the gradient histogram shown in FIG21 as an example, at least two reference intra-prediction modes with the highest cumulative magnitude values can be selected as at least two candidate intra-prediction modes for the current block, thereby determining the transform set of the current block.
[0303] For example, based on the gradient histogram of the current block, the three reference intra-prediction modes with the highest cumulative amplitude values can be selected as the three candidate intra-prediction modes for the current block, denoted as dimdMode0, dimdMode1, and dimdMode2, respectively. Among them, dimdMode0 has the highest cumulative amplitude value, dimdMode1 has the second highest cumulative amplitude value, and dimdMode2 has the next highest cumulative amplitude value.
[0304] In another possible implementation, for determining at least two candidate intra-prediction modes for the current block, the method may further include: when the current block uses a direct derivation mode, determining the corresponding co-position luma block for the current block; and determining at least one candidate intra-prediction mode for the current block based on the luma prediction mode used by the co-position luma block.
[0305] It should be noted that, in the embodiments of this application, the above-mentioned implementation methods can be combined with each other to determine at least two candidate intra-prediction modes for the current block. That is, when determining at least two candidate intra-prediction modes for the current block, it can be based on the gradient histogram of the current block, for example, selecting at least two candidate intra-prediction modes with the highest amplitude accumulation value according to the magnitude of the amplitude accumulation value; or it can be based on the co-position lumen blocks of the current block, for example, deriving at least one candidate intra-prediction mode from the co-position lumen blocks according to the DM method, thereby obtaining at least two candidate intra-prediction modes for the current block.
[0306] In one possible implementation, the gradient histogram of the current block is obtained by adding the first gradient histogram corresponding to the first chroma prediction block and the second gradient histogram corresponding to the second chroma prediction block. The three intra-prediction modes with the highest cumulative amplitude values are selected and denoted as dimdMode0, dimdMode1, and dimdMode2, respectively. Then, according to the DM method, a candidate intra-prediction mode, denoted as dmMode, is derived from the co-position luma blocks. These four candidate intra-prediction modes—dimdMode0, dimdMode1, dimdMode2, and dmMode—are determined as at least two candidate intra-prediction modes for the current block.
[0307] S2302, determine the transform set of the current block based on at least two candidate intra-prediction modes.
[0308] It should be noted that, in the embodiments of this application, when constructing the current block using multiple transform set candidates, it is first necessary to determine at least two candidate intra-prediction modes for the current block. Since each candidate intra-prediction mode can correspond to a different candidate transform set, at least two sets of candidate transform sets can be obtained for the current block, thus making the selection range of transform sets no longer singular.
[0309] It should also be noted that, in the embodiments of this application, when the current block is constructed using multiple transform set candidates, the transform set of the current block can be determined from multiple candidate transform sets based on the mapping relationship between the intra-prediction mode and the transform set, as shown in Table 1, for example; or the intra-prediction mode of the current block can be determined based on at least two candidate intra-prediction modes, and then the transform set of the current block can be determined by combining the mapping relationship between the intra-prediction mode and the transform set.
[0310] In one possible implementation, determining the transform set of the current block based on at least two candidate intra-prediction modes may include: determining at least two candidate transform sets for the current block based on at least two candidate intra-prediction modes and the mapping relationship between intra-prediction modes and transform sets; calculating the coding cost of the current block based on at least two candidate transform sets to determine the cost result corresponding to each of the at least two candidate transform sets; determining the minimum cost result among the cost results corresponding to each of the at least two candidate transform sets, and determining the candidate transform set corresponding to the minimum cost result as the transform set of the current block.
[0311] In the embodiments of this application, the coding cost calculation can be determined based on the cost result of Rate Distortion Optimization (RDO), the cost result of Sum of Absolute Difference (SAD), or even the cost result of Sum of Absolute Transformed Difference (SATD), but no limitation is made here.
[0312] In this implementation, after determining at least two candidate intra-prediction modes, at least two candidate transform sets for the current block can be determined first based on the mapping relationship between the intra-prediction modes and transform sets; then, based on coding cost calculation, such as RDO cost calculation, the transform set for the current block can be determined from these at least two candidate transform sets.
[0313] In some embodiments, after determining the transform set of the current block, the method may further include: determining the value of a first syntax element; encoding the value of the first syntax element; and writing the obtained encoded bits into the bitstream.
[0314] It should be noted that, in the embodiments of this application, the multi-transform set candidates can be constructed in the form of arrays, lists, or sets. For example, taking the first candidate list as an example, the first candidate list can be represented as a list, array, or set. In some embodiments, the method may further include: determining the first candidate list for the current block based on at least two candidate intra-frame prediction modes.
[0315] In this embodiment, it is assumed that the first candidate list can indicate at least two sets of candidate transforms. Here, since each candidate intra-prediction mode corresponds to a set of candidate transforms, the first candidate list can include at least two candidate intra-prediction modes; or it can include at least two sets of candidate transforms, without any limitation.
[0316] In one possible implementation, the first syntax element may indicate the index number of the intra-prediction mode of the current block in the first candidate list. Specifically, if the first candidate list includes only two candidate intra-prediction modes, the value of the first syntax element may include two values, such as 0 or 1; if the first candidate list includes three candidate intra-prediction modes, the value of the first syntax element may include three values, such as 0, 1, or 2; if the first candidate list includes four or more candidate intra-prediction modes, the value of the first syntax element may include four or more values, such as 0, 1, 2, 3, 4, etc., without any limitation.
[0317] It is also understood that, in the embodiments of this application, in order to reduce complexity, only two candidate intra-prediction modes can be selected from these at least two candidate intra-prediction modes to form the first candidate list of the current block, thereby saving bit overhead in the bitstream. In some embodiments, determining the transform set of the current block based on at least two candidate intra-prediction modes may include: determining two candidate intra-prediction modes of the current block from at least two candidate intra-prediction modes; and determining the transform set of the current block based on the two candidate intra-prediction modes.
[0318] It should be noted that, in the embodiments of this application, two candidate intra-prediction modes can be selected from these at least two candidate intra-prediction modes to form a first candidate list, thereby determining the transform set of the current block.
[0319] In some embodiments, determining two candidate intra-prediction modes for the current block from at least two candidate intra-prediction modes may include: determining a first candidate intra-prediction mode for the current block from at least two candidate intra-prediction modes; determining a second candidate intra-prediction mode, whose indicated candidate transform set is different from the first candidate transform set, from at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, based on a first candidate transform set indicated by the first candidate intra-prediction mode; and determining two candidate intra-prediction modes for the current block based on the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0320] It should be noted that, in the embodiments of this application, any one of the at least two candidate intra-prediction modes can be selected as the first candidate intra-prediction mode, or the candidate intra-prediction mode in the first position among the at least two candidate intra-prediction modes can be selected as the first candidate intra-prediction mode, or the intra-prediction mode corresponding to the highest magnitude accumulation value in the gradient histogram of the current block can be selected as the first candidate intra-prediction mode, without any limitation.
[0321] It should also be noted that, for these at least two candidate intra-prediction modes, if there is a candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the other candidate intra-prediction modes besides the first candidate intra-prediction mode, then it is determined as the second candidate intra-prediction mode, and then the first candidate intra-prediction mode and the second candidate intra-prediction mode are determined as the two candidate intra-prediction modes of the current block to form the first candidate list.
[0322] Furthermore, in this embodiment, if among the candidate intra-prediction modes other than the first candidate intra-prediction mode, there are multiple candidate intra-prediction modes whose indicated candidate transform sets are different from the first candidate transform set, then the first candidate intra-prediction mode found that is different from the first candidate transform set can be determined as the second candidate intra-prediction mode. That is, the transform sets indicated by the first candidate intra-prediction mode and the second candidate intra-prediction mode are different.
[0323] It should also be noted that in the first candidate list, the first candidate intra-prediction mode can be represented by modeForTrans0, and the second candidate intra-prediction mode can be represented by modeForTrans1.
[0324] In some embodiments, the method may further include: when there is no second candidate intra-prediction mode among at least two candidate intra-prediction modes other than the first candidate intra-prediction mode that has a different candidate transform set from the first candidate transform set, adjusting the first candidate intra-prediction mode according to a preset offset to determine the second candidate intra-prediction mode; and determining two candidate intra-prediction modes for the current block according to the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0325] In the embodiments of this application, if there is no second candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the other candidate intra-prediction modes besides the first candidate intra-prediction mode, that is, the candidate transform sets corresponding to at least two candidate intra-prediction modes are the same, then a new second candidate intra-prediction mode can be obtained by adding a preset offset to the first candidate intra-prediction mode, and the indicated transform set is different from the first candidate transform set.
[0326] For example, the preset offset can be set to 2, but this is not limited in any way. In one possible implementation, if the mode index of the first candidate intra-prediction mode is 51 and the index identifier of its corresponding first candidate transform set is 17, then the mode index of the second candidate intra-prediction mode is 53 and the index identifier of its corresponding second candidate transform set is 15; then the first candidate intra-prediction mode and the second candidate intra-prediction mode can be determined as the two candidate intra-prediction modes of the current block to form the first candidate list.
[0327] For example, after determining at least two candidate intra-prediction modes for the current block, such as dimdMode0, dimdMode1, dimdMode2, and dmMode, these four candidate intra-prediction modes can be determined as the first candidate list for the current block. However, considering complexity and list length, two candidate intra-prediction modes for the current block can be determined from these at least two candidate intra-prediction modes to form the first candidate list for the current block, thereby shortening the list length, for example, the length of the first candidate list can be equal to 2.
[0328] In another possible implementation, determining the transform set of the current block based on two candidate intra-prediction modes may include: two sets of candidate transform sets indicated by the two candidate intra-prediction modes; calculating the coding cost of the current block based on the two sets of candidate transform sets, and determining the cost result corresponding to each of the two sets of candidate transform sets; determining the minimum cost result among the cost results corresponding to each of the two sets of candidate transform sets, and determining the candidate transform set corresponding to the minimum cost result as the transform set of the current block.
[0329] In this implementation, after determining two candidate intra-prediction modes (e.g., the first candidate intra-prediction mode and the second candidate intra-prediction mode), two candidate transform sets for the current block can be determined first based on the mapping relationship between the intra-prediction modes and transform sets. Then, based on coding cost calculation, such as RDO cost calculation, the transform set for the current block is determined from these two candidate transform sets. Finally, based on the mapping relationship between the intra-prediction modes and transform sets, the intra-prediction mode for the current block can also be determined from these two candidate intra-prediction modes. The candidate transform set corresponding to the minimum cost result is the transform set for the current block, and the corresponding candidate intra-prediction mode is the intra-prediction mode for the current block.
[0330] In some embodiments, the method may further include: determining the intra-prediction mode of the current block based on the candidate transform set corresponding to the minimum cost result; determining the value of the first syntax element; encoding the value of the first syntax element; and writing the obtained encoded bits into the bitstream.
[0331] In this embodiment, the first syntax element can be used to indicate the index number of the intra-prediction mode of the current block among two candidate intra-prediction modes. In this case, the value of the first syntax element includes only two values, such as 0 or 1. For example, if the value of the first syntax element is 0, the candidate intra-prediction mode at the first position in the first candidate list can be determined as the intra-prediction mode of the current block; if the value of the first syntax element is 1, the candidate intra-prediction mode at the second position in the first candidate list can be determined as the intra-prediction mode of the current block.
[0332] In some embodiments, the value of the first syntax element is first set to 0, and the final transform set is determined according to the mapping relationship between modeForTrans0 and the intra-prediction mode and transform set; then, transform and quantization, inverse quantization and inverse transform operations are performed, and the rate-distortion cost of this mode is recorded. Similarly, the value of the first syntax element is set to 1, and the final transform set is determined according to the mapping relationship between modeForTrans1 and the intra-prediction mode and transform set; then, transform and quantization, inverse quantization and inverse transform operations are performed, and the rate-distortion cost of this mode is recorded. The values of the first syntax elements with smaller rate-distortion costs are saved and used for writing to the bitstream.
[0333] In this way, the transform set used by the current block can be determined at the decoding end based on the value of the first syntax element and at least two sets of candidate intra-frame prediction modes, so that the selection range of the transform set is no longer singular, thereby improving the accuracy of transform prediction.
[0334] It should also be noted that, in the embodiments of this application, the first syntax element and the second syntax element are different. The first syntax element is used to indicate the index number corresponding to the intra-prediction mode of the current block. Since different intra-prediction modes correspond to different transform sets, the first syntax element can also be called a "transform set index identifier". The second syntax element is used to indicate whether the current block uses a low-frequency non-separable transform method or whether the current block uses a non-separable master transform method. Typically, the second syntax element can be represented by lfnstIdx.
[0335] It should also be noted that, in the embodiments of this application, for the first chromaticity prediction block Cb and the second chromaticity prediction block Cr of the current block, different chromaticity prediction blocks can use the same transform set. That is, in this case, the same transform set index identifier (first syntax element) is used to indicate the operation of the chromaticity blocks corresponding to the two chromaticity components Cb and Cr. Alternatively, different chromaticity prediction blocks can also use different transform sets. That is, in this case, different transform set index identifiers are used. In this case, two transform set index identifiers can be set to indicate the operation of the chromaticity blocks corresponding to the two chromaticity components Cb and Cr respectively; there are no limitations on this.
[0336] S2303, determine the transform kernel of the current block based on the transform set of the current block.
[0337] In this embodiment of the application, after determining the transform set of the current block, the transform kernel of the current block can then be determined. In some embodiments, the method may include: determining at least two candidate transform kernels included in the transform set; calculating the encoding cost of the current block based on the at least two candidate transform kernels, and determining the cost result corresponding to each of the at least two candidate transform kernels; determining the minimum cost result among the cost results corresponding to each of the at least two candidate transform kernels, and determining the candidate transform kernel corresponding to the minimum cost result as the transform kernel of the current block.
[0338] In the embodiments of this application, the coding cost calculation can be determined based on the cost result of Rate Distortion Optimization (RDO), the cost result of Sum of Absolute Difference (SAD), or even the cost result of Sum of Absolute Transformed Difference (SATD), but no limitation is made here.
[0339] In one specific embodiment, calculating the encoding cost of the current block based on at least two candidate transform kernels and determining the cost result corresponding to each of the at least two candidate transform kernels may include: transforming and quantizing the residual sample of the current block based on the first candidate transform kernel to determine the first candidate quantization coefficient of the current block, and performing entropy encoding processing on the first candidate quantization coefficient to determine the first generation value of the first candidate transform kernel; performing inverse quantization and inverse transform on the first candidate quantization coefficient to determine the first candidate residual sample of the current block, and determining the first candidate prediction sample of the current block based on the first candidate residual sample; calculating the cost based on the first candidate prediction sample and the initial sample of the current block to determine the second generation value of the first candidate transform kernel; and determining the cost result corresponding to the first candidate transform kernel based on the first generation value and the second generation value of the first candidate transform kernel; wherein the first candidate transform kernel is any one of the at least two candidate transform kernels.
[0340] In some embodiments, the method may further include: determining the value of a second syntax element based on the transform kernel of the current block; wherein the value of the second syntax element is used to indicate the index number of the transform kernel of the current block in the transform set.
[0341] It should be noted that the second syntax element is represented by lfnstIdx, and its value can be 0, 1, 2, 3, etc. If the value of lfnstIdx is greater than 0, then it is determined that the current block uses either a low-frequency inseparable transform or a inseparable master transform. That is, in this embodiment, if the value of the second syntax element is greater than 0, then the value of the second syntax element can also indicate the index number of the transform kernel of the current block in the transform set. In this case, the actual value of the second syntax element can be determined based on the index number of the transform kernel of the current block in the transform set.
[0342] For example, assuming the transform set includes 3 candidate transform kernels, if the transform kernel of the current block is the first candidate transform kernel in the transform set of the current block, then the value of the second syntax element is determined to be equal to 1; if the transform kernel of the current block is the second candidate transform kernel in the transform set of the current block, then the value of the second syntax element is determined to be equal to 2; if the transform kernel of the current block is the third candidate transform kernel in the transform set of the current block, then the value of the second syntax element is determined to be equal to 3.
[0343] Thus, after the value of the second syntax element is written into the bitstream, and the transform set of the current block is subsequently determined, the transform kernel of the current block can be determined based on the actual value of the second syntax element.
[0344] S2304, determine the quantization coefficients of the current block based on the transform kernel and the residual samples of the current block.
[0345] S2305 encodes the quantization coefficients of the current block and writes the resulting encoded bits into the bitstream.
[0346] It should be noted that, in the embodiments of this application, it is also necessary to determine the quantization coefficients of the current block. In some embodiments, the method may further include: performing a transform based on the transform kernel and the residual samples of the current block to determine the transform coefficients of the current block; quantizing the transform coefficients of the current block to determine the quantization coefficients of the current block. After obtaining the quantization coefficients of the current block, the quantization coefficients of the current block can be encoded to write them into the bitstream.
[0347] It should also be noted that, in the embodiments of this application, when performing transformation based on the transform kernel and the residual samples of the current block to determine the transform coefficients of the current block, it may include: performing an inseparable principal transform on the residual samples of the current block based on the transform kernel to determine the transform coefficients of the current block; or performing a discrete cosine transform on the residual samples of the current block to determine the intermediate transform coefficients of the current block; and performing a low-frequency inseparable transform on the intermediate transform coefficients of the current block based on the transform kernel to determine the transform coefficients of the current block.
[0348] In one possible implementation, when the current block uses a low-frequency non-separable transformation method and the size parameters of the current block meet the first condition, the non-separable master transformation is performed on the residual samples of the current block according to the transformation kernel to determine the transformation coefficients of the current block.
[0349] In another possible implementation, if the current block uses a low-frequency non-separable transform method and the size parameters of the current block satisfy the second condition, a discrete cosine transform is performed on the residual samples of the current block to determine the intermediate transform coefficients of the current block; and a low-frequency non-separable transform is performed on the intermediate transform coefficients of the current block according to the transform kernel to determine the transform coefficients of the current block.
[0350] Here, the size parameter of the current block satisfies the first condition, which may include: the size parameter of the current block is small, for example, the size parameter of the current block is less than a certain threshold. That is, for smaller blocks, the NSPT transform kernel is used here, that is, the NSPT transform is performed on the residual samples of the current block according to the transform kernel to determine the transform coefficients of the current block. For example, as shown in Figure 12, when the size parameter of the current block is 4×4, 4×8, 8×4, 4×16, 16×4; or 8×8, 8×16, 16×8, the current block uses the NSPT transform.
[0351] Here, the size parameter of the current block satisfies the second condition, which may include: the size parameter of the current block is relatively large, for example, the size parameter of the current block is greater than a certain threshold. That is, for larger blocks, the LFNST transform kernel is used here. In this case, the discrete cosine transform is first performed on the residual samples of the current block to determine the intermediate transform coefficients of the current block; then, the LFNST transform is performed on the intermediate transform coefficients of the current block according to the transform kernel to determine the transform coefficients of the current block. For example, as shown in Figure 12, when the size parameter of the current block is M×N (M, N≥16), the current block uses DCT+LFNST transform.
[0352] In some embodiments, the method may further include: performing intra-frame prediction on the current block to determine the prediction samples of the current block; and determining the residual samples of the current block based on the initial samples of the current block and the prediction samples of the current block.
[0353] It should be noted that, in the embodiments of this application, after determining the prediction sample of the current block (e.g., the first chroma prediction block or the second chroma prediction block), the initial sample of the current block and the prediction sample of the current block can be subtracted to determine the residual sample of the current block; then, based on the transform kernel and the residual sample of the current block, transformation and quantization are performed to determine the quantization coefficient of the current block, and finally the quantization coefficient of the current block is encoded into the bitstream.
[0354] In another embodiment of this application, based on the encoding and decoding methods in the foregoing embodiments, this application proposes an improved scheme for NSPT / LFNST multi-transform set selection under chroma blocks. By providing a variety of different intra-frame prediction modes, and determining a specific intra-frame prediction mode for indicating the transform set according to a transform set index identifier, the transform set used by NSPT / LFNST is determined through the mapping relationship between the intra-frame prediction mode and the transform set.
[0355] In the embodiments of this application, the above-mentioned chromaticity mode is applicable to all chromaticity modes, including but not limited to cross-component prediction mode. The following embodiments are described using cross-component prediction mode as an example, but the method proposed here can also be applied to other chromaticity prediction modes.
[0356] In one possible implementation, at the decoding end, one embodiment of this technical solution is as follows:
[0357] During the bitstream parsing stage, a decision is made based on specific conditions to determine whether to parse the transform set index identifier (i.e., the aforementioned "first syntax element"). These specific conditions may be: if the current block is a chroma block, the prediction mode is cross-component prediction mode, and the value of lfnstIdx is greater than 0, then the transform set index identifier is parsed from the bitstream. In this embodiment, the transform set index identifier is either 0 or 1.
[0358] During the reconstruction phase of the current block, after prediction is complete, it is determined whether to construct multiple transform set candidates based on the aforementioned specific conditions. If the specific conditions are met, the following operations are performed:
[0359] First, the predicted pixels of the chroma prediction block are input. Following the DIMD method, the gradient histogram (HoG) of the current block is constructed. Specifically, the HoG construction process involves using a 3×3 sliding window, as shown in Figure 18, to calculate the horizontal gradient value G of each 3×3 sliding window in both chroma channels (e.g., the first chroma prediction block Cb and the second chroma prediction block Cr). x and vertical gradient value G y G x and G yThese are obtained by multiplying the predicted values within the window position by the 3×3 horizontal Sobel filter and vertical Sobel filter, as shown in Figure 2. Assuming the chroma prediction block is a block with dimensions (W, H), a 3×3 sliding window can calculate the horizontal and vertical gradient values, as well as the corresponding gradient magnitude values, at 2*(W-2)*(H-2) pixel positions at the center of the chroma prediction block. The gradient magnitude value G at each position is accumulated over its derived conventional angle category to obtain a gradient histogram for the first chroma prediction block Cb. Similarly, a gradient histogram for the second chroma prediction block Cr can be obtained. The two gradient histograms are added together to obtain the gradient histograms corresponding to the first chroma prediction block Cb and the second chroma prediction block Cr. Finally, the three conventional angles with the largest accumulated magnitude values are selected as candidate intra-frame prediction modes corresponding to the current chroma prediction block, denoted as dimdMode0, dimdMode1, and dimdMode2. Additionally, according to the DM method, a conventional prediction mode is derived from the co-position luma block as the fourth candidate intra-frame prediction mode dmMode.
[0360] Then, based on the above four candidate intra-prediction modes, two final intra-prediction mode candidates, denoted as modeForTrans0 and modeForTrans1, are constructed to indicate the transform set. Since different intra-prediction modes may derive the same transform set, the final intra-prediction mode candidate needs to be determined through the following operations: First, set dimdMode0 to modeForTrans0. Then, compare the transform sets indicated by dimdMode1, dimdMode2, and dmMode with the transform set indicated by modeForTrans0 in sequence. If they are different, set the corresponding intra-prediction mode to modeForTrans1 and end the process. If no different transform sets appear, add a preset offset to dimdMode0 to obtain an intra-prediction mode indicating a different transform set, and set it to modeForTrans1.
[0361] Finally, the transform set used by the current block is determined based on the transform set index identifier. If the transform set index identifier is 0, the final transform set is determined according to the mapping relationship between modeForTrans0 and the intra-prediction mode and the transform set. Similarly, if the transform set index identifier is 1, the final transform set is determined according to the mapping relationship between modeForTrans1 and the intra-prediction mode and the transform set.
[0362] The process of the above operation is shown in Figure 21 above.
[0363] Then, the decoder will select a specific transform kernel from the transform set based on the value of lfnstIdx to perform the inverse transform and complete the reconstruction of the decoded block.
[0364] In another possible implementation, one way to implement this technical solution at the encoding end is as follows:
[0365] After prediction, a decision is made based on specific conditions to determine whether to construct a multi-transform set candidate. These conditions are as follows: if the current block is a chroma block, the prediction mode is cross-component prediction mode, and the value of lfnstIdx is greater than 0. If these conditions are met, the following operations are performed to construct the multi-transform set candidate:
[0366] First, the predicted pixels of the chroma prediction block are input. Following the DIMD method, the gradient histogram (HoG) of the current block is constructed. Specifically, the HoG construction process involves using a 3×3 sliding window, as shown in Figure 18, to calculate the horizontal gradient value G of each 3×3 sliding window in both chroma channels (e.g., the first chroma prediction block Cb and the second chroma prediction block Cr). x and vertical gradient value G y G x and G y These are obtained by multiplying the predicted values within the window position by the 3×3 horizontal Sobel filter and vertical Sobel filter, as shown in Figure 2. Assuming the chroma prediction block is a block with dimensions (W, H), a 3×3 sliding window can calculate the horizontal and vertical gradient values, as well as the corresponding gradient magnitude values, at 2*(W-2)*(H-2) pixel positions at the center of the chroma prediction block. The gradient magnitude value G at each position is accumulated over its derived conventional angle category to obtain a gradient histogram for the first chroma prediction block Cb. Similarly, a gradient histogram for the second chroma prediction block Cr can be obtained. The two gradient histograms are added together to obtain the gradient histograms corresponding to the first chroma prediction block Cb and the second chroma prediction block Cr. Finally, the three conventional angles with the largest accumulated magnitude values are selected as candidate intra-frame prediction modes corresponding to the current chroma prediction block, denoted as dimdMode0, dimdMode1, and dimdMode2. Additionally, according to the DM method, a conventional prediction mode is derived from the co-position luma block as the fourth candidate intra-frame prediction mode dmMode.
[0367] Then, based on the above four candidate intra-prediction modes, two final intra-prediction mode candidates are constructed, denoted as modeForTrans0 and modeForTrans1. Since different intra-prediction modes may derive the same transform set, the final intra-prediction mode candidates are determined through the following operations: First, set dimdMode0 to modeForTrans0. Then, compare the transform sets indicated by dimdMode1, dimdMode2, and dmMode with the transform set indicated by modeForTrans0. If they are different, set the corresponding intra-prediction mode to modeForTrans1 and end the process. If no different transform sets appear, add a preset offset to dimdMode0 to obtain an intra-prediction mode indicating a different transform set, and set it to modeForTrans1.
[0368] Finally, the rate-distortion cost corresponding to different transform set index identifiers is calculated. First, the transform set index identifier is set to 0, and the final transform set is determined based on the mapping relationship between modeForTrans0 and the intra-prediction mode and transform set. Then, transform and quantization, inverse quantization and inverse transform operations are performed, and the rate-distortion cost for this mode is recorded. Similarly, the transform set index identifier is set to 1, and the final transform set is determined based on the mapping relationship between modeForTrans1 and the intra-prediction mode and transform set. Then, transform and quantization, inverse quantization and inverse transform operations are performed, and the rate-distortion cost for this mode is recorded. The values of the transform set index identifiers with smaller rate-distortion costs are saved and used for writing to the bitstream.
[0369] In one possible implementation, using All Intra Main 10 and Over ECM14.0 as test conditions, the test results obtained by the technical solution of this application embodiment are shown in Table 2. According to the test results in Table 2, the encoding performance is improved for both chroma components U and V.
[0370] Table 2
[0371] It should be noted that, in the embodiments of this application, this technical solution can be applied not only to traditional chroma intra-frame prediction modes, but also to some other non-traditional chroma intra-frame prediction modes, such as DBV mode.
[0372] It should also be noted that, in the embodiments of this application, the technical solution can use a transform set index identifier to indicate the operation of the chromaticity blocks corresponding to the Cb and Cr chromaticity components. Another possible implementation is to set two transform set index identifiers to respectively indicate the operation of the chromaticity blocks corresponding to the Cb and Cr chromaticity components.
[0373] In this application embodiment, the specific implementation of the aforementioned embodiments is described in detail through the above embodiments. It can be seen that, according to the technical solution of the aforementioned embodiments, the main focus here is on improving the transform kernel derivation method in the chroma prediction mode. In the chroma prediction mode of related technologies, the selection of the transform set is based on an intra-prediction mode specified in the current block and determined according to the mapping relationship between the intra-prediction mode and the NSPT / LFNST transform set. However, this application embodiment proposes to provide multiple traditional intra-prediction mode candidates and determine a specific intra-prediction mode based on the first syntax element, thereby determining the final transform set according to the mapping relationship between the intra-prediction mode and the NSPT / LFNST transform set, effectively improving the compression efficiency of the transform technology.
[0374] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG24 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG24, the encoder 240 may include a first determining unit 2401 and an encoding unit 2402, wherein:
[0375] The first determining unit 2401 is configured to, when the current block meets the preset conditions, determine at least two candidate intra-prediction modes of the current block; determine the transform set of the current block based on the at least two candidate intra-prediction modes; determine the transform kernel of the current block based on the transform set of the current block; and determine the quantization coefficients of the current block based on the transform kernel and the residual samples of the current block.
[0376] Encoding unit 2402 is configured to encode the quantization coefficients of the current block and write the resulting encoded bits into the bit stream.
[0377] In some embodiments, referring to FIG24, the encoder 240 may further include a transformation unit 2403 and a quantization unit 2404, wherein: the transformation unit 2403 is configured to perform transformation based on the transformation kernel and the residual sample of the current block to determine the transformation coefficients of the current block; the quantization unit 2404 is configured to quantize the transformation coefficients of the current block to determine the quantization coefficients of the current block.
[0378] In some embodiments, the transformation unit 2403 is further configured to: when the current block uses a low-frequency non-separable transformation method and the size parameters of the current block meet a first condition, perform a non-separable master transformation on the residual samples of the current block according to the transformation kernel to determine the transformation coefficients of the current block; or, if the current block uses a low-frequency non-separable transformation method and the size parameters of the current block meet a second condition, perform a discrete cosine transformation on the residual samples of the current block to determine the intermediate transformation coefficients of the current block; and perform a low-frequency non-separable transformation on the intermediate transformation coefficients of the current block according to the transformation kernel to determine the transformation coefficients of the current block.
[0379] In some embodiments, the current block satisfies preset conditions, including at least one of the following: the current block is a chroma block; the prediction mode of the current block is a first chroma mode; the value of the second syntax element is greater than 0; wherein the second syntax element is used to indicate whether the current block uses a low-frequency inseparable transform mode or whether the current block uses an inseparable master transform mode.
[0380] In some embodiments, the first determining unit 2401 is further configured to determine the value of the second syntax element; the encoding unit 2402 is further configured to encode the value of the second syntax element and write the obtained encoded bits into the bitstream.
[0381] In some embodiments, the first determining unit 2401 is further configured to determine a chroma prediction block of the current block; determine a gradient histogram of the current block based on candidate samples in the chroma prediction block; and determine at least two candidate intra-prediction modes of the current block based on the gradient histogram of the current block.
[0382] In some embodiments, the first determining unit 2401 is further configured to determine the horizontal gradient value and the vertical gradient value of the candidate sample; determine the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample based on the horizontal gradient value and the vertical gradient value of the candidate sample; and determine the gradient histogram of the current block based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample.
[0383] In some embodiments, the first determining unit 2401 is further configured to perform angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the candidate intra-frame prediction mode corresponding to the candidate sample; and to perform absolute value summation operation based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the gradient magnitude value corresponding to the candidate sample.
[0384] In some embodiments, the first determining unit 2401 is further configured to: determine at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value when the number of candidate samples is at least one; determine at least one reference intra-prediction mode with distinct characteristics based on the at least one candidate intra-prediction mode, and perform an accumulation operation on the gradient magnitude values belonging to the same reference intra-prediction mode to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode; and determine the gradient histogram of the current block based on the at least one reference intra-prediction mode and the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode.
[0385] In some embodiments, the first determining unit 2401 is further configured to: determine a first chroma prediction block and a second chroma prediction block for the current block; determine a first gradient histogram based on candidate samples in the first chroma prediction block, and determine a second gradient histogram based on the second chroma prediction block; determine the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram; and determine at least two candidate intra-frame prediction modes for the current block based on the gradient histogram of the current block.
[0386] In some embodiments, the first determining unit 2401 is further configured to perform an accumulation operation on the gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding magnitude accumulation value; and to determine the gradient histogram of the current block based on the at least one reference intra-prediction mode and its corresponding magnitude accumulation value.
[0387] In some embodiments, the first determining unit 2401 is further configured to sort the gradient histogram of the current block from high to low according to the magnitude accumulation value, determine at least two reference intra-prediction modes that are ranked first; and determine the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0388] In some embodiments, the first determining unit 2401 is further configured to determine the corresponding luminance block of the current block when the current block uses the direct export mode; and to determine at least one candidate intra-frame prediction mode of the current block according to the luminance prediction mode used by the luminance block.
[0389] In some embodiments, the first determining unit 2401 is further configured to determine two candidate intra-prediction modes of the current block from at least two candidate intra-prediction modes; and to determine a transform set of the current block based on the two candidate intra-prediction modes.
[0390] In some embodiments, the first determining unit 2401 is further configured to: determine a first candidate intra-prediction mode for the current block from at least two candidate intra-prediction modes; determine a second candidate intra-prediction mode from at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, based on a first candidate transform set indicated by the first candidate intra-prediction mode, where the indicated candidate transform set is different from the first candidate transform set; and determine two candidate intra-prediction modes for the current block based on the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0391] In some embodiments, the first determining unit 2401 is further configured to, when there is no second candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, adjust the first candidate intra-prediction mode according to a preset offset to determine the second candidate intra-prediction mode; and determine two candidate intra-prediction modes of the current block according to the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0392] In some embodiments, the first determining unit 2401 is further configured to determine two sets of candidate transform sets indicated by two candidate intra-prediction modes; calculate the coding cost of the current block according to the two sets of candidate transform sets, determine the cost result corresponding to each of the two sets of candidate transform sets; and determine the minimum cost result among the cost results corresponding to each of the two sets of candidate transform sets, and determine the candidate transform set corresponding to the minimum cost result as the transform set of the current block.
[0393] In some embodiments, the first determining unit 2401 is further configured to determine the intra-prediction mode of the current block based on the candidate transform set corresponding to the minimum cost result; and to determine the value of the first syntax element; wherein the first syntax element is used to indicate the index number of the intra-prediction mode of the current block in the two candidate intra-prediction modes; the encoding unit 2402 is further configured to encode the value of the first syntax element and write the obtained encoded bits into the bitstream.
[0394] In some embodiments, the first determining unit 2401 is further configured to determine at least two candidate transform kernels included in the transform set; calculate the encoding cost of the current block based on the at least two candidate transform kernels, determine the cost result corresponding to each of the at least two candidate transform kernels; and determine the minimum cost result among the cost results corresponding to each of the at least two candidate transform kernels, and determine the candidate transform kernel corresponding to the minimum cost result as the transform kernel of the current block.
[0395] In some embodiments, the first determining unit 2401 is further configured to determine the value of the second syntax element based on the transform kernel of the current block; wherein the value of the second syntax element is used to indicate the index number of the transform kernel of the current block in the transform set.
[0396] In some embodiments, referring to FIG24, the encoder 240 may further include a first prediction unit 2405 configured to perform intra-frame prediction on the current block to determine the prediction sample of the current block; and a first determination unit 2401 configured to determine the residual sample of the current block based on the initial sample of the current block and the prediction sample of the current block.
[0397] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0398] In another embodiment of this application, FIG25 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application. As shown in FIG25, the encoder 240 may include: a first communication interface 2501, a first memory 2502, and a first processor 2503; the various components are coupled together through a first bus system 2504. It is understood that the first bus system 2504 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 2504 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as the first bus system 2504 in FIG25.
[0399] The first communication interface 2501 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0400] The first memory 2502 is used to store computer programs that can run on the first processor 2503;
[0401] The first processor 2503 is configured to, when running the computer program, execute:
[0402] When the current block meets the preset conditions, at least two candidate intra-prediction modes for the current block are determined; based on the at least two candidate intra-prediction modes, the transform set for the current block is determined; based on the transform set for the current block, the transform kernel for the current block is determined; based on the transform kernel and the residual samples of the current block, the quantization coefficients for the current block are determined; the quantization coefficients for the current block are encoded, and the resulting encoded bits are written into the bitstream.
[0403] It is understood that the first memory 2502 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 2502 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0404] The first processor 2503 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 2503 or by instructions in software form. The first processor 2503 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 2502. The first processor 2503 reads the information in the first memory 2502 and completes the steps of the above method in conjunction with its hardware.
[0405] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0406] Alternatively, as another embodiment, the first processor 2503 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0407] This embodiment provides an encoder that, when the current block meets preset conditions, firstly determines at least two candidate intra-prediction modes for the current block, and then determines the transform set for the current block based on these at least two candidate intra-prediction modes. Since at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thereby enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique and thus enhancing coding performance.
[0408] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG26 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG26, the decoder 260 may include a decoding unit 2601 and a second determining unit 2602, wherein:
[0409] Decoding unit 2601 is configured to parse the first syntax element in the code stream when the current block meets preset conditions;
[0410] The second determining unit 2602 is configured to determine at least two candidate intra-prediction modes for the current block; determine the transform set of the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes; determine the transform kernel of the current block based on the transform set of the current block; and perform an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual samples of the current block.
[0411] In some embodiments, the current block satisfies preset conditions, including at least one of the following: the current block is a chroma block; the prediction mode of the current block is a first chroma mode; the value of the second syntax element in the parsed bitstream is greater than 0; wherein the second syntax element is used to indicate whether the current block uses a low-frequency inseparable transform mode or whether the current block uses an inseparable master transform mode.
[0412] In some embodiments, the second determining unit 2602 is further configured to determine a chroma prediction block of the current block; determine a gradient histogram of the current block based on candidate samples in the chroma prediction block; and determine at least two candidate intra-prediction modes of the current block based on the gradient histogram of the current block.
[0413] In some embodiments, the second determining unit 2602 is further configured to determine the horizontal gradient value and the vertical gradient value of the candidate sample; determine the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample based on the horizontal gradient value and the vertical gradient value of the candidate sample; and determine the gradient histogram of the current block based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample.
[0414] In some embodiments, the second determining unit 2602 is further configured to perform angle mapping based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the candidate intra-frame prediction mode corresponding to the candidate sample; and to perform absolute value summation based on the horizontal gradient value and vertical gradient value of the candidate sample to determine the gradient magnitude value corresponding to the candidate sample.
[0415] In some embodiments, the second determining unit 2602 is further configured to: when the number of candidate samples is at least one, determine at least one candidate intra-prediction mode and at least one corresponding gradient magnitude value; determine at least one reference intra-prediction mode with distinct characteristics based on the at least one candidate intra-prediction mode, and perform an accumulation operation on the gradient magnitude values belonging to the same reference intra-prediction mode to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode; and determine the gradient histogram of the current block based on the at least one reference intra-prediction mode and its corresponding magnitude accumulation value.
[0416] In some embodiments, the second determining unit 2602 is further configured to: determine a first chroma prediction block and a second chroma prediction block for the current block; determine a first gradient histogram based on candidate samples in the first chroma prediction block, and determine a second gradient histogram based on the second chroma prediction block; determine the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram; and determine at least two candidate intra-frame prediction modes for the current block based on the gradient histogram of the current block.
[0417] In some embodiments, the second determining unit 2602 is further configured to perform an accumulation operation on the gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram to determine at least one reference intra-prediction mode and its corresponding magnitude accumulation value; and to determine the gradient histogram of the current block based on the at least one reference intra-prediction mode and its corresponding magnitude accumulation value.
[0418] In some embodiments, the second determining unit 2602 is further configured to sort the gradient histogram of the current block from high to low according to the magnitude accumulation value, determine at least two reference intra-prediction modes that are ranked first; and determine the at least two reference intra-prediction modes as at least two candidate intra-prediction modes for the current block.
[0419] In some embodiments, the second determining unit 2602 is further configured to determine the corresponding luminance block of the current block when the current block uses the direct export mode; and to determine at least one candidate intra-frame prediction mode of the current block according to the luminance prediction mode used by the luminance block.
[0420] In some embodiments, the second determining unit 2602 is further configured to determine the intra prediction mode of the current block based on the value of the first syntax element and at least two candidate intra prediction modes; and to determine the transform set of the current block based on the intra prediction mode of the current block and the mapping relationship between the intra prediction mode and the transform set.
[0421] In some embodiments, the second determining unit 2602 is further configured to determine two candidate intra-prediction modes of the current block from at least two candidate intra-prediction modes; and to determine the intra-prediction mode of the current block based on the value of the first syntax element and the two candidate intra-prediction modes.
[0422] In some embodiments, the second determining unit 2602 is further configured to: determine a first candidate intra-prediction mode for the current block from at least two candidate intra-prediction modes; determine a second candidate intra-prediction mode from at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, based on a first candidate transform set indicated by the first candidate intra-prediction mode, where the indicated candidate transform set is different from the first candidate transform set; and determine two candidate intra-prediction modes for the current block based on the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0423] In some embodiments, the second determining unit 2602 is further configured to, when there is no second candidate intra-prediction mode among at least two candidate intra-prediction modes other than the first candidate intra-prediction mode that has a different candidate transform set from the first candidate transform set, adjust the first candidate intra-prediction mode according to a preset offset to determine the second candidate intra-prediction mode; and determine two candidate intra-prediction modes for the current block according to the first candidate intra-prediction mode and the second candidate intra-prediction mode.
[0424] In some embodiments, the second determining unit 2602 is further configured to determine the transform kernel of the current block based on the value of the second syntax element and the transform set of the current block.
[0425] In some embodiments, referring to FIG26, the decoder 260 may further include an inverse quantization unit 2603, wherein: the decoding unit 2601 is further configured to parse the quantization coefficients of the current block in the bitstream; the inverse quantization unit 2603 is configured to inverse quantize the quantization coefficients of the current block to determine the inverse quantization coefficients of the current block.
[0426] In some embodiments, referring to FIG26, the decoder 260 may further include an inverse transform unit 2604, configured to perform an inseparable master transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual samples of the current block when the current block uses a low-frequency inseparable transform method and the size parameters of the current block meet a first condition; or, if the current block uses a low-frequency inseparable transform method and the size parameters of the current block meet a second condition, perform a low-frequency inseparable transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the inverse transform coefficients of the current block; and perform a discrete cosine transform on the inverse transform coefficients of the current block to determine the residual samples of the current block.
[0427] In some embodiments, referring to FIG26, the decoder 260 may further include a second prediction unit 2605 configured to perform intra-frame prediction on the current block to determine the prediction sample of the current block; and a second determination unit 2602 configured to determine the reconstructed sample of the current block based on the prediction sample of the current block and the residual sample of the current block.
[0428] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.
[0429] In another embodiment of this application, FIG27 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application. As shown in FIG27, the decoder 260 may include: a second communication interface 2701, a second memory 2702, and a second processor 2703; the various components are coupled together through a second bus system 2704. It is understood that the second bus system 2704 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 2704 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the second bus system 2704 in FIG27.
[0430] The second communication interface 2701 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0431] The second memory 2702 is used to store computer programs that can run on the second processor 2703;
[0432] The second processor 2703 is configured to perform the following when running the computer program:
[0433] When the current block meets the preset conditions, parse the first syntax element in the bitstream; determine at least two candidate intra-prediction modes for the current block; determine the transform set for the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes; determine the transform kernel for the current block based on the transform set for the current block; perform an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual samples of the current block.
[0434] Alternatively, as another embodiment, the second processor 2703 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0435] It is understood that the second memory 2702 has similar hardware functions to the first memory 2502, and the second processor 2703 has similar hardware functions to the first processor 2703; details will not be elaborated here.
[0436] This embodiment provides a decoder that, when the current block meets preset conditions, firstly needs to determine at least two candidate intra-prediction modes for the current block, and then determines the transform set of the current block based on these at least two candidate intra-prediction modes. Since at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thereby enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique, and thus enhancing the decoding performance.
[0437] In another embodiment of this application, FIG28 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. As shown in FIG28, the encoding and decoding system 280 may include an encoder 2801 and a decoder 2802.
[0438] In this embodiment, encoder 2801 can be any of the encoders described in the foregoing embodiments, and decoder 2802 can be any of the decoders described in the foregoing embodiments.
[0439] In some embodiments, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program implements the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, it implements the decoding method as described in any of the foregoing embodiments.
[0440] In some embodiments, this application also provides a computer program product, including a computer program or instructions. When executed by a processor, the computer program or instructions implement the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, they implement the decoding method as described in any of the foregoing embodiments.
[0441] In some embodiments, this application also provides a computer program that, when executed by a processor, implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, implement the decoding method as described in any of the foregoing embodiments.
[0442] In some embodiments, this application also provides a computer-readable storage medium storing a bitstream thereon. The bitstream is generated by performing the steps of the encoding method as described in any of the foregoing embodiments.
[0443] In this embodiment of the application, the information to be encoded in the encoding method includes at least one of the following: a first syntax element, a second syntax element, and the quantization coefficient of the current block. Here, this information to be encoded is encoded and written into the bitstream.
[0444] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0445] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0446] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0447] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0448] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0449] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0450] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0451] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0452] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0453] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0454] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0455] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Industrial applicability
[0456] In this embodiment, at the encoding end, when the current block meets preset conditions, at least two candidate intra-prediction modes for the current block are determined; the transform set for the current block is determined based on the at least two candidate intra-prediction modes; the transform kernel for the current block is determined based on the transform set; the quantization coefficients for the current block are determined based on the transform kernel and the residual samples of the current block; the quantization coefficients of the current block are encoded, and the resulting encoded bits are written into the bitstream. At the decoding end, when the current block meets preset conditions, the first syntax element in the bitstream is parsed; at least two candidate intra-prediction modes for the current block are determined; the transform set for the current block is determined based on the value of the first syntax element and the at least two candidate intra-prediction modes; the transform kernel for the current block is determined based on the transform set; the inverse transform of the inverse quantization coefficients of the current block is performed based on the transform kernel, and the residual samples of the current block are determined. In other words, whether at the encoding or decoding end, when the current block meets the preset conditions, it is first necessary to determine at least two candidate intra-prediction modes for the current block. Then, the transform set of the current block is determined based on these at least two candidate intra-prediction modes. Since at least two candidate intra-prediction modes are provided, the selection of the transform set is no longer singular, thereby enabling the determination of a more accurate transform kernel for the current block, improving the accuracy of transform prediction for the current block, thereby improving the compression efficiency of the transform technique, and thus enhancing the encoding and decoding performance.
Claims
1. A decoding method applied to a decoder, the method comprising: When the current block meets the preset conditions, parse the first syntax element in the code stream; Determine at least two candidate intra-prediction modes for the current block; The transform set of the current block is determined based on the value of the first syntax element and the at least two candidate intra-frame prediction modes; Based on the transform set of the current block, determine the transform kernel of the current block; The inverse transformation of the inverse quantization coefficients of the current block is performed according to the transformation kernel to determine the residual sample of the current block.
2. The method according to claim 1, wherein, The current block satisfies a preset condition, including at least one of the following: The current block is a chroma block; The prediction mode for the current block is the first chromaticity mode; The value of the second syntax element in the parsed bitstream is greater than 0; The second syntax element is used to indicate whether the current block uses a low-frequency inseparable transform or whether the current block uses an inseparable master transform.
3. The method according to claim 1, wherein, Determining at least two candidate intra-frame prediction modes for the current block includes: Determine the chroma prediction block for the current block; Based on the candidate samples in the chromaticity prediction block, determine the gradient histogram of the current block; Based on the gradient histogram of the current block, at least two candidate intra-prediction modes for the current block are determined.
4. The method according to claim 3, wherein, Determining the gradient histogram of the current block based on candidate samples in the chromaticity prediction block includes: Determine the horizontal and vertical gradient values of the candidate samples; Based on the horizontal and vertical gradient values of the candidate samples, the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples are determined. The gradient histogram of the current block is determined based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample.
5. The method according to claim 4, wherein, The step of determining the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample based on the horizontal and vertical gradient values of the candidate sample includes: Angle mapping is performed based on the horizontal and vertical gradient values of the candidate samples to determine the candidate intra-frame prediction mode corresponding to the candidate samples; The gradient magnitude value corresponding to the candidate sample is determined by summing the absolute values of the horizontal and vertical gradient values of the candidate sample.
6. The method according to claim 4, wherein, The step of determining the gradient histogram of the current block based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample includes: When the number of candidate samples is at least one, at least one candidate intra-frame prediction mode and at least one corresponding gradient magnitude value are determined; Based on the at least one candidate intra-prediction mode, at least one reference intra-prediction mode with distinct characteristics is determined, and the gradient magnitude values belonging to the same reference intra-prediction mode are accumulated to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode. The gradient histogram of the current block is determined based on the at least one reference intra-frame prediction mode and its corresponding magnitude accumulation value.
7. The method according to claim 3, wherein, The method further includes: Determine the first chromaticity prediction block and the second chromaticity prediction block of the current block; A first gradient histogram is determined based on candidate samples in the first chromaticity prediction block, and a second gradient histogram is determined based on the second chromaticity prediction block. The gradient histogram of the current block is determined based on the first gradient histogram and the second gradient histogram. Based on the gradient histogram of the current block, at least two candidate intra-prediction modes for the current block are determined.
8. The method according to claim 7, wherein, Determining the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram includes: The gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram are accumulated to determine at least one reference intra-prediction mode and its corresponding magnitude accumulation value. The gradient histogram of the current block is determined based on the at least one reference intra-frame prediction mode and its corresponding magnitude accumulation value.
9. The method according to claim 6 or 8, wherein, The step of determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block includes: Based on the gradient histogram of the current block, sort the data from high to low according to the cumulative magnitude value, and determine at least two reference intra-prediction modes that are ranked first. The at least two reference intra-prediction modes are determined as at least two candidate intra-prediction modes for the current block.
10. The method according to claim 3, wherein, The determination of at least two candidate intra-prediction modes for the current block further includes: When the current block uses the direct export mode, determine the corresponding luminance block of the current block; Based on the brightness prediction mode used by the co-position brightness block, at least one candidate intra-frame prediction mode for the current block is determined.
11. The method according to any one of claims 1 to 10, wherein, Determining the transform set of the current block based on the value of the first syntax element and the at least two candidate intra-frame prediction modes includes: Based on the value of the first syntax element and the at least two candidate intra-prediction modes, determine the intra-prediction mode of the current block; The transform set of the current block is determined based on the intra-prediction mode of the current block and the mapping relationship between the intra-prediction mode and the transform set.
12. The method according to claim 11, wherein, Determining the intra-prediction mode of the current block based on the value of the first syntax element and the at least two candidate intra-prediction modes includes: Two candidate intra-prediction modes for the current block are determined from the at least two candidate intra-prediction modes. Based on the value of the first syntax element and the two candidate intra-prediction modes, the intra-prediction mode of the current block is determined.
13. The method according to claim 12, wherein, Determining the two candidate intra-prediction modes for the current block from the at least two candidate intra-prediction modes includes: Determine a first candidate intra-prediction mode for the current block from the at least two candidate intra-prediction modes; Based on the first candidate transform set indicated by the first candidate intra-prediction mode, determine a second candidate intra-prediction mode among the at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, whose indicated candidate transform set is different from the first candidate transform set. Based on the first candidate intra-prediction mode and the second candidate intra-prediction mode, two candidate intra-prediction modes for the current block are determined.
14. The method according to claim 13, wherein, The method further includes: When there is no second candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, the first candidate intra-prediction mode is adjusted according to a preset offset to determine the second candidate intra-prediction mode. Based on the first candidate intra-prediction mode and the second candidate intra-prediction mode, two candidate intra-prediction modes for the current block are determined.
15. The method according to claim 2, wherein, Determining the transform kernel of the current block based on the transform set of the current block includes: The transformation kernel of the current block is determined based on the value of the second syntax element and the transformation set of the current block.
16. The method according to any one of claims 1 to 15, wherein, The method further includes: Analyze the quantization coefficients of the current block in the bitstream; The quantization coefficients of the current block are dequantized to determine the dequantization coefficients of the current block.
17. The method according to any one of claims 1 to 15, wherein, The step of performing an inverse transformation on the inverse quantization coefficients of the current block according to the transformation kernel to determine the residual sample of the current block includes: When the current block uses a low-frequency non-separable transform method and the size parameters of the current block meet the first condition, a non-separable master transform is performed on the inverse quantization coefficients of the current block according to the transform kernel to determine the residual samples of the current block; or, If the current block uses a low-frequency non-separable transform method and the size parameters of the current block meet the second condition, perform a low-frequency non-separable transform on the inverse quantization coefficients of the current block according to the transform kernel to determine the inverse transform coefficients of the current block; and perform a discrete cosine transform on the inverse transform coefficients of the current block to determine the residual samples of the current block.
18. The method according to any one of claims 1 to 15, wherein, The method further includes: Perform intra-frame prediction on the current block to determine the prediction sample of the current block; The reconstruction sample of the current block is determined based on the predicted sample and the residual sample of the current block.
19. An encoding method applied to an encoder, the method comprising: When the current block meets the preset conditions, at least two candidate intra-frame prediction modes for the current block are determined; The transform set of the current block is determined based on the at least two candidate intra-frame prediction modes; Based on the transform set of the current block, determine the transform kernel of the current block; The quantization coefficients of the current block are determined based on the transform kernel and the residual samples of the current block. The quantization coefficients of the current block are encoded, and the resulting encoded bits are written into the bitstream.
20. The method according to claim 19, wherein, The step of determining the quantization coefficients of the current block based on the transform kernel and the residual samples of the current block includes: The transformation is performed based on the transformation kernel and the residual samples of the current block to determine the transformation coefficients of the current block; The transform coefficients of the current block are quantized to determine the quantization coefficients of the current block.
21. The method according to claim 20, wherein, The step of performing a transformation based on the transform kernel and the residual samples of the current block to determine the transform coefficients of the current block includes: When the current block uses a low-frequency non-separable transform method and the size parameters of the current block meet the first condition, a non-separable principal transform is performed on the residual samples of the current block according to the transform kernel to determine the transform coefficients of the current block; or, If the current block uses a low-frequency non-separable transformation method and the size parameters of the current block meet the second condition, perform a discrete cosine transform on the residual samples of the current block to determine the intermediate transform coefficients of the current block; and perform a low-frequency non-separable transform on the intermediate transform coefficients of the current block according to the transform kernel to determine the transform coefficients of the current block.
22. The method according to claim 19, wherein, The current block satisfies a preset condition, including at least one of the following: The current block is a chroma block; The prediction mode for the current block is the first chromaticity mode; The value of the second syntax element is greater than 0; The second syntax element is used to indicate whether the current block uses a low-frequency inseparable transform or whether the current block uses an inseparable master transform.
23. The method according to claim 22, wherein, The method further includes: Determine the value of the second syntax element; The value of the second syntax element is encoded, and the resulting encoded bits are written into the bitstream.
24. The method according to claim 19, wherein, Determining at least two candidate intra-frame prediction modes for the current block includes: Determine the chroma prediction block for the current block; Based on the candidate samples in the chromaticity prediction block, determine the gradient histogram of the current block; Based on the gradient histogram of the current block, at least two candidate intra-prediction modes for the current block are determined.
25. The method according to claim 24, wherein, Determining the gradient histogram of the current block based on candidate samples in the chromaticity prediction block includes: Determine the horizontal and vertical gradient values of the candidate samples; Based on the horizontal and vertical gradient values of the candidate samples, the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate samples are determined. The gradient histogram of the current block is determined based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample.
26. The method of claim 25, wherein, The step of determining the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample based on the horizontal and vertical gradient values of the candidate sample includes: Angle mapping is performed based on the horizontal and vertical gradient values of the candidate samples to determine the candidate intra-frame prediction mode corresponding to the candidate samples; The gradient magnitude value corresponding to the candidate sample is determined by summing the absolute values of the horizontal and vertical gradient values of the candidate sample.
27. The method according to claim 25, wherein, The step of determining the gradient histogram of the current block based on the candidate intra-frame prediction mode and gradient magnitude value corresponding to the candidate sample includes: When the number of candidate samples is at least one, at least one candidate intra-frame prediction mode and at least one corresponding gradient magnitude value are determined; Based on the at least one candidate intra-prediction mode, at least one reference intra-prediction mode with distinct characteristics is determined, and the gradient magnitude values belonging to the same reference intra-prediction mode are accumulated to determine the magnitude accumulation value corresponding to each of the at least one reference intra-prediction mode. The gradient histogram of the current block is determined based on the at least one reference intra-frame prediction mode and its corresponding magnitude accumulation value.
28. The method according to claim 24, wherein, The method further includes: Determine the first chromaticity prediction block and the second chromaticity prediction block of the current block; A first gradient histogram is determined based on candidate samples in the first chromaticity prediction block, and a second gradient histogram is determined based on the second chromaticity prediction block. The gradient histogram of the current block is determined based on the first gradient histogram and the second gradient histogram. Based on the gradient histogram of the current block, at least two candidate intra-prediction modes for the current block are determined.
29. The method according to claim 28, wherein, Determining the gradient histogram of the current block based on the first gradient histogram and the second gradient histogram includes: The gradient magnitude values belonging to the same reference intra-prediction mode in the first gradient histogram and the second gradient histogram are accumulated to determine at least one reference intra-prediction mode and its corresponding magnitude accumulation value. The gradient histogram of the current block is determined based on the at least one reference intra-frame prediction mode and its corresponding magnitude accumulation value.
30. The method according to claim 27 or 29, wherein, The step of determining at least two candidate intra-prediction modes for the current block based on the gradient histogram of the current block includes: Based on the gradient histogram of the current block, sort the data from high to low according to the cumulative magnitude value, and determine at least two reference intra-prediction modes that are ranked first. The at least two reference intra-prediction modes are determined as at least two candidate intra-prediction modes for the current block.
31. The method according to claim 24, wherein, The determination of at least two candidate intra-prediction modes for the current block further includes: When the current block uses the direct export mode, determine the corresponding luminance block of the current block; Based on the brightness prediction mode used by the co-position brightness block, at least one candidate intra-frame prediction mode for the current block is determined.
32. The method according to any one of claims 19 to 31, wherein, Determining the transform set of the current block based on the at least two candidate intra-frame prediction modes includes: Two candidate intra-prediction modes for the current block are determined from the at least two candidate intra-prediction modes. The transform set of the current block is determined based on the two candidate intra-frame prediction modes.
33. The method according to claim 32, wherein, Determining the two candidate intra-prediction modes for the current block from the at least two candidate intra-prediction modes includes: Determine a first candidate intra-prediction mode for the current block from the at least two candidate intra-prediction modes; Based on the first candidate transform set indicated by the first candidate intra-prediction mode, determine a second candidate intra-prediction mode among the at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, whose indicated candidate transform set is different from the first candidate transform set. Based on the first candidate intra-prediction mode and the second candidate intra-prediction mode, two candidate intra-prediction modes for the current block are determined.
34. The method according to claim 33, wherein, The method further includes: When there is no second candidate intra-prediction mode whose indicated candidate transform set is different from the first candidate transform set among the at least two candidate intra-prediction modes other than the first candidate intra-prediction mode, the first candidate intra-prediction mode is adjusted according to a preset offset to determine the second candidate intra-prediction mode. Based on the first candidate intra-prediction mode and the second candidate intra-prediction mode, two candidate intra-prediction modes for the current block are determined.
35. The method according to claim 32, wherein, Determining the transform set of the current block based on the two candidate intra-frame prediction modes includes: Determine two sets of candidate transforms indicated by the two candidate intra-frame prediction modes; The encoding cost of the current block is calculated based on the two sets of candidate transform sets, and the cost results corresponding to each of the two sets of candidate transform sets are determined. The minimum cost result is determined from the cost results corresponding to the two sets of candidate transformation sets, and the candidate transformation set corresponding to the minimum cost result is determined as the transformation set of the current block.
36. The method according to claim 35, wherein, The method further includes: The intra-prediction mode of the current block is determined based on the candidate transform set corresponding to the minimum cost result; Determine the value of the first syntax element; wherein the first syntax element is used to indicate the index number of the intra-prediction mode of the current block in the two candidate intra-prediction modes; The value of the first syntax element is encoded, and the resulting encoded bits are written into the bitstream.
37. The method according to claim 19, wherein, Determining the transform kernel of the current block based on the transform set of the current block includes: Determine at least two candidate transform kernels included in the transform set; The encoding cost of the current block is calculated based on the at least two candidate transform kernels, and the cost result corresponding to each of the at least two candidate transform kernels is determined. The minimum cost result is determined from the cost results corresponding to each of the at least two candidate transformation kernels, and the candidate transformation kernel corresponding to the minimum cost result is determined as the transformation kernel of the current block.
38. The method according to claim 22, wherein, The method further includes: Based on the transform kernel of the current block, the value of the second syntax element is determined; wherein, the value of the second syntax element is used to indicate... This indicates the index number of the transform kernel of the current block in the transform set.
39. The method according to any one of claims 19 to 38, wherein, The method further includes: Perform intra-frame prediction on the current block to determine the prediction sample of the current block; The residual sample of the current block is determined based on the initial sample and the predicted sample of the current block.
40. An encoder, the encoder comprising a first determining unit and an encoding unit, wherein: The first determining unit is configured to, when the current block meets a preset condition, determine at least two candidate intra-prediction modes of the current block; and determine the transform set of the current block based on the at least two candidate intra-prediction modes; and determine the transform kernel of the current block based on the transform set of the current block. And based on the transform kernel and the residual samples of the current block, determine the quantization coefficients of the current block; The encoding unit is configured to encode the quantization coefficients of the current block and write the resulting encoded bits into the bitstream.
41. An encoder, the encoder comprising a first memory and a first processor, wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 19 to 39 when running the computer program.
42. A decoder, the decoder comprising a decoding unit and a second determining unit, wherein: The decoding unit is configured to parse the first syntax element in the code stream when the current block meets a preset condition; The second determining unit is configured to determine at least two candidate intra-frame prediction modes for the current block; Based on the value of the first syntax element and the at least two candidate intra-prediction modes, determine the transform set of the current block; based on the transform set of the current block, determine the transform kernel of the current block; And perform an inverse transformation on the inverse quantization coefficients of the current block according to the transformation kernel to determine the residual sample of the current block.
43. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 18 when running the computer program.
44. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 18, or the method as described in any one of claims 19 to 39.
45. A computer-readable storage medium having a bitstream stored thereon, wherein, The bitstream is generated by performing the steps of the encoding method as described in any one of claims 19 to 39.