Coding method, decoding method, code stream, coders, decoders and storage medium

By determining the planar mode parameters of the current block, transform parameters are derived to reflect the directional characteristics of the samples, solving the problem of insufficient transform set selection in the prior art and improving encoding and decoding performance.

WO2026143743A1PCT designated stage Publication Date: 2026-07-09GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2025-01-06
Publication Date
2026-07-09

AI Technical Summary

Technical Problem

In existing technologies, the derivation scheme of transform sets cannot fully reflect the directional characteristics of samples, resulting in a decrease in the encoding and decoding performance of Planar mode.

Method used

By determining the planar mode parameters of the current block, transform parameters are derived based on the planar mode parameters, and then residual values ​​and quantization coefficients are determined, thereby improving encoding and decoding performance.

Benefits of technology

It improves the accuracy of intra-frame prediction and enhances encoding and decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025070890_09072026_PF_FP_ABST
    Figure CN2025070890_09072026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are a coding method and a decoding method. A decoder determines planar mode parameters of a current block, determines transform parameters of the current block on the basis of the planar mode parameters of the current block, and determines a residual value of the current block on the basis of the transform parameters. A coder determines planar mode parameters of a current block, determines transform parameters of the current block on the basis of the planar mode parameters of the current block, and determines a quantization coefficient of the current block on the basis of the transform parameters and the residual value of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Encoding / decoding methods, bitstreams, 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, a bitstream, an encoder, a decoder, and a 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 related technologies, in addition to the conventional Planar mode, Planar also supports two additional planar modes: horizontal Planar mode and vertical Planar mode. For Planar mode, the selection of the transform set is difficult to accurately reflect the directional characteristics of the residual.

[0004] In other words, the derivation scheme of the transform set in related technologies cannot fully reflect the directional characteristics of the samples, which in turn affects the prediction effect and reduces the encoding and decoding performance. Summary of the Invention

[0005] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve the accuracy of intra-frame prediction and 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] Determine the planar mode parameters for the current block;

[0009] The transformation parameters of the current block are determined based on the planar mode parameters of the current block;

[0010] The residual value of the current block is determined based on the transformation parameters.

[0011] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:

[0012] Determine the planar mode parameters for the current block;

[0013] The transformation parameters of the current block are determined based on the planar mode parameters of the current block;

[0014] The quantization coefficients of the current block are determined based on the transformation parameters and the residual value of the current block.

[0015] Thirdly, embodiments of this application provide a bitstream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: quantization coefficients of the current block, plane mode parameters of the current block, and mode derivation enable flag information of the current block.

[0016] Fourthly, embodiments of this application provide an encoder, which includes...

[0017] The first determining part is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the quantization coefficients of the current block based on the transformation parameters and the residual value of the current block.

[0018] Fifthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein,

[0019] A first memory for storing computer programs that can run on a first processor;

[0020] A first processor is configured to execute the method described in the second aspect when running the computer program.

[0021] Sixthly, embodiments of this application provide a decoder, the decoder comprising:

[0022] The second determining part is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the residual value of the current block based on the transformation parameters.

[0023] In a seventh aspect, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,

[0024] The second memory is used to store computer programs that can run on the second processor;

[0025] A second processor is configured to execute the method described in the first aspect when running the computer program.

[0026] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by at least one processor, implements the method described in the first aspect or the method described in the second aspect.

[0027] In a ninth aspect, embodiments of this application provide a computer-readable storage medium for storing a bitstream generated by the encoding method described in the second aspect.

[0028] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The decoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the residual value of the current block based on the transform parameters. The encoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the quantization coefficients of the current block based on the transform parameters and the residual value of the current block. In other words, in this application's embodiments, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding / decoding performance. Attached Figure Description

[0029] Figure 1 is a schematic diagram of intra-frame prediction;

[0030] Figure 2 is a schematic diagram of the angle prediction mode;

[0031] Figure 3 is a schematic diagram of the prediction process under the Planar model in related technologies;

[0032] Figure 4 is a system block diagram of an encoder provided in an embodiment of this application;

[0033] Figure 5 is a system block diagram of a decoder provided in an embodiment of this application;

[0034] Figure 6 is a flowchart illustrating a decoding method provided in an embodiment of this application;

[0035] Figure 7 is a schematic diagram of determining the predicted value of the conventional Planar model provided in the embodiments of this application;

[0036] Figure 8 is a schematic diagram of determining the predicted value of the conventional Planar model provided in the embodiments of this application;

[0037] Figure 9 is a flowchart illustrating an encoding method provided in an embodiment of this application;

[0038] Figure 10 is a schematic diagram of the prediction process in Planar mode provided in the embodiments of this application;

[0039] Figure 11 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;

[0040] Figure 12 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application;

[0041] Figure 13 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;

[0042] Figure 14 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application;

[0043] Figure 15 is a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application. Detailed Implementation

[0044] 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.

[0045] 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.

[0046] 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.

[0047] 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.

[0048] 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.

[0049] Video codec standards can employ a block-based hybrid coding framework. Specifically, each image in the video is divided into largest coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 128x128, 64x64, etc.). Each LCU or CTU can be further subdivided into rectangular coding units (CUs) according to rules. Coding units may also be further divided into prediction units (PUs), transform units (TUs), etc.

[0050] Specifically, the hybrid coding framework includes a prediction module 11, a transform and quantization module 12, an entropy coding module 13, an inverse quantization and inverse transform module 14, a loop filtering module 15, and a decoded image buffer module 16. The prediction module 11 may include an intra-frame prediction module 11a and an inter-frame prediction module 11b. The inter-frame prediction module 11b may include a motion estimation module and a motion compensation module. Because there is a strong correlation between adjacent pixels in an image of a video, intra-frame prediction is used in video coding and decoding technology to eliminate spatial redundancy between adjacent pixels. Furthermore, because there is a strong similarity between adjacent images in a video, inter-image prediction is used in video coding and decoding technology to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.

[0051] Furthermore, the transformation converts the predicted image patch to the frequency domain, redistributing energy. Combined with quantization, information insensitive to the human eye can be removed, thus eliminating visual redundancy. Entropy coding can eliminate character redundancy based on the current context model and the probability information of the binary code stream.

[0052] The basic workflow of a video codec is as follows: At the encoding end, after reading a black-and-white or color image, it is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. The original block of the current block is subtracted from the prediction block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is ​​entropy encoded and output to the bitstream. At the decoding end, intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. On the other hand, the bitstream is parsed to obtain the quantization coefficient matrix. The quantization coefficient matrix is ​​inverse quantized and inverse transformed to obtain a residual block. The prediction block and the residual block are added to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. Based on the image or based on the blocks, loop filtering is performed on the reconstructed image to obtain the decoded image.

[0053] The encoding end requires similar operations to the decoding end to obtain the decoded image. The decoded image can be used as a reference image for inter-frame prediction of subsequent images.

[0054] The block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined at the encoding end need to be written into the bitstream if necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information as the encoding end by parsing the bitstream and analyzing the existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.

[0055] During prediction, the current block can be divided into prediction units, and during transformation, it can be divided into transformation units. The division of prediction units and transformation units can be different. The above is the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. The embodiments of this application are applicable to the basic flow of a video codec under this block-based hybrid coding framework, but are not limited to this framework and flow.

[0056] Furthermore, in this embodiment, the current block (CB) can be the current block, the current prediction unit, or the current transformation unit, etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency. A "frame" is a commonly used term, generally understood as an image. In this embodiment, the term "frame" can also be replaced with an image or a slice, etc.

[0057] The following section provides a detailed introduction to several prediction techniques related to this technology.

[0058] There is a strong spatial correlation between adjacent samples in an image. Intra-frame prediction is a prediction method that utilizes the spatial correlation between the already encoded / decoded samples around the current block and the samples within the current block. Figure 1 is a schematic diagram of intra-frame prediction. As shown in Figure 1, the white 4x4 block is the current block, and the gray samples in the left column and top row of the current block are the reference samples for the current block. Intra-frame prediction uses these reference samples to predict the current block. These reference samples may all be available, i.e., all have been encoded / decoded. Some may also be unavailable. For example, if the current block is the leftmost part of the entire frame, then the reference samples to the left of the current block are unavailable. Or, if the lower left part of the current block has not yet been encoded / decoded, then the reference samples to the lower left are also unavailable. In cases where reference samples are unavailable, available reference samples, certain values, or certain methods can be used to fill the gaps, or no filling can be performed.

[0059] Intra-frame prediction has several prediction modes. In the reference software, the traditional intra-frame prediction modes include the following:

[0060] •Planar mode: Intra-prediction mode 0,

[0061] • DC mode: Intra-frame prediction mode 1,

[0062] • Angle mode: Intra-frame prediction mode 2-66.

[0063] Figure 2 is a schematic diagram of the angle prediction modes. As shown in Figure 2, the intra-frame prediction modes 2 to 66 are angle modes, and the wide angles are -1 to 14 and 67 to 80. The arrows in the figure point to the directions of the angle mode predictions that exist in VVC. When the current prediction block is a non-square block, some angle directions are replaced with wide angles, such as -1 to -14 and 67 to 80 in the figure.

[0064] Figure 3 is a schematic diagram of the prediction process in the Planar mode of related technologies. As shown in Figure 3, the current Planar technology performs prediction and multiple transform selection (MTS), low-frequency non-separable transform (LFNST), and non-separable primary transform (NSPT) transformations in three steps: Planar parameter selection, Planar prediction value generation, and Planar acquisition of MTS / LFNST / NSPT transform sets.

[0065] In related technologies, Planar supports two additional planar modes: horizontal Planar mode and vertical Planar mode. The encoder / decoder uses a CU-level Idx:plIdx to identify whether the normal Planar mode (plIdx = 0), horizontal Planar mode (plIdx = 1), or vertical Planar mode (plIdx = 2) is used. For different plidx inputs, different prediction methods will be employed for predictor generation and transform set selection.

[0066] At the encoding end, plIdx is determined by the specific Planar prediction method in the comparison rate-distortion cost (RDCost) process. When comparing the regular Planar mode, cu.plIdx is 0 by default. When comparing the horizontal Planar mode, cu.plIdx is assigned to 1. When comparing the vertical Planar mode, cu.plIdx is assigned to 2.

[0067] At the decoding end, pluIdx is obtained by reading in a 2-bit code stream and written to cu.plIdx.

[0068] In related technologies, LFNST / NSPT has 35 transform sets, each containing 3 transform kernels. The transform matrix is ​​determined by the transform kernels and the transform set, and the transform set is determined by the Intra Prediction Mode (IPM) mapping. In the intra-frame explicit MTS transform mode, IPM, block size, and mtsIdx jointly determine the MTS transform pair.

[0069] The correspondence between each prediction mode and its IPM in the MTS / LFNST / NSPT transform mode is shown in Table 1:

[0070] Table 1

[0071] Currently, when using the conventional Planar model to derive the MTS / LFNST / NSPT transform set, the selection of the transform set is difficult to accurately reflect the directional characteristics of the residual.

[0072] It is evident that the derivation scheme of the transform set in related technologies cannot fully reflect the directional characteristics of the samples, thereby affecting the prediction effect and reducing the encoding and decoding performance.

[0073] Based on this, embodiments of this application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The decoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters of the current block; and determines the residual value of the current block based on the transform parameters. The encoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters of the current block; and determines the quantization coefficients of the current block based on the transform parameters and the residual value of the current block. In other words, in embodiments of this application, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding / decoding performance.

[0074] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0075] Referring to Figure 4, which shows an example of a system block diagram of an encoder provided in an embodiment of this application. As shown in Figure 4, the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control and analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input raw video signal, a video coding block can be obtained by partitioning it through a Coding Tree Unit (CTU). Then, the residual sample information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the sample domain to the transform domain and quantizing the resulting transform coefficients to further reduce the bit rate. The intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide time prediction information. The motion estimation performed by the motion estimation unit 105 is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, the motion compensation unit 104 is used to perform the motion estimation based on the motion vectors determined by the motion estimation unit 105. The motion compensation is performed. After determining the intra-prediction mode, the intra-prediction unit 103 is also used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the coding unit 109. In addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the sample domain, and remove the block artifacts by the filter control analysis unit 107 and the filtering unit 108. Then, the reconstructed residual block is added to a predictive block in the frame of the decoding image buffer unit 110 to generate the reconstructed video coding block. The coding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-prediction mode and output the bitstream of the video signal. The decoding image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.

[0076] Referring to Figure 5, it shows an example of a system block diagram of a decoder provided in an embodiment of this application. As shown in Figure 5, the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, etc. The decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding processing shown in Figure 14, the bitstream of the video signal is output. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. The transform coefficients are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the sample domain. The intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses... The prediction information is used to generate a predictive block of the video block being decoded; the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-prediction unit 203 or the motion compensation unit 204; the decoded video signal is passed through the filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoding image buffer unit 206, which stores reference images for subsequent intra-prediction or motion compensation, and is also used for the output of the video signal, thus obtaining the recovered original video signal.

[0077] In the embodiments of this application, a network architecture for a video encoding / decoding system including decoding and encoding methods is provided. The decoder or encoder in these embodiments can be the aforementioned electronic device. That is, the electronic device in these embodiments has video encoding / decoding capabilities and generally includes a video encoder (i.e., encoder) and a video decoder (i.e., decoder).

[0078] It should also be noted that the embodiments of this application are mainly applied to the intra-frame prediction part. That is to say, the embodiments of this application can be applied to the encoder, the decoder, or even to both the encoder and the decoder.

[0079] It should also be noted that when the embodiments of this application are applied to an encoder, "current block" specifically refers to the encoded block to be predicted; when the embodiments of this application are applied to a decoder, "current block" specifically refers to the decoded block to be predicted.

[0080] In one embodiment of this application, FIG6 is a flowchart illustrating a decoding method provided in this application embodiment. As shown in FIG6, the decoding method of the decoder may include:

[0081] Step 601: Determine the planar mode parameters of the current block.

[0082] It should be noted that, in the embodiments of this application, the decoding method is applied to the decoder. Specifically, based on the composition structure of the decoder 200, the decoding method of the embodiments of this application can be applied to the intra-frame prediction part, mainly including a method for deriving the transform parameters of the current block based on the planar mode parameters of the current block, which can improve the accuracy of intra-frame prediction.

[0083] In the embodiments of this application, the planar mode parameters of the current block can be determined first. These planar mode parameters can be used to determine the planar mode of the current block.

[0084] It is understood that in the embodiments of this application, the planar mode is the same as the planar mode, wherein the planar mode (Planar mode) may include, but is not limited to, the regular planar mode, the horizontal planar mode, and the vertical planar mode.

[0085] Furthermore, in the embodiments of this application, the plane mode parameter is a parameter indicating the plane mode of the current block. The plane mode used by the current block can be determined by the value of the plane mode parameter. The value of the plane mode parameter can include a first value, a second value, and a third value, wherein the first, second, and third values ​​are different, and the first, second, and third values ​​can be in parameter form or in numerical form.

[0086] For example, in some embodiments, assuming the first value is 0, the second value is 1, and the third value is 2, the planar mode parameter of the current block can be represented as plIdx. When the planar mode parameter of the current block takes the first value, i.e., plIdx = 0, it can be determined that the planar mode used by the current block is the regular Planar mode; when the planar mode parameter of the current block takes the second value, i.e., plIdx = 1, it can be determined that the planar mode used by the current block is the horizontal Planar mode; and when the planar mode parameter of the current block takes the third value, i.e., plIdx = 2, it can be determined that the planar mode used by the current block is the vertical Planar mode.

[0087] Furthermore, in the embodiments of this application, the method for determining the planar mode parameters is not specifically limited. For example, the planar mode parameters of the current block can be determined by decoding the bitstream, or the planar mode parameters of the current block can be derived at the decoding end.

[0088] For example, in some embodiments, the bitstream can be decoded to determine the plane mode parameter plIdx, and then the plane mode of the current block can be further determined based on the value of the plane mode parameter plIdx.

[0089] Furthermore, in the embodiments of this application, the prediction mode of the current block can be determined first. If the prediction mode of the current block is a planar mode, the planar mode parameters of the current block can be further determined.

[0090] It is understood that, in the embodiments of this application, the method for determining the prediction mode of the current block is not specifically limited. For example, the prediction mode identification information of the current block can be determined by decoding the bitstream, and then the prediction mode of the current block can be determined based on the prediction mode identification information of the current block. Alternatively, the prediction mode of the current block can be derived at the decoding end.

[0091] It is understood that, in the embodiments of this application, if it is determined that the prediction mode of the current block is planar mode, that is, the current block is in planar mode, then the determination of the planar mode parameters of the current block can continue; if it is determined that the prediction mode of the current block is not planar mode, then the determination of the planar mode parameters of the current block can be skipped.

[0092] In other words, in the embodiments of this application, the determination of the planar mode parameters of the current block may depend on the prediction mode of the current block.

[0093] Step 602: Determine the transformation parameters of the current block based on the planar mode parameters of the current block.

[0094] In the embodiments of this application, after determining the planar mode parameters of the current block, the transformation parameters of the current block can be further determined based on the planar mode parameters of the current block.

[0095] It should be noted that, in the embodiments of this application, at the decoding end, the transform parameters of the current block can be used to perform inverse transform on the transform coefficients of the current block. The transform parameters of the current block can be the transform set of the current block, the transform kernel of the current block, or any other parameters used to perform inverse transform on the transform coefficients of the current block; this application does not impose specific limitations on these parameters.

[0096] In the embodiments of this application, when determining the transform parameters of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined first based on the planar mode parameters of the current block; then the transform parameters of the current block can be determined based on the first intra-frame prediction mode of the current block.

[0097] In embodiments of this application, the first intra-prediction mode of the current block can be an intra-prediction mode used to derive the transform parameters of the current block. Specifically, the first intra-prediction mode of the current block can be any intra-prediction mode in the unified intra-prediction mode IntraPredModeD. The mode index of IntraPredModeD is between [0, 66].

[0098] Furthermore, in the embodiments of this application, the method for determining the first intra-frame prediction mode of the current block can include various methods, and this application does not impose specific limitations. Specifically, the determination of the first intra-frame prediction mode of the current block can depend on the planar mode parameters of the current block; that is, the first intra-frame prediction mode of the current block can be derived from the planar mode parameters of the current block.

[0099] In other words, in the embodiments of this application, the derivation method of the first intra-frame prediction mode of the current block can be different for different plane mode parameters, or in other words, the derivation method of the first intra-frame prediction mode of the current block can be different for different plane modes.

[0100] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, one possible implementation is to determine the prediction value of the current block based on the planar mode parameters of the current block; and then determine the first intra-frame prediction mode of the current block based on the prediction value of the current block.

[0101] It is understood that, in the embodiments of this application, the predicted value of the current block can be determined first based on the planar mode parameters of the current block. Specifically, the method for determining the predicted value of the current block can be different for different planar mode parameters; in other words, the predicted value of the current block can be different for different planar modes.

[0102] For example, in some embodiments, assuming that the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the predicted value of the current block corresponding to the horizontal direction and the predicted value corresponding to the vertical direction can be determined first, and then the predicted value of the current block can be further determined based on the predicted value of the horizontal direction and the predicted value of the vertical direction.

[0103] Figure 7 is a schematic diagram of determining the predicted value in the conventional Planar mode provided in the embodiment of this application, and Figure 8 is a schematic diagram of determining the predicted value in the conventional Planar mode provided in the embodiment of this application. As shown in Figures 7 and 8, if the current block uses the conventional Planar mode for intra-frame prediction, for any sample position (x, y) in the current block, the predicted value in the horizontal direction can be determined respectively. and vertical predicted values

[0104] Horizontal predicted value Refer to the following formula:

[0105] Where x = 1, 2, ..., W; y = 1, 2, ..., H, and W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (0, y). This is the filtered reference sample value for the reference sample at sample location (W+1, 0).

[0106] Vertical predicted value Refer to the following formula:

[0107] Where W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (x, 0). The filtered reference sample value for the reference sample at sample location (0, H+1).

[0108] For a sample at any position (x, y) in the current block, the predicted value is based on the horizontal direction. and vertical predicted values Determine the corresponding predicted value Refer to the following formula:

[0109] in, This represents the uncorrected predicted value for the sample at position (x, y).

[0110] For example, in some embodiments, assuming the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal planar mode, the predicted value of the current block can be determined directly based on adjacent reference blocks. For example, the predicted value of the current block can be determined based on the left adjacent reference block and the upper right adjacent reference block.

[0111] For any sample at position (x, y) in the current block, the predicted value pred(x, y) is generated using the left reference block and the upper right reference block, as shown in the following formula: pred(x, y)=((W-1-x)*rec(-1, y)+(x+1)*rec(W, -1)+(W>q))>>log2W (4)

[0112] Where x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, rec(-1, y) is the reconstructed value of the reference sample at position (-1, y) in the left reference block, rec(W, -1) is the reconstructed value of the reference sample at position (W, -1) in the upper right reference block, and q is the shift parameter.

[0113] For example, in some embodiments, assuming the planar mode parameter of the current block indicates that the planar mode of the current block is vertical planar mode, the predicted value of the current block can be determined directly based on adjacent reference blocks. For example, the predicted value of the current block can be determined based on the upper reference block and the lower left reference block.

[0114] For any sample at position (x, y) in the current block, the predicted value pred(x, y) is generated using the upper reference block and the lower left reference block, as shown in the following formula: pred(x, y)=((H-1-y)*rec(x, -1)+(y+1)*rec(-1, H)+(W>>1))>>log2H (5)

[0115] Where x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, rec x, -1 is the reconstructed value of the reference sample at position (x, -1) in the upper reference block, and rec -1, H is the reconstructed value of the reference sample at position (-1, H) in the lower left reference block.

[0116] It is understood that, in the embodiments of this application, after determining the predicted value of the current block, the first intra-prediction mode of the current block can be further determined based on the predicted value of the current block. This application does not specifically limit the method of deriving the first intra-prediction mode based on the predicted value of the current block. For example, the gradient histogram (HoGs) can be determined based on the predicted value of the current block, and then the first intra-prediction mode for a given block can be derived based on the gradient histogram. That is, first, a gradient histogram is established, and then one or more intra-prediction modes and their corresponding amplitude values ​​are recorded based on the amplitude histogram. Finally, the intra-prediction mode with the largest accumulated amplitude value is selected as the derived first intra-prediction mode for the current block.

[0117] For example, in some embodiments, when determining the first intra-frame prediction mode of the current block based on the predicted value of the current block, the gradient magnitude value in the angular direction can be determined first based on the predicted value of the current block; and then the first intra-frame prediction mode of the current block can be determined based on the gradient magnitude value in the angular direction.

[0118] In the embodiments of this application, the reference region corresponding to the current block can be determined first based on the position information and size information of the current block; and then the first intra-frame prediction mode of the current block can be determined based on the reference region.

[0119] It is understood that, in the embodiments of this application, the size of the reference region may be related to the size information and / or position information of the current block. For example, based on the position and size (x, y, cbWidth, cbHeight) of the current block and the block vector (bvHor, bvVer), the position and size of the reference region (x+bvHor-offsetX, y+bvVer-offsetY, cbWidth+dW, cbHeight+dH) can be obtained, where offsetX, offsetY, dW, and dH can take any integer values.

[0120] For example, in some embodiments, the gradient magnitude value of the angular direction corresponding to the sample position can be determined based on the sample position in the sampling window and the reference region; finally, the first intra-frame prediction mode of the current block can be determined based on the gradient magnitude value of the angular direction.

[0121] In the embodiments of this application, the size of the sampling window can be set to any size, and this application does not impose any specific limitation. For example, a 3x3 sampling window can be set.

[0122] For example, in some embodiments, assuming the sampling window is a 3x3 window, when determining the gradient magnitude value of the angular direction corresponding to the sample position based on the sample position in the sampling window and the sample position in the reference region, for any sampling window in the reference region, the corresponding sample position is (x, y), and the horizontal gradient Gx and vertical gradient Gy of adjacent reconstructed pixels can be calculated using the Sobel operator. The formula for the 3x3 Sobel operator is as follows:

[0123] Where M_x is the horizontal gradient operator, M_y is the vertical gradient operator, and the horizontal gradient Gx and vertical gradient Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample values ​​within the window position, respectively.

[0124] For example, in some embodiments, mapHgV = {{1, 0}, {0, 1}} and mapVgH = {{2, 3}, {3, 2}} can be set. angOffset = {18, 18, 50, 50} is set to map the gradient derivation result to the actual angle mode, where 18 and 50 correspond to the horizontal and vertical modes, respectively. angTable = {0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536} is set to derive the angle direction based on the gradient information. HoG

[0067] is set to an array containing the gradient intensity of each conventional intra-frame prediction mode. At the beginning of this process, all values ​​in all HoG arrays are initialized to 0.

[0125] For each sample p[x][y], with x=1…nTbW-2, y=1…nTbH-2, the calculation process is as follows:

[0126] Calculate the horizontal gradient gHor[x][y] = p[x-1][y-1] + 2p[x-1][y] + p[x-1][y+1] – p[x+1][y-1] – 2p[x+1][y] – p[x+1][y+1];

[0127] Calculate the vertical gradient gVer[x][y] = p[x-1][y-1] + 2p[x][y-1] + p[x+1][y-1] – p[x-1][y+1] – 2p[x][y+1] – p[x+1][y+1];

[0128] Calculate iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y])

[0129] Calculate signH[x][y] = gHor[x][y] < 0? 1:0

[0130] Calculate signV[x][y] = gVer[x][y] < 0? 1:0

[0131] Calculate HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0)

[0132] Calculate region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]])

[0133] Calculate grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gVer[x][y]) / abs(gHor[x][y]))

[0134] Calculate grad[x][y] = round(grad[x][y] × (1 << 16))

[0135] Calculate the index angIdx[x][y] = argmin_i(abs(angTable[i] – grad[x][y]))

[0136] Calculate the intra-frame mode ipm[x][y] = angOffset[region[x][y]] + angIdx[x][y]

[0137] Set HoG[ipm[x][y]]=HoG[ipm[x][y]]+iAmp[x][y]

[0138] Then, a direction mode IntraPredModeD is obtained. If HoG has no non-zero amplitude, IntraPredModeD is set to PLANA. Otherwise, if HoG has all zero amplitude, IntraPredModeD is set to argmax_i(HoG[i]).

[0139] Where argmax_i(L[i]), i = 0, ..., N, returns the index between 0 and N that maximizes L (if there are multiple maximum values, the smaller index is returned). argmin_i(L[i]), i = 0, ..., N, returns the index between 0 and N that minimizes L (if there are multiple maximum values, the smaller index is returned). That is, IntraPredModeD = argmax_i(HoG[i]), indicating that IntraPredModeD is the angle mode with the largest HoG amplitude.

[0140] In other words, the magnitude value G of the gradient at each reference position can be accumulated on its derived traditional intra-prediction mode to obtain a HoG. Finally, the traditional intra-prediction mode with the largest accumulated magnitude value is selected as the first intra-prediction mode of the current block.

[0141] It is understood that, in the embodiments of this application, for the implementation method of determining the prediction value of the current block based on the planar mode parameters of the current block, and determining the first intra-frame prediction mode of the current block based on the prediction value of the current block, the implementation method can be selected based on the planar mode parameters of the current block, that is, the implementation method can be selected based on the planar mode of the current block.

[0142] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected to choose an implementation method that derives the first intra-frame prediction mode based on the prediction value.

[0143] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0144] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the predicted value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the predicted value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the predicted value is not used.

[0145] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is horizontal Planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is regular Planar mode or vertical Planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0146] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular planar mode or a horizontal planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0147] Of course, in the embodiments of this application, the implementation method of deriving the first intra-frame prediction mode based on the predicted value can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not make specific limitations.

[0148] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, another possible implementation is to determine the most probable mode list (MPM) of the current block; determine the template prediction matching error of the prediction modes in the MPM of the current block; and determine the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction modes in the MPM of the current block.

[0149] In other words, in the embodiments of this application, the method of deriving the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block is not limited to gradient histograms, but can also be derived through the MPM list of the current block. For example, the MPM list of the current block can be obtained, the modes in the MPM list can be predicted on a template, and the mode with the smallest error can be selected as the first intra-frame prediction mode of the current block.

[0150] It is understood that, in the embodiments of this application, for the implementation method of determining the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction mode in the current block's MPM, whether to use this implementation method can be selected based on the planar mode parameters of the current block, that is, whether to use this implementation method is selected based on the planar mode of the current block.

[0151] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected, and the implementation method of deriving the first intra-frame prediction mode based on the template prediction matching error of the prediction mode in the MPM can be selected.

[0152] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0153] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0154] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a vertical Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0155] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a horizontal Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0156] Of course, in the embodiments of this application, the implementation method of deriving the first intra-frame prediction mode based on the template prediction matching error of the prediction mode in the MPM can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not make specific limitations.

[0157] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, another possible implementation is to directly determine the preset mode as the corresponding first intra-frame prediction mode based on the planar mode parameters of the current block, or in other words, to directly determine the preset mode as the corresponding first intra-frame prediction mode based on the planar mode of the current block.

[0158] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the first preset mode if the planar mode parameters of the current block indicate that the current block uses the first planar mode.

[0159] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the second preset mode if the planar mode parameters of the current block indicate that the current block uses the second planar mode.

[0160] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the third preset mode if the planar mode parameters of the current block indicate that the current block uses the third planar mode.

[0161] It is understood that in the embodiments of this application, the first planar mode, the second planar mode, and the third planar mode can be different planar modes, such as any mode among the regular Planar mode, the horizontal Planar mode, and the vertical Planar mode; the first preset mode, the second preset mode, and the third preset mode are all intra-prediction modes, wherein the first preset mode can be the intra-prediction mode corresponding to the first planar mode, the second preset mode can be the intra-prediction mode corresponding to the second planar mode, and the third preset mode can be the intra-prediction mode corresponding to the third planar mode.

[0162] For example, in some embodiments, assuming the first planar mode is a regular Planar mode, the first preset mode corresponding to the first planar mode can be intra-prediction mode 0; assuming the second planar mode is a horizontal Planar mode, the second preset mode corresponding to the second planar mode can be intra-prediction mode 18; assuming the third planar mode is a vertical Planar mode, the third preset mode corresponding to the third planar mode can be intra-prediction mode 50.

[0163] It is understood that, in the embodiments of this application, for the implementation method of directly determining the first intra-frame prediction mode of the current block based on the preset mode, whether to use this implementation method can be selected based on the planar mode parameters of the current block, that is, whether to use this implementation method is selected based on the planar mode of the current block.

[0164] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected to directly determine the intra-frame prediction mode based on a preset mode.

[0165] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on the preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation method of determining the first intra-frame prediction mode directly based on the preset mode is not used.

[0166] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0167] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal Planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a vertical Planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0168] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular planar mode or a horizontal planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0169] Of course, in the embodiments of this application, the implementation method of directly determining the intra-frame prediction mode based on the preset mode can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not impose specific limitations.

[0170] Therefore, in the embodiments of this application, for the current block, if the corresponding intra-frame prediction mode is a planar mode, then any one of the different derivation methods can be selected, such as deriving the first intra-frame prediction mode based on the prediction value, determining the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction mode in the MPM of the current block, or directly determining the first intra-frame prediction mode based on a preset mode. This application does not impose any specific limitations.

[0171] It is understood that, in the embodiments of this application, the derivation methods such as using the prediction value to derive the first intra-frame prediction mode or using the template prediction matching error of the prediction mode in the MPM of the current block to determine the first intra-frame prediction mode of the current block can obtain a prediction direction that is more in line with the texture characteristics of the current block. That is, the obtained first intra-frame prediction mode can be more adapted to the characteristics of the current block, and then the transformation parameters adapted to the characteristics of the current block can be obtained through the first intra-frame prediction mode.

[0172] Furthermore, in the embodiments of this application, when determining the derivation method of the first intra-frame prediction mode of the current block, the derivation method can be selected by combining information related to the current block. The information related to the current block used to determine the derivation method of the first intra-frame prediction mode of the current block includes, but is not limited to, one or more of the following: the size parameters of the current block, the mode derivation enable flag information of the current block, and the amplitude difference parameters of the current block.

[0173] It is understood that, in the embodiments of this application, when the size parameter of the current block is greater than or equal to the size threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, when the size parameter of the current block is greater than or equal to the size threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

[0174] It is understood that, in the embodiments of this application, when the size parameter of the current block is less than the size threshold, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode corresponding to the first planar mode, the second preset mode corresponding to the second planar mode, and the third preset mode corresponding to the third planar mode.

[0175] In other words, in the embodiments of this application, a pre-set size threshold of the current block can be compared, and then, based on the comparison result and the planar mode parameters of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined. The size threshold can be any integer greater than 0; for example, the size threshold can include, but is not limited to, 256.

[0176] It is understood that, in the embodiments of this application, if the size parameter of the current block is greater than or equal to the size threshold, then the derivation method of the first intra-frame prediction mode of the current block can be determined by using the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block can be determined by using the template prediction matching error of the prediction mode in the MPM of the current block.

[0177] Accordingly, in the embodiments of this application, if the size parameter of the current block is less than the size threshold, then the derivation method of the corresponding first intra-frame prediction mode can be selected by directly determining the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0178] For example, in some embodiments, the size parameter of the current block can be restricted. For instance, blocks with a size parameter greater than or equal to a threshold value (e.g., a size threshold of 256) can use a scheme to derive the corresponding first intra-frame pre-stored mode based on the predicted value through the gradient histogram, and further derive the transformation parameters (e.g., the transform set); blocks with a size parameter less than the threshold value can use a scheme to derive the transformation parameters using the corresponding preset mode (e.g., the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode), that is, directly determining the corresponding first intra-frame prediction mode based on the preset mode corresponding to the plane mode parameter (plane mode) of the current block, and further deriving the transformation parameters (e.g., the transform set).

[0179] It is understood that, in the embodiments of this application, the mode derivation enable flag information of the current block can be determined first; if the mode derivation enable flag information is a first value, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, if the mode derivation enable flag information is a first value, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the mode derivation enable flag information is a second value, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the plane mode parameters of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first plane mode, the second preset mode of the second plane mode, and the third preset mode of the third plane mode.

[0180] In other words, in the embodiments of this application, the enable identifier information can be derived based on the determined mode of the current block, and combined with the planar mode parameters of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined.

[0181] It is understood that, in the embodiments of this application, the mode derivation enable flag information of the current block can be used to determine whether the current block is allowed to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, the template prediction matching error of the prediction mode in the MPM of the current block is used to determine the derivation method of the first intra-frame prediction mode of the current block.

[0182] For example, in some embodiments, if the mode derivation enable flag information of the current block is a first value, then it is determined that the mode derivation enable flag information indicates that the current block is allowed to use the derivation method of determining the first intra-frame prediction mode of the current block based on the prediction value of the current block; or, the derivation method of determining the first intra-frame prediction mode of the current block is determined using the template prediction matching error of the prediction mode in the MPM of the current block; if the mode derivation enable flag information of the current block is a second value, then it is determined that the mode derivation enable flag information indicates that the current block is not allowed to use the derivation method of determining the first intra-frame prediction mode of the current block based on the prediction value of the current block, nor is it allowed to use the template prediction matching error of the prediction mode in the MPM of the current block to determine the derivation method of the first intra-frame prediction mode of the current block.

[0183] Here, the first value is different from the second value, and both the first and second values ​​can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.

[0184] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the mode derivation enable flag is set to 1, then it can be determined that the current block is allowed to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, the template prediction matching error of the prediction mode in the MPM of the current block is used to determine the derivation method of the first intra-frame prediction mode of the current block; if the mode derivation enable flag is set to 0, then it can be determined that the derivation method of the corresponding first intra-frame prediction mode is determined directly based on the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0185] It is understood that, in the embodiments of this application, the mode derivation enable identifier information of the current block can be determined by decoding the bit stream, or the mode derivation enable identifier information of the current block can be directly derived and determined at the decoding end. This application does not impose any specific limitations.

[0186] It is understood that, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first based on the gradient amplitude value of the angular direction; if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the mode derivation enable flag information of the current block can be further determined.

[0187] It should be noted that, in the embodiments of this application, the magnitude difference parameter of the current block can characterize the difference between gradient magnitude values ​​in different angular directions. For example, the magnitude difference parameter can be the difference between the two largest magnitude values ​​in the gradient histogram determined based on the gradient magnitude values ​​in the angular direction.

[0188] In other words, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first, and then the amplitude difference parameter of the current block can be compared with a preset amplitude difference threshold. Based on the comparison result and the planar mode parameter of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined. The amplitude difference threshold can be any integer greater than 0; for example, the amplitude difference threshold can include, but is not limited to, 5.

[0189] It is understood that, in the embodiments of this application, if the amplitude difference parameter of the current block is less than the amplitude difference threshold, then it is possible to skip the determination of the mode derivation enable flag information of the current block, and instead choose to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, it is also possible to choose to use the template prediction matching error of the prediction mode in the MPM of the current block to determine the derivation method of the first intra-frame prediction mode of the current block.

[0190] Accordingly, in the embodiments of this application, if the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, then the mode derivation enable flag information of the current block can be further determined, and then the derivation method of the corresponding first intra-frame prediction mode can be determined based on the mode derivation enable flag information of the current block.

[0191] In other words, in the embodiments of this application, the determination of the mode derivation enable identifier information of the current block can depend on the amplitude difference parameter of the current block. That is, when the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, the determination of the mode derivation enable identifier information of the current block is performed; otherwise, the determination of the mode derivation enable identifier information of the current block is skipped.

[0192] For example, in some embodiments, if the amplitude difference (amplitude difference parameter) between the mode with the highest amplitude value and the mode with the second highest amplitude value in the gradient histogram constructed based on the predicted value is less than a threshold (amplitude difference, for example, 5), then the mode derivation enable flag information of the current block is not parsed in the bitstream, and the corresponding first intra-frame pre-stored mode is directly derived from the gradient histogram based on the predicted value, and the transformation parameters (such as the transform set) are further derived; otherwise, if the amplitude difference (amplitude difference parameter) is greater than or equal to a threshold (amplitude difference, for example, 5), then the mode derivation enable flag information of the current block is continued to be parsed in the bitstream.

[0193] It is understood that, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first based on the gradient amplitude value of the angular direction; if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined as a preset mode based on the plane mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first plane mode, the second preset mode of the second plane mode, and the third preset mode of the third plane mode.

[0194] It is understood that, in the embodiments of this application, if the amplitude difference parameter of the current block is less than the amplitude difference threshold, then the derivation method of the first intra-frame prediction mode of the current block can be determined by using the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block can be determined by using the template prediction matching error of the prediction mode in the MPM of the current block.

[0195] Accordingly, in the embodiments of this application, if the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, then the derivation method of the corresponding first intra-frame prediction mode can be selected by directly determining the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0196] In other words, in the embodiments of this application, after determining the amplitude difference parameter of the current block, the derivation method of the first intra-frame prediction mode can be selected directly based on the comparison result between the amplitude difference parameter of the current block and the amplitude difference threshold.

[0197] For example, in some embodiments, if the amplitude difference (amplitude difference parameter) between the mode with the highest amplitude value and the mode with the second highest amplitude value in the gradient histogram constructed based on the predicted value is less than a threshold (amplitude difference, for example, 5), then the scheme of deriving the corresponding first intra-frame pre-stored mode based on the predicted value through the gradient histogram and further deriving the transformation parameters (such as the transform set) is directly used; otherwise, if the amplitude difference (amplitude difference parameter) is greater than or equal to a threshold (amplitude difference, for example, 5), then the scheme of deriving the transformation parameters is directly adopted using the corresponding preset mode (such as the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode), that is, the scheme of directly determining the corresponding first intra-frame predicted mode based on the preset mode corresponding to the plane mode parameter (plane mode) of the current block and further deriving the transformation parameters (such as the transform set).

[0198] Furthermore, in the implementation of this application, after determining the first intra-frame prediction mode of the current block, the transform parameters of the current block can be further determined based on the first intra-frame prediction mode. Specifically, the transform set and / or transform kernel of the current block can be determined according to the determined first intra-frame prediction mode corresponding to the planar mode of the current block.

[0199] For example, in some embodiments, the transform set corresponding to the first intra-prediction mode can be determined according to the mapping relationship between the intra-prediction mode and the transform set, and then the transform kernel of the current block can be determined based on the transform set.

[0200] For example, in some embodiments, the transform kernel corresponding to the first intra-prediction mode can be determined according to the mapping relationship between the intra-prediction mode and the transform kernel, and the transform kernel is the transform kernel of the current block.

[0201] Step 603: Determine the residual value of the current block based on the transformation parameters.

[0202] In the embodiments of this application, after determining the transformation parameters of the current block based on the planar mode parameters of the current block, the residual value of the current block can be further determined based on the transformation parameters.

[0203] Furthermore, in the embodiments of this application, when determining the residual value of the current block based on the transformation parameters, the quantization coefficient of the current block can be determined first; then the transformation coefficient of the current block can be determined based on the quantization coefficient; finally, the residual value of the current block can be determined based on the transformation parameters and the transformation coefficient of the current block.

[0204] It is understood that, in the embodiments of this application, after the quantization coefficients of the current block are determined by the decoded bitstream, inverse quantization can be performed based on the quantization coefficients to determine the transform coefficients of the current block. Then, inverse transform can be performed using the transform parameters of the current block based on the transform coefficients, and finally the residual value of the current block can be obtained.

[0205] For example, in some embodiments, assuming that the transformation parameters of the current block determined based on the planar mode parameters of the current block are a transformation set, when performing inverse transformation using the transformation parameters of the current block, the transformation kernel of the current block can be determined first based on the transformation set, and then inverse transformation can be performed based on the transformation kernel to obtain the corresponding residual value.

[0206] For example, in some embodiments, LFNST / NSPT has a total of 35 transform sets, each of which contains 3 transform kernels, and the transform matrix is ​​determined by the transform kernels and the transform sets.

[0207] For example, in some embodiments, assuming that the transformation parameters of the current block, determined based on the planar mode parameters of the current block, are the transformation kernel, then the transformation kernel of the current block can be directly used to perform inverse transformation to obtain the corresponding residual value.

[0208] In summary, this application proposes a decoding method for planar modes, such as regular Planar mode, horizontal Planar mode, and vertical Planar mode. When deriving the intra-prediction mode (e.g., the first intra-prediction mode of the current block) used for MTS / LFNST / NSPT transform parameters, an intra-prediction mode that better matches the texture characteristics of the current block can be obtained based on relevant information of the current block (e.g., prediction values, template prediction matching errors in the MPM list, etc.). Using the derived intra-prediction mode to further derive transform parameters can improve coding performance.

[0209] For example, in some embodiments, for the conventional Planar mode, the relevant approach is to directly map the planar mode to intra-prediction mode 0 and derive the corresponding change set as set0. In contrast, the first intra-prediction mode obtained by deriving relevant information of the current block (e.g., prediction values, template prediction matching errors of the MPM list, etc.) is no longer limited to intra-prediction mode 0, and the derived corresponding change set is no longer limited to set0.

[0210] For example, in some embodiments, for the horizontal Planar mode, the relevant approach is to directly map the planar mode to the intra-prediction mode 18 and derive the corresponding change set as set18. In contrast, the first intra-prediction mode derived using relevant information of the current block (e.g., predicted values, template prediction matching errors of the MPM list, etc.) is no longer limited to the intra-prediction mode 18, and the derived corresponding change set is no longer limited to set18.

[0211] For example, in some embodiments, for the vertical Planar mode, the relevant approach is to directly map the planar mode to the intra-prediction mode 50 and derive the corresponding change set as set18. In contrast, the first intra-prediction mode derived using relevant information of the current block (e.g., predicted values, template prediction matching errors of the MPM list, etc.) is no longer limited to the intra-prediction mode 50, and the derived corresponding change set is no longer limited to set18.

[0212] This application provides a decoding method in which the decoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the residual value of the current block based on the transform parameters. In other words, in this application, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding and decoding performance.

[0213] In one embodiment of this application, FIG9 is a flowchart illustrating an encoding method provided in this application embodiment. As shown in FIG9, the encoding method of the encoder may include:

[0214] Step 901: Determine the planar mode parameters of the current block.

[0215] It should be noted that, in the embodiments of this application, the encoding method is applied to the encoder. Specifically, based on the composition structure of the encoder 100, the encoding method of the embodiments of this application can be applied to the intra-frame prediction part, which mainly includes a method for deriving the transform parameters of the current block based on the planar mode parameters of the current block, which can improve the accuracy of intra-frame prediction.

[0216] In the embodiments of this application, the planar mode parameters of the current block can be determined first. These planar mode parameters can be used to determine the planar mode of the current block.

[0217] It is understood that in the embodiments of this application, the planar mode is the same as the planar mode, wherein the planar mode (Planar mode) may include, but is not limited to, the regular planar mode, the horizontal planar mode, and the vertical planar mode.

[0218] Furthermore, in the embodiments of this application, the plane mode parameter is a parameter indicating the plane mode of the current block. The plane mode used by the current block can be determined by the value of the plane mode parameter. The value of the plane mode parameter can include a first value, a second value, and a third value, wherein the first, second, and third values ​​are different, and the first, second, and third values ​​can be in parameter form or in numerical form.

[0219] For example, in some embodiments, assuming the first value is 0, the second value is 1, and the third value is 2, the planar mode parameter of the current block can be represented as plIdx. When the planar mode parameter of the current block takes the first value, i.e., plIdx = 0, it can be determined that the planar mode used by the current block is the regular Planar mode; when the planar mode parameter of the current block takes the second value, i.e., plIdx = 1, it can be determined that the planar mode used by the current block is the horizontal Planar mode; and when the planar mode parameter of the current block takes the third value, i.e., plIdx = 2, it can be determined that the planar mode used by the current block is the vertical Planar mode.

[0220] Furthermore, in the embodiments of this application, the method for determining the planar mode parameters is not specifically limited. For example, the planar mode of the current block can be determined first, and then the planar mode parameters of the current block can be determined based on the planar mode of the current block.

[0221] For example, in some embodiments, the plane mode of the current block can be determined first, and then the value of the plane mode parameter plIdx can be determined based on the determined plane mode of the current block. Furthermore, the plane mode parameter plIdx can be written into the bitstream.

[0222] Furthermore, in the embodiments of this application, the prediction mode of the current block can be determined first. If the prediction mode of the current block is a planar mode, the planar mode parameters of the current block can be further determined.

[0223] It is understood that, in the embodiments of this application, if it is determined that the prediction mode of the current block is planar mode, that is, the current block is in planar mode, then the determination of the planar mode parameters of the current block can continue; if it is determined that the prediction mode of the current block is not planar mode, then the determination of the planar mode parameters of the current block can be skipped.

[0224] In other words, in the embodiments of this application, the determination of the planar mode parameters of the current block may depend on the prediction mode of the current block.

[0225] Step 902: Determine the transformation parameters of the current block based on the planar mode parameters of the current block.

[0226] In the embodiments of this application, after determining the planar mode parameters of the current block, the transformation parameters of the current block can be further determined based on the planar mode parameters of the current block.

[0227] It should be noted that, in the embodiments of this application, at the encoding end, the transform parameters of the current block can be used to transform the transform coefficients of the current block. The transform parameters of the current block can be the transform set of the current block, the transform kernel of the current block, or any other parameters used to transform the transform coefficients of the current block; this application does not impose specific limitations on these parameters.

[0228] In the embodiments of this application, when determining the transform parameters of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined first based on the planar mode parameters of the current block; then the transform parameters of the current block can be determined based on the first intra-frame prediction mode of the current block.

[0229] In embodiments of this application, the first intra-prediction mode of the current block can be an intra-prediction mode used to derive the transform parameters of the current block. Specifically, the first intra-prediction mode of the current block can be any intra-prediction mode in the unified intra-prediction mode IntraPredModeD. The mode index of IntraPredModeD is between [0, 66].

[0230] Furthermore, in the embodiments of this application, the method for determining the first intra-frame prediction mode of the current block can include various methods, and this application does not impose specific limitations. Specifically, the determination of the first intra-frame prediction mode of the current block can depend on the planar mode parameters of the current block; that is, the first intra-frame prediction mode of the current block can be derived from the planar mode parameters of the current block.

[0231] In other words, in the embodiments of this application, the derivation method of the first intra-frame prediction mode of the current block can be different for different plane mode parameters, or in other words, the derivation method of the first intra-frame prediction mode of the current block can be different for different plane modes.

[0232] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, one possible implementation is to determine the prediction value of the current block based on the planar mode parameters of the current block; and then determine the first intra-frame prediction mode of the current block based on the prediction value of the current block.

[0233] It is understood that, in the embodiments of this application, the predicted value of the current block can be determined first based on the planar mode parameters of the current block. Specifically, the method for determining the predicted value of the current block can be different for different planar mode parameters; in other words, the predicted value of the current block can be different for different planar modes.

[0234] For example, in some embodiments, assuming that the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the predicted value of the current block corresponding to the horizontal direction and the predicted value corresponding to the vertical direction can be determined first, and then the predicted value of the current block can be further determined based on the predicted value of the horizontal direction and the predicted value of the vertical direction.

[0235] As shown in Figures 7 and 8, if the current block uses the regular Planar mode for intra-frame prediction, the predicted value in the horizontal direction can be determined for any sample at position (x, y) in the current block. and vertical predicted values

[0236] Horizontal predicted value Refer to formula (1). Where x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (0, y). This is the filtered reference sample value for the reference sample at sample location (W+1, 0).

[0237] Vertical predicted value Refer to formula (2). Where W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (x, 0). The filtered reference sample value for the reference sample at sample location (0, H+1).

[0238] For a sample at any position (x, y) in the current block, the predicted value is based on the horizontal direction. and vertical predicted values Determine the corresponding predicted value Refer to formula (3). Wherein, This represents the uncorrected predicted value for the sample at position (x, y).

[0239] For example, in some embodiments, assuming the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal planar mode, the predicted value of the current block can be determined directly based on adjacent reference blocks. For example, the predicted value of the current block can be determined based on the left adjacent reference block and the upper right adjacent reference block.

[0240] For any sample at position (x, y) in the current block, the predicted value pred(x, y) is generated using the left reference block and the upper right reference block, as shown in formula (4). Here, x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, respectively; rec(-1, y) is the reconstructed value of the reference sample at position (-1, y) in the left reference block; rec(W, -1) is the reconstructed value of the reference sample at position (W, -1) in the upper right reference block; and q is the shift parameter.

[0241] For example, in some embodiments, assuming the planar mode parameter of the current block indicates that the planar mode of the current block is vertical planar mode, the predicted value of the current block can be determined directly based on adjacent reference blocks. For example, the predicted value of the current block can be determined based on the upper reference block and the lower left reference block.

[0242] For any sample at position (x, y) in the current block, the predicted value pred(x, y) is generated using the upper reference block and the lower left reference block, as shown in formula (5). Here, x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, respectively; recx, -1 is the reconstructed value of the reference sample at position (x, -1) in the upper reference block; and rec-1, H is the reconstructed value of the reference sample at position (-1, H) in the lower left reference block.

[0243] It is understood that, in the embodiments of this application, after determining the predicted value of the current block, the first intra-prediction mode of the current block can be further determined based on the predicted value of the current block. This application does not specifically limit the method of deriving the first intra-prediction mode based on the predicted value of the current block. For example, the gradient histogram (HoGs) can be determined based on the predicted value of the current block, and then the first intra-prediction mode for a given block can be derived based on the gradient histogram. That is, first, a gradient histogram is established, and then one or more intra-prediction modes and their corresponding amplitude values ​​are recorded based on the amplitude histogram. Finally, the intra-prediction mode with the largest accumulated amplitude value is selected as the derived first intra-prediction mode for the current block.

[0244] For example, in some embodiments, when determining the first intra-frame prediction mode of the current block based on the predicted value of the current block, the gradient magnitude value in the angular direction can be determined first based on the predicted value of the current block; and then the first intra-frame prediction mode of the current block can be determined based on the gradient magnitude value in the angular direction.

[0245] In the embodiments of this application, the reference region corresponding to the current block can be determined first based on the position information and size information of the current block; and then the first intra-frame prediction mode of the current block can be determined based on the reference region.

[0246] It is understood that, in the embodiments of this application, the size of the reference region may be related to the size information and / or position information of the current block. For example, based on the position and size (x, y, cbWidth, cbHeight) of the current block and the block vector (bvHor, bvVer), the position and size of the reference region (x+bvHor-offsetX, y+bvVer-offsetY, cbWidth+dW, cbHeight+dH) can be obtained, where offsetX, offsetY, dW, and dH can take any integer values.

[0247] For example, in some embodiments, the gradient magnitude value of the angular direction corresponding to the sample position can be determined based on the sample position in the sampling window and the reference region; finally, the first intra-frame prediction mode of the current block can be determined based on the gradient magnitude value of the angular direction.

[0248] In the embodiments of this application, the size of the sampling window can be set to any size, and this application does not impose any specific limitation. For example, a 3x3 sampling window can be set.

[0249] For example, in some embodiments, assuming the sampling window is a 3x3 window, when determining the gradient magnitude value of the angular direction corresponding to the sample position based on the sample position in the sampling window and the sample position in the reference region, for any sampling window in the reference region, the corresponding sample position is (x, y), and the horizontal gradient Gx and vertical gradient Gy of the adjacent reconstructed pixels can be calculated by the Sobel operator. The formula for the 3x3 Sobel operator is shown in formulas (6) and (7). Wherein, M_x is the horizontal gradient operator, M_y is the vertical gradient operator, and the horizontal gradient Gx and vertical gradient Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample value within the window position, respectively.

[0250] For example, in some embodiments, mapHgV = {{1, 0}, {0, 1}} and mapVgH = {{2, 3}, {3, 2}} can be set. angOffset = {18, 18, 50, 50} is set to map the gradient derivation result to the actual angle mode, where 18 and 50 correspond to the horizontal and vertical modes, respectively. angTable = {0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536} is set to derive the angle direction based on the gradient information. HoG

[0067] is set to an array containing the gradient intensity of each conventional intra-frame prediction mode. At the beginning of this process, all values ​​in all HoG arrays are initialized to 0.

[0251] For each sample p[x][y], with x=1…nTbW-2, y=1…nTbH-2, the calculation process is as follows:

[0252] Calculate the horizontal gradient gHor[x][y] = p[x-1][y-1] + 2p[x-1][y] + p[x-1][y+1] – p[x+1][y-1] – 2p[x+1][y] – p[x+1][y+1];

[0253] Calculate the vertical gradient gVer[x][y] = p[x-1][y-1] + 2p[x][y-1] + p[x+1][y-1] – p[x-1][y+1] – 2p[x][y+1] – p[x+1][y+1];

[0254] Calculate iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y])

[0255] Calculate signH[x][y] = gHor[x][y] < 0? 1:0

[0256] Calculate signV[x][y] = gVer[x][y] < 0? 1:0

[0257] Calculate HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0)

[0258] Calculate region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]])

[0259] Calculate grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gVer[x][y]) / abs(gHor[x][y]))

[0260] Calculate grad[x][y] = round(grad[x][y] × (1 << 16))

[0261] Calculate the index angIdx[x][y] = argmin_i(abs(angTable[i] – grad[x][y]))

[0262] Calculate the intra-frame mode ipm[x][y] = angOffset[region[x][y]] + angIdx[x][y]

[0263] Set HoG[ipm[x][y]]=HoG[ipm[x][y]]+iAmp[x][y]

[0264] Then, a direction mode IntraPredModeD is obtained. If HoG has no non-zero amplitude, IntraPredModeD is set to PLANA. Otherwise, if HoG has all zero amplitude, IntraPredModeD is set to argmax_i(HoG[i]).

[0265] Where argmax_i(L[i]), i = 0, ..., N, returns the index between 0 and N that maximizes L (if there are multiple maximum values, the smaller index is returned). argmin_i(L[i]), i = 0, ..., N, returns the index between 0 and N that minimizes L (if there are multiple maximum values, the smaller index is returned). That is, IntraPredModeD = argmax_i(HoG[i]), indicating that IntraPredModeD is the angle mode with the largest HoG amplitude.

[0266] In other words, the magnitude value G of the gradient at each reference position can be accumulated on its derived traditional intra-prediction mode to obtain a HoG. Finally, the traditional intra-prediction mode with the largest accumulated magnitude value is selected as the first intra-prediction mode of the current block.

[0267] It is understood that, in the embodiments of this application, for the implementation method of determining the prediction value of the current block based on the planar mode parameters of the current block, and determining the first intra-frame prediction mode of the current block based on the prediction value of the current block, the implementation method can be selected based on the planar mode parameters of the current block, that is, the implementation method can be selected based on the planar mode of the current block.

[0268] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected to choose an implementation method that derives the first intra-frame prediction mode based on the prediction value.

[0269] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0270] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the predicted value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the predicted value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the predicted value is not used.

[0271] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is horizontal Planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is regular Planar mode or vertical Planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0272] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical planar mode, then the prediction value of the current block can be determined first based on the planar mode parameter of the current block, and then the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular planar mode or a horizontal planar mode, then the implementation method of deriving the first intra-frame prediction mode based on the prediction value is not used.

[0273] Of course, in the embodiments of this application, the implementation method of deriving the first intra-frame prediction mode based on the predicted value can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not make specific limitations.

[0274] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, another possible implementation is to determine the most probable mode list (MPM) of the current block; determine the template prediction matching error of the prediction modes in the MPM of the current block; and determine the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction modes in the MPM of the current block.

[0275] In other words, in the embodiments of this application, the method of deriving the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block is not limited to gradient histograms, but can also be derived through the MPM list of the current block. For example, the MPM list of the current block can be obtained, the modes in the MPM list can be predicted on a template, and the mode with the smallest error can be selected as the first intra-frame prediction mode of the current block.

[0276] It is understood that, in the embodiments of this application, for the implementation method of determining the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction mode in the current block's MPM, whether to use this implementation method can be selected based on the planar mode parameters of the current block, that is, whether to use this implementation method is selected based on the planar mode of the current block.

[0277] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected, and the implementation method of deriving the first intra-frame prediction mode based on the template prediction matching error of the prediction mode in the MPM can be selected.

[0278] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0279] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0280] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a vertical Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0281] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a horizontal Planar mode, then the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM; if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical Planar mode, then the implementation of the first intra-frame prediction mode is not derived using the template prediction matching error of the prediction mode in the MPM.

[0282] Of course, in the embodiments of this application, the implementation method of deriving the first intra-frame prediction mode based on the template prediction matching error of the prediction mode in the MPM can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not make specific limitations.

[0283] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, another possible implementation is to directly determine the preset mode as the corresponding first intra-frame prediction mode based on the planar mode parameters of the current block, or in other words, to directly determine the preset mode as the corresponding first intra-frame prediction mode based on the planar mode of the current block.

[0284] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the first preset mode if the planar mode parameters of the current block indicate that the current block uses the first planar mode.

[0285] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the second preset mode if the planar mode parameters of the current block indicate that the current block uses the second planar mode.

[0286] In the embodiments of this application, when determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block, the first intra-frame prediction mode of the current block can be determined as the third preset mode if the planar mode parameters of the current block indicate that the current block uses the third planar mode.

[0287] It is understood that in the embodiments of this application, the first planar mode, the second planar mode, and the third planar mode can be different planar modes, such as any mode among the regular Planar mode, the horizontal Planar mode, and the vertical Planar mode; the first preset mode, the second preset mode, and the third preset mode are all intra-prediction modes, wherein the first preset mode can be the intra-prediction mode corresponding to the first planar mode, the second preset mode can be the intra-prediction mode corresponding to the second planar mode, and the third preset mode can be the intra-prediction mode corresponding to the third planar mode.

[0288] For example, in some embodiments, assuming the first planar mode is a regular Planar mode, the first preset mode corresponding to the first planar mode can be intra-prediction mode 0; assuming the second planar mode is a horizontal Planar mode, the second preset mode corresponding to the second planar mode can be intra-prediction mode 18; assuming the third planar mode is a vertical Planar mode, the third preset mode corresponding to the third planar mode can be intra-prediction mode 50.

[0289] It is understood that, in the embodiments of this application, for the implementation method of directly determining the first intra-frame prediction mode of the current block based on the preset mode, whether to use this implementation method can be selected based on the planar mode parameters of the current block, that is, whether to use this implementation method is selected based on the planar mode of the current block.

[0290] In other words, in the embodiments of this application, one or more horizontal modes among the conventional Planar mode, horizontal Planar mode, and vertical Planar mode can be selected to directly determine the intra-frame prediction mode based on a preset mode.

[0291] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on the preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the implementation method of determining the first intra-frame prediction mode directly based on the preset mode is not used.

[0292] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a special Planar mode (such as a horizontal Planar mode or a vertical Planar mode), then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0293] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a horizontal Planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular Planar mode or a vertical Planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0294] For example, in some embodiments, if the planar mode parameter of the current block indicates that the planar mode of the current block is a vertical planar mode, then the first intra-frame prediction mode of the current block can be determined directly based on a preset mode; if the planar mode parameter of the current block indicates that the planar mode of the current block is a regular planar mode or a horizontal planar mode, then the implementation method of determining the first intra-frame prediction mode directly based on a preset mode is not used.

[0295] Of course, in the embodiments of this application, the implementation method of directly determining the intra-frame prediction mode based on the preset mode can also be selected for the conventional Planar mode, horizontal Planar mode, and vertical Planar mode. This application does not impose specific limitations.

[0296] Therefore, in the embodiments of this application, for the current block, if the corresponding intra-frame prediction mode is a planar mode, then any one of the different derivation methods can be selected, such as deriving the first intra-frame prediction mode based on the prediction value, determining the first intra-frame prediction mode of the current block based on the template prediction matching error of the prediction mode in the MPM of the current block, or directly determining the first intra-frame prediction mode based on a preset mode. This application does not impose any specific limitations.

[0297] It is understood that, in the embodiments of this application, the derivation methods such as using the prediction value to derive the first intra-frame prediction mode or using the template prediction matching error of the prediction mode in the MPM of the current block to determine the first intra-frame prediction mode of the current block can obtain a prediction direction that is more in line with the texture characteristics of the current block. That is, the obtained first intra-frame prediction mode can be more adapted to the characteristics of the current block, and then the transformation parameters adapted to the characteristics of the current block can be obtained through the first intra-frame prediction mode.

[0298] Furthermore, in the embodiments of this application, when determining the derivation method of the first intra-frame prediction mode of the current block, the derivation method can be selected by combining information related to the current block. The information related to the current block used to determine the derivation method of the first intra-frame prediction mode of the current block includes, but is not limited to, one or more of the following: the size parameters of the current block, the mode derivation enable flag information of the current block, and the amplitude difference parameters of the current block.

[0299] It is understood that, in the embodiments of this application, when the size parameter of the current block is greater than or equal to the size threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, when the size parameter of the current block is greater than or equal to the size threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

[0300] It is understood that, in the embodiments of this application, when the size parameter of the current block is less than the size threshold, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode corresponding to the first planar mode, the second preset mode corresponding to the second planar mode, and the third preset mode corresponding to the third planar mode.

[0301] In other words, in the embodiments of this application, a pre-set size threshold of the current block can be compared, and then, based on the comparison result and the planar mode parameters of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined. The size threshold can be any integer greater than 0; for example, the size threshold can include, but is not limited to, 256.

[0302] It is understood that, in the embodiments of this application, if the size parameter of the current block is greater than or equal to the size threshold, then the derivation method of the first intra-frame prediction mode of the current block can be determined by using the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block can be determined by using the template prediction matching error of the prediction mode in the MPM of the current block.

[0303] Accordingly, in the embodiments of this application, if the size parameter of the current block is less than the size threshold, then the derivation method of the corresponding first intra-frame prediction mode can be selected by directly determining the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0304] For example, in some embodiments, the size parameter of the current block can be restricted. For instance, blocks with a size parameter greater than or equal to a threshold value (e.g., a size threshold of 256) can use a scheme to derive the corresponding first intra-frame pre-stored mode based on the predicted value through the gradient histogram, and further derive the transformation parameters (e.g., the transform set); blocks with a size parameter less than the threshold value can use a scheme to derive the transformation parameters using the corresponding preset mode (e.g., the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode), that is, directly determining the corresponding first intra-frame prediction mode based on the preset mode corresponding to the plane mode parameter (plane mode) of the current block, and further deriving the transformation parameters (e.g., the transform set).

[0305] It is understood that, in the embodiments of this application, the mode derivation enable flag information of the current block can be determined first; if the mode derivation enable flag information is a first value, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, if the mode derivation enable flag information is a first value, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the mode derivation enable flag information is a second value, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the plane mode parameters of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first plane mode, the second preset mode of the second plane mode, and the third preset mode of the third plane mode.

[0306] In other words, in the embodiments of this application, the enable identifier information can be derived based on the determined mode of the current block, and combined with the planar mode parameters of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined.

[0307] It is understood that, in the embodiments of this application, the mode derivation enable flag information of the current block can be used to determine whether the current block is allowed to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, the template prediction matching error of the prediction mode in the MPM of the current block is used to determine the derivation method of the first intra-frame prediction mode of the current block.

[0308] For example, in some embodiments, if the mode derivation enable flag information of the current block is a first value, then it is determined that the mode derivation enable flag information indicates that the current block is allowed to use the derivation method of determining the first intra-frame prediction mode of the current block based on the prediction value of the current block; or, the derivation method of determining the first intra-frame prediction mode of the current block is determined using the template prediction matching error of the prediction mode in the MPM of the current block; if the mode derivation enable flag information of the current block is a second value, then it is determined that the mode derivation enable flag information indicates that the current block is not allowed to use the derivation method of determining the first intra-frame prediction mode of the current block based on the prediction value of the current block, nor is it allowed to use the template prediction matching error of the prediction mode in the MPM of the current block to determine the derivation method of the first intra-frame prediction mode of the current block.

[0309] Here, the first value is different from the second value, and both the first and second values ​​can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.

[0310] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the mode derivation enable flag is set to 1, then it can be determined that the current block is allowed to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, the template prediction matching error of the prediction mode in the MPM of the current block is used to determine the derivation method of the first intra-frame prediction mode of the current block; if the mode derivation enable flag is set to 0, then it can be determined that the derivation method of the corresponding first intra-frame prediction mode is determined directly based on the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0311] It is understood that, in the embodiments of this application, when determining the mode derivation enable identifier information of the current block, the first generation value can be determined when the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, the first generation value can be determined when the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block; and the second generation value can be determined when the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameters of the current block; wherein, the preset mode includes one of the following: the first preset mode corresponding to the first planar mode, the second preset mode corresponding to the second planar mode, and the third preset mode corresponding to the third planar mode; the mode derivation enable identifier information of the current block is determined based on the first generation value and the second generation value.

[0312] For example, in some embodiments, if the first-generation value is greater than or equal to the second-generation value, it can be determined that the mode derivation enable flag information of the current block indicates that the current block is not allowed to use the derivation method of the first intra-frame prediction mode of the current block based on the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block is determined using the template prediction matching error of the prediction mode in the MPM of the current block; otherwise, if the first-generation value is less than the second-generation value, it can be determined that the mode derivation enable flag information of the current block indicates that the current block is allowed to use the derivation method of the first intra-frame prediction mode of the current block based on the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block is determined using the template prediction matching error of the prediction mode in the MPM of the current block.

[0313] It is understood that, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first based on the gradient amplitude value of the angular direction; if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the mode derivation enable flag information of the current block can be further written into the bitstream.

[0314] It should be noted that, in the embodiments of this application, the magnitude difference parameter of the current block can characterize the difference between gradient magnitude values ​​in different angular directions. For example, the magnitude difference parameter can be the difference between the two largest magnitude values ​​in the gradient histogram determined based on the gradient magnitude values ​​in the angular direction.

[0315] In other words, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first, and then the amplitude difference parameter of the current block can be compared with a preset amplitude difference threshold. Based on the comparison result and the planar mode parameter of the current block, the derivation method of the first intra-frame prediction mode of the current block can be further determined. The amplitude difference threshold can be any integer greater than 0; for example, the amplitude difference threshold can include, but is not limited to, 5.

[0316] It is understood that, in the embodiments of this application, if the amplitude difference parameter of the current block is less than the amplitude difference threshold, then it is possible to skip the determination of the mode derivation enable flag information of the current block, and instead choose to use the prediction value of the current block to determine the derivation method of the first intra-frame prediction mode of the current block; or, it is also possible to choose to use the template prediction matching error of the prediction mode in the MPM of the current block to determine the derivation method of the first intra-frame prediction mode of the current block.

[0317] Accordingly, in the embodiments of this application, if the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, then the mode derivation enable flag information of the current block can be further determined, and then the derivation method of the corresponding first intra-frame prediction mode can be determined based on the mode derivation enable flag information of the current block.

[0318] In other words, in the embodiments of this application, the determination of the mode derivation enable identifier information of the current block can depend on the amplitude difference parameter of the current block. That is, when the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, the determination of the mode derivation enable identifier information of the current block is performed; otherwise, the determination of the mode derivation enable identifier information of the current block is skipped.

[0319] For example, in some embodiments, if the amplitude difference (amplitude difference parameter) between the mode with the highest amplitude value and the mode with the second highest amplitude value in the gradient histogram constructed based on the predicted value is less than a threshold (amplitude difference, for example, 5), then the mode derivation enable flag information of the current block is not transmitted in the bitstream. Instead, the scheme of deriving the corresponding first intra-frame pre-stored mode based on the predicted value through the gradient histogram and further deriving the transformation parameters (such as the transform set) is directly used. Otherwise, if the amplitude difference (amplitude difference parameter) is greater than or equal to a threshold (amplitude difference, for example, 5), then the mode derivation enable flag information of the current block continues to be written into the bitstream.

[0320] It is understood that, in the embodiments of this application, the amplitude difference parameter of the current block can be determined first based on the gradient amplitude value of the angular direction; if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined based on the template prediction matching error of the prediction mode in the MPM of the current block; if the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the first intra-frame prediction mode of the current block can be determined as a preset mode based on the plane mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first plane mode, the second preset mode of the second plane mode, and the third preset mode of the third plane mode.

[0321] It is understood that, in the embodiments of this application, if the amplitude difference parameter of the current block is less than the amplitude difference threshold, then the derivation method of the first intra-frame prediction mode of the current block can be determined by using the prediction value of the current block; or, the derivation method of the first intra-frame prediction mode of the current block can be determined by using the template prediction matching error of the prediction mode in the MPM of the current block.

[0322] Accordingly, in the embodiments of this application, if the amplitude difference parameter of the current block is greater than or equal to the amplitude difference threshold, then the derivation method of the corresponding first intra-frame prediction mode can be selected by directly determining the preset mode (such as the first preset mode, the second preset mode, or the third preset mode) corresponding to the plane mode parameter (plane mode) of the current block.

[0323] In other words, in the embodiments of this application, after determining the amplitude difference parameter of the current block, the derivation method of the first intra-frame prediction mode can be selected directly based on the comparison result between the amplitude difference parameter of the current block and the amplitude difference threshold.

[0324] For example, in some embodiments, if the amplitude difference (amplitude difference parameter) between the mode with the highest amplitude value and the mode with the second highest amplitude value in the gradient histogram constructed based on the predicted value is less than a threshold (amplitude difference, for example, 5), then the scheme of deriving the corresponding first intra-frame pre-stored mode based on the predicted value through the gradient histogram and further deriving the transformation parameters (such as the transform set) is directly used; otherwise, if the amplitude difference (amplitude difference parameter) is greater than or equal to a threshold (amplitude difference, for example, 5), then the scheme of deriving the transformation parameters is directly adopted using the corresponding preset mode (such as the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode), that is, the scheme of directly determining the corresponding first intra-frame predicted mode based on the preset mode corresponding to the plane mode parameter (plane mode) of the current block and further deriving the transformation parameters (such as the transform set).

[0325] Furthermore, in the implementation of this application, after determining the first intra-frame prediction mode of the current block, the transform parameters of the current block can be further determined based on the first intra-frame prediction mode. Specifically, the transform set and / or transform kernel of the current block can be determined according to the determined first intra-frame prediction mode corresponding to the planar mode of the current block.

[0326] For example, in some embodiments, the transform set corresponding to the first intra-prediction mode can be determined according to the mapping relationship between the intra-prediction mode and the transform set, and then the transform kernel of the current block can be determined based on the transform set.

[0327] For example, in some embodiments, the transform kernel corresponding to the first intra-prediction mode can be determined according to the mapping relationship between the intra-prediction mode and the transform kernel, and the transform kernel is the transform kernel of the current block.

[0328] Step 903: Determine the quantization coefficients of the current block based on the transformation parameters and the residual value of the current block.

[0329] In the embodiments of this application, after determining the transform parameters of the current block based on the planar mode parameters of the current block, the quantization coefficients of the current block can be further determined based on the transform parameters and the residual value of the current block.

[0330] Furthermore, in the embodiments of this application, when determining the quantization coefficient of the current block based on the transformation parameters and the residual value of the current block, the transformation coefficient of the current block can be determined first based on the transformation parameters and the residual value of the current block; then the quantization coefficient of the current block can be determined based on the transformation coefficient of the current block.

[0331] It is understood that, in the embodiments of this application, after determining the quantization coefficient of the current block, the quantization coefficient of the current block can be further written into the bitstream.

[0332] Furthermore, in the embodiments of this application, when the transformation parameters of the current block are determined, the residual value of the current block can be transformed using the transformation parameters of the current block to obtain the corresponding transformation coefficients; then the transformation coefficients can be quantized using the quantization coefficients to finally obtain the quantization coefficients of the current block.

[0333] For example, in some embodiments, assuming that the transformation parameters of the current block determined based on the planar mode parameters of the current block are a transformation set, when using the transformation parameters of the current block for transformation, the transformation kernel of the current block can be determined first according to the transformation set, and then the residual value of the current block can be transformed according to the transformation kernel to obtain the transformation coefficients.

[0334] For example, in some embodiments, LFNST / NSPT has a total of 35 transform sets, each of which contains 3 transform kernels, and the transform matrix is ​​determined by the transform kernels and the transform sets.

[0335] For example, in some embodiments, assuming that the transformation parameters of the current block determined based on the planar mode parameters of the current block are the transformation kernels, the residual values ​​of the current block can be directly transformed using the transformation kernels of the current block to obtain the transformation coefficients.

[0336] In summary, this application proposes a decoding method for planar modes, such as regular Planar mode, horizontal Planar mode, and vertical Planar mode. When deriving the intra-prediction mode (e.g., the first intra-prediction mode of the current block) used for MTS / LFNST / NSPT transform parameters, an intra-prediction mode that better matches the texture characteristics of the current block can be obtained based on relevant information of the current block (e.g., prediction values, template prediction matching errors in the MPM list, etc.). Using the derived intra-prediction mode to further derive transform parameters can improve coding performance.

[0337] For example, in some embodiments, for the conventional Planar mode, the relevant approach is to directly map the planar mode to intra-prediction mode 0 and derive the corresponding change set as set0. In contrast, the first intra-prediction mode obtained by deriving relevant information of the current block (e.g., prediction values, template prediction matching errors of the MPM list, etc.) is no longer limited to intra-prediction mode 0, and the derived corresponding change set is no longer limited to set0.

[0338] For example, in some embodiments, for the horizontal Planar mode, the relevant approach is to directly map the planar mode to the intra-prediction mode 18 and derive the corresponding change set as set18. In contrast, the first intra-prediction mode derived using relevant information of the current block (e.g., predicted values, template prediction matching errors of the MPM list, etc.) is no longer limited to the intra-prediction mode 18, and the derived corresponding change set is no longer limited to set18.

[0339] For example, in some embodiments, for the vertical Planar mode, the relevant approach is to directly map the planar mode to the intra-prediction mode 50 and derive the corresponding change set as set18. In contrast, the first intra-prediction mode derived using relevant information of the current block (e.g., predicted values, template prediction matching errors of the MPM list, etc.) is no longer limited to the intra-prediction mode 50, and the derived corresponding change set is no longer limited to set18.

[0340] This application provides an encoding method in which the encoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the quantization coefficients of the current block based on the transform parameters and the residual value of the current block. In other words, in this application, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding and decoding performance.

[0341] Based on the above embodiments, another embodiment of this application proposes an encoding and decoding method. For planar mode, a fixed intra-frame prediction mode (such as a preset mode) mapping method can be adopted, or an additional method can be selected to determine the intra-frame prediction mode used to derive the transform parameters, thereby improving the encoding and decoding performance.

[0342] The method proposed in this application will be illustrated below, taking the current block's planar mode as the regular Planar mode and the current block's transformation parameters as the transformation set as an example.

[0343] In related technologies, conventional Planar models do not have the directionality of traditional angle models when making predictions, and the final predicted value is closely related to the characteristics of the reference row. This leads to the defect that the selection of the transform set cannot accurately reflect the directional characteristics of the residual.

[0344] This application proposes an additional method to determine the intra-prediction mode (IPM) used by the MTS / LFNST / NSPT transform set when transforming the conventional Planar prediction mode.

[0345] One approach is to derive the gradient histogram from the regular Planar prediction values ​​to obtain the intra-prediction mode (IPM) with the highest amplitude. This intra-prediction mode is then used as the first intra-prediction mode for deriving the MTS / LFNST / NSPT transform set in the current block.

[0346] The input to the gradient histogram derivation IPM is the predicted value of the current regular Planar prediction block. The output of the gradient histogram derivation IPM is the traditional intra-prediction mode IntraPredModeD, where IntraPredModeD is between [0, 66].

[0347] For example, in some embodiments, Figure 10 is a schematic diagram of the prediction process in Planar mode provided by the embodiments of this application. As shown in Figure 10, the process of obtaining the adaptive IPM in conventional Planar mode mainly includes: Planar parameter selection, Planar prediction value generation, and gradient histogram derivation of IPM. After the above process, the adaptive IPM for transform set selection in Planar mode can be obtained. Then, the IPM can be used to obtain the MTS / LFNST / NSPT transform set.

[0348] In the embodiments of this application, the Planar parameter selection, i.e., the determination of the planar mode parameter plIdx, supports two additional planar modes: horizontal Planar mode and vertical Planar mode. The encoder / decoder uses a CU-level Idx:plIdx to identify whether the regular Planar mode (plIdx = 0), horizontal Planar mode (plIdx = 1), or vertical Planar mode (plIdx = 2) is used. For different plIdx inputs, different prediction methods will be used for predictor generation and transform set selection.

[0349] At the encoding end, plIdx is determined by the specific Planar prediction method during the comparison rate distortion cost (RDCost) process. When comparing the regular Planar mode, cu.plIdx is 0 by default. When comparing the horizontal Planar mode, cu.plIdx is assigned to 1. When comparing the vertical Planar mode, cu.plIdx is assigned to 2.

[0350] At the decoding end, pluIdx is obtained by reading in a 2-bit code stream and written to cu.plIdx.

[0351] In the embodiments of this application, if the current block uses the conventional Planar mode for intra-frame prediction, for any sample at position (x, y) in the current block, the predicted value in the horizontal direction can be determined respectively. and vertical predicted values

[0352] Horizontal predicted value Refer to formula (1). Where x = 1, 2, ..., W; y = 1, 2, ..., H, W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (0, y). This is the filtered reference sample value for the reference sample at sample location (W+1, 0).

[0353] Vertical predicted value Refer to formula (2). Where W and H are the width and height of the current block, respectively. This is the filtered reference sample value for the reference sample at sample location (x, 0). The filtered reference sample value for the reference sample at sample location (0, H+1).

[0354] For a sample at any position (x, y) in the current block, the predicted value is based on the horizontal direction. and vertical predicted values Determine the corresponding predicted value Refer to formula (3). Wherein, This represents the uncorrected predicted value for the sample at position (x, y).

[0355] In the embodiments of this application, when deriving IPM based on gradient histogram, one possible approach is to calculate the horizontal and vertical gradients of adjacent reconstructed pixels using the Sobel operator. The Sobel operator formulas are shown in formulas (6) and (7). Here, M_x is the horizontal gradient operator, M_y is the vertical gradient operator, and the horizontal gradient Gx and vertical gradient Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample values ​​within the window position, respectively.

[0356] In the embodiments of this application, when deriving IPM based on gradient histogram, the input is the current block prediction value, and the output is the traditional intra-frame prediction mode IntraPredModeD, where the mode index of IntraPredModeD is between [0, 66].

[0357] Set mapHgV = {{1,0},{0,1}} and mapVgH = {{2,3},{3,2}}

[0358] Set angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536}

[0359] Set angOffset = {18, 18, 50, 50}

[0360] Set HoG

[0067] to an array containing the gradient intensities for each conventional intra-prediction mode. At the start of this process, all values ​​in all HoG arrays are initialized to 0.

[0361] For each predicted pixel p[x][y], with x=1…nTbW-2, y=1…nTbH-2, the calculation process is as follows:

[0362] Calculate the horizontal gradient gHor[x][y] = p[x-1][y-1] + 2p[x-1][y] + p[x-1][y+1] – p[x+1][y-1] – 2p[x+1][y] – p[x+1][y+1]

[0363] Calculate the vertical gradient gVer[x][y] = p[x-1][y-1] + 2p[x][y-1] + p[x+1][y-1] – p[x-1][y+1] – 2p[x][y+1] – p[x+1][y+1]

[0364] Calculate iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y])

[0365] Calculate signH[x][y] = gHor[x][y] < 0? 1:0

[0366] Calculate signV[x][y] = gVer[x][y] < 0? 1:0

[0367] Calculate HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0)

[0368] Calculate region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]])

[0369] Calculate grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y]) / abs(gHor[x][y]):abs(gVer[x][y]) / abs(gHor[x][y]))

[0370] Calculate grad[x][y] = round(grad[x][y] × (1 << 16))

[0371] Calculate the index angIdx[x][y] = argmin_i(abs(angTable[i] – grad[x][y]))

[0372] Calculate the intra-frame mode ipm[x][y] = angOffset[region[x][y]] + angIdx[x][y]

[0373] Set HoG[ipm[x][y]]=HoG[ipm[x][y]]+iAmp[x][y]

[0374] Then, we continue to calculate a direction mode IntraPredModeD:

[0375] If HoG has no non-zero amplitude, then:

[0376] Set IntraPredModeD to PLANA

[0377] otherwise:

[0378] Set IntraPredModeD to argmax_i(HoG[i])

[0379] Where argmax_i(L[i]), i = 0, ..., N, returns the index between 0 and N that maximizes L (if there are multiple maximum values, the smaller index is returned). argmin_i(L[i]), i = 0, ..., N, returns the index between 0 and N that minimizes L (if there are multiple maximum values, the smaller index is returned). That is, IntraPredModeD = argmax_i(HoG[i]), indicating that IntraPredModeD is the angle mode with the largest HoG amplitude.

[0380] In other words, in the embodiments of this application, during the IPM selection process of the MTS / LFNST / NSPT transform mode, the IPM is obtained by deriving the gradient histogram of the predicted value for the conventional Planar mode where plIdx = 0.

[0381] In the embodiments of this application, for Planar to obtain the MTS / LFNST / NSPT transform set, there are a total of 35 transform sets in LFNST / NSPT. Each transform set contains 3 transform kernels, and the transform matrix is ​​jointly determined by the transform kernels and the transform set. The transform set is determined by the Intra Prediction Mode (IPM) mapping. In the intra-frame explicit MTS transform mode, IPM, block size, and mtsIdx jointly determine the MTS transform pair.

[0382] For example, if the input of the Planar parameter plIdx is 0 (normal Planar mode), the mapped intra-prediction mode is mapped to intra-prediction mode 0, and the subsequently derived transform set is set0.

[0383] For example, for the regular Planar mode, the IPM obtained by deriving the gradient histogram of the predicted value is not necessarily intra-predicted mode 0, but may be any prediction mode with a mode index between [0, 66]. Correspondingly, the derived transform set is not necessarily set0, but may be any transform set in the 35 transform sets.

[0384] Therefore, in the embodiments of this application, for the conventional Planar mode, the intra-prediction mode (IPM) of MTS / LFNST / NSPT can be derived using the gradient histogram of the prediction block, and the transform set can also be derived.

[0385] In other words, in the embodiments of this application, when deriving the IPM used for the MTS / LFNST / NSPT transform set in the conventional Planar mode, the transform set can be derived by finding the prediction direction that is more in line with the current block texture characteristics based on the characteristics of the prediction value, which can improve the coding performance.

[0386] Furthermore, in the embodiments of this application, for Planar modes of different prediction methods, different IPM selections can be made when performing MTS / LFNST / NSPT based on different Planar parameters.

[0387] For example, for the regular Planar mode and the horizontal Planar mode with plIdx=1, the intra-prediction mode IPM of MTS / LFNST / NSPT can be derived using the gradient histogram of the prediction block, and the transform set can be derived. For the vertical Planar mode with plIdx=2, the intra-prediction mode 50 can be selected for transform set derivation.

[0388] For example, for the regular Planar mode and the vertical Planar mode with plIdx=2, the intra-prediction mode IPM of MTS / LFNST / NSPT can be derived using the gradient histogram of the prediction block, and the transform set can be derived. For the horizontal Planar mode with plIdx=1, the intra-prediction mode 18 can be selected for transform set derivation.

[0389] In other words, for the regular Planar mode, horizontal Planar mode, and vertical Planar mode, the IPM used to derive the MTS / LFNST / NSPT transform set can all be derived by using the gradient histogram of the prediction block for directional mode derivation.

[0390] In the embodiments of this application, the block size of the scheme can also be restricted. For example, the block size can be restricted to a threshold value (e.g., 256) for which a transformation set selection scheme based on gradient histogram derivation is used, while blocks smaller than this threshold value can select a scheme to derive the transformation set using the corresponding preset mode (e.g., the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode).

[0391] In the embodiments of this application, the transformation set selection scheme derived based on gradient histogram competes with the transformation set selection scheme derived using the corresponding preset mode: in Planar mode, the transformation set corresponding to the direction prediction mode derived based on gradient histogram competes with the transformation set derived using the corresponding preset mode. A 1-bit identifier (mode derivation enable identifier information of the current block) is transmitted in the bitstream to indicate whether to use the derived transformation set or to derive the corresponding transformation set using the corresponding preset mode.

[0392] In the embodiments of this application, the transmission of the Flag (mode derivation enable flag information of the current block) in the bitstream can be determined based on the gradient histogram constructed from the Planar prediction values. For example, if the difference in amplitude between the mode with the highest amplitude and the mode with the second highest amplitude in the gradient histogram constructed from the Planar prediction values ​​is less than a threshold (e.g., 5), then the Flag is not transmitted in the bitstream, and the transform set is directly obtained using the IPM derived from the gradient histogram; otherwise, the transform set is directly obtained by derivation using the corresponding preset mode.

[0393] In the embodiments of this application, the IPM derivation method of Planar mode is not limited to gradient histogram derivation, and other methods can also be used, including but not limited to: obtaining the MPM list of the current block, predicting the modes in the MPM main list on the template, and selecting the mode with the smallest error as the IPM for MTS / LFNST / NSPT transform set selection.

[0394] In summary, this application proposes a decoding method for planar modes, such as regular Planar mode, horizontal Planar mode, and vertical Planar mode. When deriving the intra-prediction mode (e.g., the first intra-prediction mode of the current block) used for MTS / LFNST / NSPT transform parameters, an intra-prediction mode that better matches the texture characteristics of the current block can be obtained based on relevant information of the current block (e.g., prediction values, template prediction matching errors in the MPM list, etc.). Using the derived intra-prediction mode to further derive transform parameters can improve coding performance.

[0395] This application provides an encoding and decoding method. The decoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the residual value of the current block based on the transform parameters. The encoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the quantization coefficients of the current block based on the transform parameters and the residual value of the current block. In other words, in this application's embodiments, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding and decoding performance.

[0396] Based on the above embodiments, in another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG11 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG11, the encoder 100 may include a first determining portion 1101, wherein:

[0397] The first determining part 1101 is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the quantization coefficients of the current block based on the transformation parameters and the residual value of the current block.

[0398] 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 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 described above can be implemented in hardware or as a software functional module.

[0399] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part 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.) or processor to execute all or part of the steps of the method described in this embodiment. 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.

[0400] Therefore, this application provides a computer-readable storage medium applied to an encoder 100, the computer-readable storage medium storing a computer program that, when executed by a first processor, implements the method described in any of the foregoing embodiments.

[0401] Based on the composition of the encoder 100 described above and the computer-readable storage medium, Figure 12 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application. As shown in Figure 12, the encoder 100 may include: a first communication interface 1201, a first memory 1202, and a first processor 1203; the various components are coupled together through a first bus system 1204. It can be understood that the first bus system 1204 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 1204 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the first bus system 1204 in the figure.

[0402] The first communication interface 1201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;

[0403] The first memory 1202 is used to store computer programs that can run on the first processor 1203;

[0404] The first processor 1203 is configured to, when running the computer program, perform the following: determine the planar mode parameters of the current block; determine the transform parameters of the current block based on the planar mode parameters of the current block; and determine the quantization coefficients of the current block based on the transform parameters and the residual value of the current block.

[0405] It is understood that the first memory 1202 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 1202 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.

[0406] The first processor 1203 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 1203 or by instructions in software form. The first processor 1203 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 1202. The first processor 1203 reads the information in the first memory 1202 and completes the steps of the above method in conjunction with its hardware.

[0407] 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.

[0408] Alternatively, as another embodiment, the first processor 1203 is further configured to execute the method described in any of the foregoing embodiments when running the computer program.

[0409] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG13 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG13, the decoder 200 may include a second determining part 2101, wherein:

[0410] The second determining part 2101 is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the residual value of the current block based on the transformation parameters.

[0411] 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.

[0412] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium applied to the decoder 200. This computer-readable storage medium stores a computer program, which, when executed by a second processor, implements the method described in any of the foregoing embodiments.

[0413] Based on the composition of the decoder 200 and the computer-readable storage medium described above, Figure 14 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application. As shown in Figure 14, the decoder 200 may include: a second communication interface 2201, a second memory 2202, and a second processor 2203; the various components are coupled together through a second bus system 2204. It is understood that the second bus system 2204 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 2204 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 2204 in the figure.

[0414] The second communication interface 2201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;

[0415] The second memory 2202 is used to store computer programs that can run on the second processor 2203;

[0416] The second processor 2203 is configured to, when running the computer program, perform the following: determining the planar mode parameters of the current block; determining the transformation parameters of the current block based on the planar mode parameters of the current block; and determining the residual value of the current block based on the transformation parameters.

[0417] Alternatively, as another embodiment, the second processor 2203 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.

[0418] It is understood that the second memory 2202 has similar hardware functions to the first memory 1202, and the second processor 2203 has similar hardware functions to the first processor 1203; details will not be elaborated here.

[0419] In another embodiment of this application, FIG15 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. As shown in FIG15, the encoding and decoding system 300 may include an encoder 100 and a decoder 200.

[0420] In the embodiments of this application, the encoder 100 may be any one of the encoders described in the foregoing embodiments, and the decoder 200 may be any one of the decoders described in the foregoing embodiments.

[0421] Furthermore, embodiments of this application also propose a bitstream, wherein the bitstream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least: quantization coefficients of the current block, plane mode parameters of the current block, and mode derivation enable flag information of the current block.

[0422] Furthermore, this embodiment provides a computer-readable storage medium for storing a bitstream generated by any of the encoding methods in the foregoing embodiments.

[0423] 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.

[0424] 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.

[0425] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0426] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0427] 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.

[0428] 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

[0429] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The decoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the residual value of the current block based on the transform parameters. The encoder determines the planar mode parameters of the current block; determines the transform parameters of the current block based on the planar mode parameters; and determines the quantization coefficients of the current block based on the transform parameters and the residual value of the current block. In other words, in this application's embodiments, for planar modes, transform parameters can be derived based on the planar mode parameters, thereby obtaining transform parameters that more fully reflect the directional characteristics of the samples, thus achieving accurate prediction results and improving encoding / decoding performance.

Claims

1. A decoding method applied to a decoder, the method comprising: Determine the planar mode parameters for the current block; The transformation parameters of the current block are determined based on the planar mode parameters of the current block; The residual value of the current block is determined based on the transformation parameters.

2. The method according to claim 1, wherein, Determining the transformation parameters of the current block based on the planar mode parameters of the current block includes: The first intra-frame prediction mode of the current block is determined based on the planar mode parameters of the current block; The transform parameters of the current block are determined based on the first intra-frame prediction mode of the current block.

3. The method according to claim 2, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: The predicted value of the current block is determined based on the planar pattern parameters of the current block; The first intra-frame prediction mode of the current block is determined based on the predicted value of the current block.

4. The method according to claim 3, wherein, Determining the first intra-frame prediction mode of the current block based on the predicted value of the current block includes: Based on the predicted value of the current block, determine the gradient magnitude value in the angular direction; The first intra-frame prediction mode of the current block is determined based on the gradient magnitude value in the angular direction.

5. The method according to claim 2, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: Determine the most likely pattern list (MPM) for the current block; Determine the template prediction matching error of the prediction mode in the MPM of the current block; The first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

6. The method according to claim 2, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the planar mode parameter of the current block indicates that the current block uses a first planar mode, the first intra-frame prediction mode of the current block is determined to be a first preset mode.

7. The method according to claim 2, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the planar mode parameter of the current block indicates that the current block uses a second planar mode, the first intra-frame prediction mode of the current block is determined to be the second preset mode.

8. The method according to claim 2, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the plane mode parameter of the current block indicates that the current block uses the third plane mode, the first intra-frame prediction mode of the current block is determined to be the third preset mode.

9. The method according to any one of claims 3-5, wherein, The method further includes: If the size parameter of the current block is greater than or equal to a size threshold, the first intra-frame prediction mode of the current block is determined based on the predicted value of the current block; or, if the size parameter of the current block is greater than or equal to a size threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

10. The method according to any one of claims 6-8, wherein, The method further includes: If the size parameter of the current block is less than the size threshold, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameter of the current block; wherein, the preset mode includes one of the following: a first preset mode corresponding to a first planar mode, a second preset mode corresponding to a second planar mode, and a third preset mode corresponding to a third planar mode.

11. The method according to any one of claims 2-10, wherein, The method further includes: Determine the mode derivation enable identifier information of the current block; When the mode derivation enable flag information is set to a first value, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, when the mode derivation enable flag information is set to a first value, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block. When the mode derivation enable flag information is set to the second value, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameters of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first planar mode, the second preset mode of the second planar mode, and the third preset mode of the third planar mode.

12. The method according to claim 4, wherein, The method further includes: The magnitude difference parameter of the current block is determined based on the gradient magnitude value in the angular direction; If the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block. If the amplitude difference parameter is greater than or equal to the amplitude difference threshold, determine the mode derivation enable identifier information of the current block.

13. The method according to claim 4, wherein, The method further includes: The magnitude difference parameter of the current block is determined based on the gradient magnitude value in the angular direction; If the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, if the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block. When the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined as a preset mode based on the plane mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode of the first plane mode, the second preset mode of the second plane mode, and the third preset mode of the third plane mode.

14. The method according to any one of claims 1-13, wherein, The method further includes: If the prediction mode of the current block is planar mode, determine the planar mode parameters of the current block.

15. The method according to any one of claims 1-14, wherein, Determining the residual value of the current block based on the transformation parameters includes: Determine the quantization coefficients of the current block; The transformation coefficients of the current block are determined based on the quantization coefficients; The residual value of the current block is determined based on the transformation parameters and the transformation coefficients of the current block.

16. An encoding method applied to an encoder, the method comprising: Determine the planar mode parameters for the current block; The transformation parameters of the current block are determined based on the planar mode parameters of the current block; The quantization coefficients of the current block are determined based on the transformation parameters and the residual value of the current block.

17. The method according to claim 16, wherein, Determining the transformation parameters of the current block based on the planar mode parameters of the current block includes: The first intra-frame prediction mode of the current block is determined based on the planar mode parameters of the current block; The transform parameters of the current block are determined based on the first intra-frame prediction mode of the current block.

18. The method according to claim 17, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: The predicted value of the current block is determined based on the planar pattern parameters of the current block; The first intra-frame prediction mode of the current block is determined based on the predicted value of the current block.

19. The method of claim 17, wherein, Determining the first intra-frame prediction mode of the current block based on the predicted value of the current block includes: Based on the predicted value of the current block, determine the gradient magnitude value in the angular direction; The first intra-frame prediction mode of the current block is determined based on the gradient magnitude value in the angular direction.

20. The method of claim 17, wherein, in, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: Determine the most likely pattern list (MPM) for the current block; Determine the template prediction matching error of the prediction mode in the MPM of the current block; The first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

21. The method according to claim 17, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the planar mode parameter of the current block indicates that the current block uses a first planar mode, the first intra-frame prediction mode of the current block is determined to be a first preset mode.

22. The method according to claim 17, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the planar mode parameter of the current block indicates that the current block uses a second planar mode, the first intra-frame prediction mode of the current block is determined to be the second preset mode.

23. The method according to claim 17, wherein, Determining the first intra-frame prediction mode of the current block based on the planar mode parameters of the current block includes: If the plane mode parameter of the current block indicates that the current block uses the third plane mode, the first intra-frame prediction mode of the current block is determined to be the third preset mode.

24. The method according to any one of claims 18-20, wherein, The method further includes: If the size parameter of the current block is greater than or equal to a size threshold, the first intra-frame prediction mode of the current block is determined based on the predicted value of the current block; or, if the size parameter of the current block is greater than or equal to a size threshold, the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block.

25. The method according to any one of claims 21-23, wherein, The method further includes: If the size parameter of the current block is less than the size threshold, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameter of the current block; wherein, the preset mode includes one of the following: a first preset mode corresponding to a first planar mode, a second preset mode corresponding to a second planar mode, and a third preset mode corresponding to a third planar mode.

26. The method according to any one of claims 17-25, wherein, The method further includes: A first-generation value is determined when the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; or, when the first intra-frame prediction mode of the current block is determined based on the template prediction matching error of the prediction mode in the MPM of the current block, the first-generation value is determined. If the first intra-frame prediction mode of the current block is determined to be a preset mode based on the planar mode parameters of the current block, the second generation value is determined; wherein the preset mode includes one of the following: the first preset mode corresponding to the first planar mode, the second preset mode corresponding to the second planar mode, and the third preset mode corresponding to the third planar mode. Based on the first-generation value and the second-generation value, the mode derivation enable identifier information of the current block is determined, and the mode derivation enable identifier information of the current block is written into the code stream.

27. The method according to claim 19, wherein, The method further includes: The magnitude difference parameter of the current block is determined based on the gradient magnitude value corresponding to the angle direction; If the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; If the amplitude difference parameter is greater than or equal to the amplitude difference threshold, determine the mode derivation enable flag information of the current block and write the mode derivation enable flag information of the current block into the bitstream.

28. The method according to claim 19, wherein, The method further includes: The magnitude difference parameter of the current block is determined based on the gradient magnitude value in the angular direction. If the amplitude difference parameter is less than the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined based on the prediction value of the current block; When the amplitude difference parameter is greater than or equal to the amplitude difference threshold, the first intra-frame prediction mode of the current block is determined to be a preset mode based on the plane mode parameter of the current block; wherein, the preset mode includes one of the following: the first preset mode corresponding to the first plane mode, the second preset mode corresponding to the second plane mode, and the third preset mode corresponding to the third plane mode.

29. The method according to any one of claims 16-28, wherein, The method further includes: If the prediction mode of the current block is planar mode, determine the planar mode parameters of the current block.

30. The method according to any one of claims 16-29, wherein, The method further includes: Write the planar mode parameters of the current block into the bitstream.

31. The method according to any one of claims 16-30, wherein, Determining the quantization coefficients of the current block based on the transformation parameters and the residual value of the current block includes: Based on the transformation parameters and the residual value of the current block, the transformation coefficients of the current block are determined; The quantization coefficients of the current block are determined based on the transform coefficients of the current block.

32. The method according to claim 31, wherein, The method further includes: Write the quantization coefficients of the current block into the bitstream.

33. A bitstream, wherein, The bitstream is generated by bit encoding based on the information to be encoded; wherein the information to be encoded includes at least one of the following: the quantization coefficient of the current block, the plane mode parameter of the current block, and the mode derivation enable flag information of the current block.

34. An encoder, wherein, The encoder includes: The first determining part is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the quantization coefficients of the current block based on the transformation parameters and the residual value of the current block.

35. An encoder, wherein, The encoder includes: a first memory and a first processor; wherein, A first memory for storing computer programs that can run on a first processor; A first processor is configured to, while running the computer program, perform the method as described in any one of claims 16-32.

36. A decoder, wherein, The decoder includes: The second determining part is configured to determine the planar mode parameters of the current block; determine the transformation parameters of the current block based on the planar mode parameters of the current block; and determine the residual value of the current block based on the transformation parameters.

37. A decoder, wherein, The decoder includes: a second memory and a second processor; wherein... The second memory is used to store computer programs that can run on the second processor; A second processor is configured to, while running the computer program, perform the method as described in any one of claims 1-15.

38. A computer-readable storage medium storing a computer program that, when executed, implements the decoding method as described in any one of claims 1-15, or the encoding method as described in any one of claims 16-32.

39. A computer-readable storage medium for storing a bitstream generated by the encoding method of any one of claims 16-32.