Encoding and decoding method, code stream, encoder, decoder and storage medium

CN121986485APending Publication Date: 2026-05-05GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-09-28
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

The existing video encoding standards have low compression efficiency in inter-frame prediction, especially when dealing with complex textures and multi-angle texture features, the transformation process is not comprehensive enough.

Method used

By determining the texture feature index of the current block, determining its corresponding transform core group and transform core, performing transformation and inverse transformation to obtain residual blocks, thereby improving compression efficiency.

Benefits of technology

This method improves the compression efficiency in the inter prediction mode, especially when processing blocks with large residuals, and improves the encoding and decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121986485A_ABST
    Figure CN121986485A_ABST
Patent Text Reader

Abstract

The invention discloses a coding and decoding method, a code stream, a coder, a decoder and a storage medium. The method comprises the following steps: determining a texture feature index of a current block; determining a transformation kernel group of the current block according to the texture feature index; determining a transform kernel of the current block according to the transform kernel group; and determining a transformation coefficient of the current block, performing inverse transformation on the transformation coefficient of the current block according to the transformation core, and determining a residual block of the current block. Therefore, the compression efficiency of inter-frame prediction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, code stream, encoder, decoder and storage medium Technical Field

[0001] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to a coding and decoding method, a bit stream, an encoder, a decoder, and a storage medium. Background Art

[0002] As demand for video display quality increases, high-resolution video, such as HD and UHD, has emerged. However, high-resolution video typically contains more information and therefore requires more bandwidth. To reduce bandwidth requirements, video coding standards involving video compression have been introduced.

[0003] Video coding standards include intra-frame prediction and inter-frame prediction. Intra-frame prediction often cannot perfectly predict complex textures, resulting in a large residual error in intra-frame coded blocks. In inter-frame prediction, however, inter-frame coded blocks can usually find a better prediction block from the reference image, resulting in fewer residual errors. However, the transformation process of inter-frame prediction is not comprehensive, which is not conducive to processing texture features from various angles, resulting in low compression efficiency.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium, which can improve compression efficiency.

[0006] The technical solution of the embodiment of the present application can be implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:

[0008] Determine the texture feature index of the current block;

[0009] Determine the transformation kernel group of the current block according to the texture feature index;

[0010] Determine the transformation kernel of the current block according to the transformation kernel group;

[0011] A transform coefficient of the current block is determined, and the transform coefficient of the current block is inversely transformed according to the transform kernel to determine a residual block of the current block.

[0012] In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:

[0013] Determine the texture feature index of the current block;

[0014] Determine the transformation kernel group of the current block according to the texture feature index;

[0015] Determine the transformation kernel of the current block according to the transformation kernel group;

[0016] Determine a residual block of the current block, and transform the residual block of the current block according to the transformation kernel to determine a transformation coefficient of the current block;

[0017] The transform coefficients of the current block are coded and the resulting coded bits are written into the bitstream.

[0018] In a third aspect, an embodiment of the present application provides a code stream, wherein the code stream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: a quantization coefficient of a current block, a feature index number of the current block, a value of first syntax identification information, a value of second syntax identification information, a value of third syntax identification information, and a value of fourth syntax identification information;

[0019] Among them, the first syntax identification information is used to indicate whether the current block uses the first transform mode and the corresponding transform kernel index used, the second syntax identification information is used to indicate whether the current sequence allows the use of the first transform mode, the third syntax identification information is used to indicate whether the current image allows the use of the first transform mode; the fourth syntax identification information is used to indicate whether the current slice allows the use of the first transform mode.

[0020] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first determining unit, a transforming unit, and an encoding unit, wherein:

[0021] a first determining unit configured to determine a texture feature index of a current block; determine a transform kernel group of the current block according to the texture feature index; and determine a transform kernel of the current block according to the transform kernel group;

[0022] a transform unit configured to determine a residual block of a current block, and transform the residual block of the current block according to a transform kernel to determine a transform coefficient of the current block;

[0023] The encoding unit is configured to perform encoding processing on the transformation coefficients of the current block and write the obtained encoding bits into the bit stream.

[0024] In a fifth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor, wherein:

[0025] a first memory for storing a computer program capable of running on the first processor;

[0026] The first processor is configured to execute the method according to the second aspect when running the computer program.

[0027] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second determination unit and an inverse transformation unit, wherein:

[0028] A second determining unit is configured to determine a texture feature index of the current block; and determine a transform kernel group of the current block according to the texture feature index;

[0029] The second determining unit is further configured to determine a transform core of the current block according to the transform core group;

[0030] The inverse transform unit is configured to determine transform coefficients of the current block, and perform inverse transform on the transform coefficients of the current block according to the transform kernel to determine a residual block of the current block.

[0031] In a seventh aspect, an embodiment of the present application provides a decoder, comprising a second memory and a second processor, wherein:

[0032] a second memory for storing a computer program capable of running on the second processor;

[0033] The second processor is configured to execute the method according to the first aspect when running the computer program.

[0034] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by at least one processor, implements the method described in the first aspect or the method described in the second aspect.

[0035] The embodiments of the present application provide a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium. At the encoding end, the texture feature index of the current block is determined; based on the texture feature index, the transform core group of the current block is determined; based on the transform core group, the transform core of the current block is determined; the residual block of the current block is determined, and the residual block of the current block is transformed according to the transform core to determine the transform coefficient of the current block; the transform coefficient of the current block is encoded and the obtained coded bits are written into the code stream. At the decoding end, the texture feature index of the current block is determined; based on the texture feature index, the transform core group of the current block is determined; based on the transform core group, the transform core of the current block is determined; the transform coefficient of the current block is determined, and the transform coefficient of the current block is inversely transformed according to the transform core to determine the residual block of the current block. In this way, whether it is the encoding end or the decoding end, the texture feature index of the current block is first determined, and then the transform core group of the current block is determined according to the texture feature index, and then the transform core of the current block can be determined according to the transform core group. In other words, a correspondence between texture feature indexes and transform kernel groups is established here, which replaces the scheme of matching transform kernel groups according to intra-frame prediction modes in related technologies, so that LFNST and NSPT can also be applied to inter-frame prediction modes, thereby targeting blocks that are difficult to predict in inter-frame prediction modes, that is, blocks with large residuals, not only improving compression efficiency but also improving encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] FIG1 is a flow chart diagram of a hybrid coding framework;

[0037] FIG2 is a schematic diagram of the structure of a group of pictures GOP;

[0038] FIG3 is a schematic diagram of a block partition structure;

[0039] FIG4 is a schematic diagram of a block position relationship in the spatial domain / temporal domain of a current block;

[0040] FIG5 is a schematic diagram of motion information of a current block and a co-located block;

[0041] FIG6 is a schematic diagram of motion displacement using a co-located reference image;

[0042] FIG7 is a schematic diagram of a distribution using the MVD characteristic;

[0043] FIG8 is a schematic diagram of an affine motion using 2 or 3 control points;

[0044] FIG9 is a schematic diagram of affine motion based on derivation of motion vectors of sub-blocks;

[0045] FIG10 is a schematic diagram of weights of various modes under a GPM mode;

[0046] FIG11 is a schematic diagram of motion information for bilateral matching;

[0047] FIG12 is a schematic diagram of template matching of a current block;

[0048] FIG13 is a schematic diagram of reference pixels of a current block;

[0049] FIG14 is a schematic diagram of multiple reference rows of a current block;

[0050] FIG15 is a schematic diagram 1 of multiple prediction modes corresponding to an intra-frame prediction;

[0051] FIG16 is a second schematic diagram of multiple prediction modes corresponding to an intra-frame prediction;

[0052] FIG17 is a third schematic diagram of multiple prediction modes corresponding to an intra-frame prediction;

[0053] FIG18 is a fourth schematic diagram of multiple prediction modes corresponding to an intra-frame prediction;

[0054] FIG19 is a schematic diagram of encoding of screen content;

[0055] FIG20 is a schematic diagram of a histogram of gradient and intra prediction mode;

[0056] FIG21 is a schematic diagram of weighted fusion of three intra-frame prediction modes;

[0057] FIG22 is a schematic diagram of reference pixels of chrominance components and luminance components;

[0058] FIG23 is a schematic diagram of a grouping of a multi-model CCLM;

[0059] FIG24 is a schematic diagram of a multi-model CCLM prediction;

[0060] FIG25 is a schematic diagram of a reference area for intra-frame CCCM;

[0061] FIG26 is a schematic diagram of brightness gradient calculation of a GLM;

[0062] FIG27 is a schematic diagram of an inter-frame CCCM prediction;

[0063] FIG28 is a schematic diagram of a DCT transformation;

[0064] FIG29 is a schematic diagram of a base image of a DCT transformation;

[0065] FIG30 is a schematic diagram of a process flow without LFNST transformation;

[0066] FIG31 is a schematic diagram of a process flow with LFNST transformation;

[0067] FIG32 is a detailed flowchart of a LFNST transformation;

[0068] FIG33 is a schematic diagram of a base image of multiple transformation kernel groups;

[0069] FIG34 is a schematic diagram of a base image of NSPT transformation;

[0070] FIG35 is a schematic diagram of a structure in which brightness and chromaticity are divided separately;

[0071] FIG36 is a schematic diagram of a network architecture of a video codec provided in an embodiment of the present application;

[0072] FIG37 is a schematic block diagram of a system composition of an encoder provided in an embodiment of the present application;

[0073] FIG38 is a schematic block diagram of a system composition of a decoder provided in an embodiment of the present application;

[0074] FIG39 is a flowchart diagram 1 of a decoding method provided in an embodiment of the present application;

[0075] FIG40 is a schematic diagram of the dividing lines of a GPM mode;

[0076] FIG41 is a second flow chart of a decoding method provided in an embodiment of the present application;

[0077] FIG42 is a third flow chart of a decoding method provided in an embodiment of the present application;

[0078] FIG43 is a flowchart diagram 1 of an encoding method provided in an embodiment of the present application;

[0079] FIG44 is a second flow chart of an encoding method provided in an embodiment of the present application;

[0080] FIG45 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;

[0081] FIG46 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of the present application;

[0082] FIG47 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;

[0083] FIG48 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of the present application;

[0084] Figure 49 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0086] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0087] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be 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.

[0088] It should also be pointed out that the terms "first\second\third" involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0089] In video images, a coding block (CB) is generally represented by a first color component, a second color component, and a third color component. These three color components are a luminance component, a blue chrominance component, and a red chrominance component. Specifically, the luminance component is typically represented by the symbol Y, the blue chrominance component is typically represented by the symbols Cb or U, and the red chrominance component is typically represented by the symbols Cr or V. Thus, video images can be represented in either the YCbCr or YUV format.

[0090] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:

[0091] H.265 / High Efficiency Video Coding (HEVC);

[0092] H.266 / Versatile Video Coding (VVC);

[0093] VVC Test Model (VTM), a reference software testing platform for VVC;

[0094] A platform that improves compression performance after VVC (Enhanced Compression Model, ECM);

[0095] Joint Video Experts Team (JVET);

[0096] Coding Unit (CU);

[0097] Coding Tree Unit (CTU);

[0098] Largest Coding Unit (LCU);

[0099] Motion Vector (MV);

[0100] Prediction Unit (PU);

[0101] Transform Unit (TU);

[0102] Fusion technology (Merge);

[0103] Skip technology (Skip);

[0104] Quantization Parameter (QP);

[0105] Merge with Motion Vector Difference (MMVD)

[0106] Motion Vector Prediction (MVP);

[0107] Temporal Motion Vector Prediction (TMVP);

[0108] Subblock-based Temporal Motion Vector Prediction (SbTMVP);

[0109] Discrete Cosine Transform (DCT);

[0110] Discrete Sine Transform (DST);

[0111] Multiple Transform Selection (MTS);

[0112] Low Frequency Non-Separable Transform (LFNST);

[0113] Non-Separable Primary Transform (NSPT);

[0114] Context-based Adaptive Binary Arithmetic Coding (CABAC).

[0115] Currently, common video codec standards all adopt a block-based hybrid coding framework. Each image, sub-image, or frame in a video is divided into square maximum coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 256×256, 128×128, 64×64, etc.). Each LCU or CTU can be divided into rectangular CUs according to a set of rules. Coding units may also be divided into prediction units (PUs) and transform units (TUs). Specifically, as shown in Figure 1, the hybrid coding framework includes modules such as prediction, transform / quantization, entropy coding, inverse quantization / inverse transform, and in-loop filtering. The prediction module can include intra-frame prediction and inter-frame prediction, and inter-frame prediction can include motion estimation and motion compensation. Because adjacent pixels within a video image are highly correlated, intra-frame prediction is used in video coding and decoding to eliminate spatial redundancy between adjacent pixels. Furthermore, because adjacent images in a video image have strong similarities, inter-image prediction is used in video coding and decoding to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.

[0116] The basic process of a video codec is as follows: On the encoder side, an image is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block for the current block. The prediction block is subtracted from the original block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​entropy-encoded and output to the bitstream. On the decoder side, intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block for the current block. The bitstream is then parsed to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​inversely quantized and inversely transformed to obtain a residual block. The prediction block and residual block are added together to obtain a reconstructed block. The reconstructed blocks form a reconstructed image, which is then subjected to image-based or block-based loop filtering to obtain a decoded image. The encoder side also performs similar operations as the decoder side to obtain a decoded image. The decoded image can serve as a reference image for inter-frame prediction of subsequent images. Block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined by the encoder are output to the bitstream if necessary. The decoding end determines the same block division information as the encoding end by parsing the bit stream and analyzing the existing information, as well as the mode information or parameter information such as prediction, transformation, quantization, entropy coding, and loop filtering, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is also usually called a reconstructed image. The current block can be divided into prediction units during prediction, and the current block can be divided into transformation units during transformation. The division of prediction units and transformation units can be different. The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. The embodiment of the present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0117] In addition, in the embodiments of the present application, the current block (CB) can be the current coding unit, the current prediction unit, or the current transform unit. Due to the need for parallel processing, the image can be divided into slices, etc. Slices in the same image can be processed in parallel, that is, there is no data dependency between them. "Frame" is a commonly used term, and it can generally be understood that a frame is an image. The frame described in the embodiments of the present application can also be replaced by an image or a slice, etc.

[0118] It can be understood that in the prediction technology, intra-frame prediction and inter-frame prediction are described in detail below respectively.

[0119] (1) Inter-frame prediction.

[0120] Inter-frame prediction uses temporal correlation to eliminate redundancy. To minimize visual lag, typical video frame rates range from 30, 50, 60, or even 120 frames per second. In such videos, adjacent frames within the same scene are highly correlated. Inter-frame prediction leverages this correlation to predict the current encoding content, referencing the content of previously encoded and decoded frames. Inter-frame prediction can significantly improve encoding performance.

[0121] The most basic inter-frame prediction method is translational prediction. Translational prediction assumes that the content being predicted translates between the current image and the reference image. For example, if the content of the current block (coding unit or prediction unit) translates between the current image and the reference image, a motion vector can be used to find this content in the reference image and use it as the prediction block for the current block. Translational motion is a significant feature of video, and can be used to handle static backgrounds, moving objects, and camera movements.

[0122] Some content in natural videos doesn't simply translate; for example, the translation process involves subtle changes in shape and color. Bidirectional prediction uses two reference blocks from a reference image and performs a weighted average of these blocks to produce a predicted block that is as similar as possible to the current block. For example, in certain scenes, a weighted average of two reference blocks from before and after the current frame may produce a prediction that is more similar to the current block than a single reference block. This improves compression performance over unidirectional prediction.

[0123] The picture playback order (Picture Order Count, POC) can be used as an identifier of the image. In a video sequence, each image has a unique POC. In the embodiment of the present application, it is considered that the order of the POC and the playback order are the same. The P picture (P Frame) is an image that can only be predicted using the reference image whose POC is before the current image. The current reference image has only one reference picture list (Reference Picture List, RPL), denoted as RPL0. The reference picture list RPL0 contains all reference images whose POC is before the current image. The B picture (B Frame) is an image that can be predicted using the reference image whose POC is before the current image and the reference image whose POC is after the current image. The B picture has two reference picture lists, denoted as RPL0 and RPL1. One configuration method is that RPL0 contains all reference images whose POC is before the current image, and RPL1 contains all reference images whose POC is after the current image. For a current block, one can reference only the reference block of a certain image in RPL0 (also known as forward prediction); only the reference block of a certain image in RPL1 (also known as backward prediction); or simultaneously reference the reference block of a certain image in RPL0 and a reference block of a certain image in RPL1 (also known as bidirectional prediction). A simple method for simultaneously referencing two reference blocks is to average the pixels at each corresponding position in the two reference blocks to obtain the prediction block for the current block. Later, B-pictures no longer require that RPL0 only contain reference images with a Point of Occurrence (POC) before the current image, and RPL1 only contain reference images with a Point of Occurrence (POC) after the current image. Therefore, RPL0 can also contain reference images with a Point of Occurrence (POC) after the current image, and RPL1 can also contain reference images with a Point of Occurrence (POC) before the current image. The current block can then reference both reference images with a Point of Occurrence (POC) before the current image and reference images with a Point of Occurrence (POC) after the current image. This type of B-picture is also called a generalized B-picture.

[0124] Because the encoding and decoding order of the random access (RA) configuration is different from the POC order, B pictures can reference information before and after the current picture, significantly improving encoding performance. For example, a classic RA group of pictures (GOP) structure is shown in Figure 2. In Figure 2, arrows represent reference relationships. Since I pictures do not require reference pictures, after an I picture with a POC of 0 is decoded, a P picture with a POC of 4 will be decoded. When decoding a P picture with a POC of 4, the I picture with a POC of 0 can be referenced. After decoding a P picture with a POC of 4, a B picture with a POC of 2 is decoded. When decoding a B picture with a POC of 2, the I picture with a POC of 0 and the P picture with a POC of 4 can be referenced, and so on. Thus, according to Figure 2, when the POC order is {0 1 2 3 4 5 6 7 8}, the corresponding decoding order is {0 3 2 4 1 7 6 8 5}.

[0125] The encoding and decoding order of the Low Delay (LD) configuration is the same as the POC order. Therefore, the current image can only reference information before the current image. The Low Delay configuration is divided into Low Delay P and Low Delay B. Low Delay P is the traditional Low Delay configuration. Its typical structure is IPPP..., that is, an I picture is encoded and decoded first, and subsequent pictures are all P pictures. The typical structure of Low Delay B is IBBB..., which differs from Low Delay P in that each inter-frame picture is a B picture, that is, using two reference picture lists, the current block can simultaneously reference the reference block of a picture in RPL0 and the reference block of a picture in RPL1.

[0126] Generally speaking, the RA configuration has higher compression efficiency than the LD configuration, and the LDB configuration has higher compression efficiency than the LDP configuration. This is partly because bidirectional prediction can refer to backward information and partly because bidirectional prediction can reduce prediction errors through techniques such as weighted averaging.

[0127] A reference image list of the current image can have a maximum of several reference images, such as 2, 3 or 4. When encoding a current image, which reference images are in RPL0 and RPL1 is determined by a certain configuration or algorithm, which is not the focus of the embodiments of this application. However, the same reference image may appear in RPL0 and RPL1 at the same time. That is, the codec allows the current block to refer to two reference blocks of the same reference image at the same time. The codec usually uses the index value (index, idx) in the reference image list to correspond to the reference image. If the length of a reference image list is 4, the index has four values ​​0, 1, 2, and 3. For example, if the RPL0 of the current image has 4 reference images with POCs of 5, 4, 3, and 0. Then index 0 of RPL0 is the reference image with POC 5, index 1 of RPL0 is the reference image with POC 4, index 2 of RPL0 is the reference image with POC 3, and index 3 of RPL0 is the reference image with POC 0.

[0128] It can also be understood that inter-frame prediction uses motion information to represent "motion". Basic motion information includes reference picture information and motion vector (MV) information. In order for a block to use bidirectional prediction, it is naturally necessary to find two reference blocks, so two sets of reference image information and motion vector information are needed. Each of these sets can be understood as a unidirectional motion information, and combining these two sets together forms a bidirectional motion information. In specific implementation, unidirectional motion information and bidirectional motion information can use the same data structure, but the two sets of reference frame information and motion vector information of the bidirectional motion information are both valid, while one set of reference frame information and motion vector information of the unidirectional motion information is invalid. The valid can also be said to be "used", and the invalid can also be said to be "not used".

[0129] VVC supports two reference picture lists, denoted as RPL0 and RPL1. For the above-mentioned bidirectional motion information, VVC uses the reference picture index refIdxL0 corresponding to RPL0, the motion vector mvL0 corresponding to RPL0, the reference picture index refIdxL1 corresponding to RPL1, and the motion vector mvL1 corresponding to RPL1. The reference picture index corresponding to RPL0 and the reference picture index corresponding to RPL1 here can be understood as the above-mentioned reference picture information. VVC uses two identification information to indicate whether to use the motion information corresponding to RPL0 and whether to use the motion information corresponding to RPL1, respectively denoted as predFlagL0 and predFlagL1. It can also be understood that predFlagL0 and predFlagL1 indicate whether the above-mentioned unidirectional motion information is "valid". Therefore, although VVC does not explicitly mention the data structure of motion information, it uses the reference picture index, motion vector and "valid" flag corresponding to each reference picture list to represent the motion information. The VVC standard doesn't mention motion information, but instead uses motion vectors. The reference image index and the flag indicating whether to use the corresponding motion information can be considered appendages of the motion vector. For ease of description, this document still uses "motion information," but it should be understood that "motion vectors" can also be used. "Motion information" can also be called "motion parameters."

[0130] For a two-dimensional image, a motion vector can be represented by (x, y), with a horizontal component and a vertical component. Since videos are represented in pixels, there are distances between pixels. The motion of an object in adjacent images may not always correspond to a whole-pixel distance. For example, in a distant video, the distance between two pixels is 1 meter for the distant object, while the object moves 0.5 meters between two frames. This scenario cannot be well represented using a whole-pixel motion vector. Therefore, motion vectors can be expressed at the sub-pixel level, with precision of 1 / 2, 1 / 4, 1 / 8, or 1 / 16 pixels, to represent motion more precisely. Interpolation is then used to obtain the pixel value at the sub-pixel position in the reference image.

[0131] Both the unidirectional and bidirectional predictions in the aforementioned translation prediction are block-based, such as coding units (CUs) or prediction units (PUs). This means that prediction is performed using a pixel matrix as the unit. The most basic block is a rectangular block, such as a square or rectangle. Video codec standards such as HEVC and VVC allow the encoder to determine the size and division of CUs and PUs based on the video content. Regions with simple textures or motion tend to use larger blocks, while regions with complex textures or motion tend to use smaller blocks. The deeper the block division level, the more complex the blocks that more closely resemble the actual texture or motion, but the corresponding overhead for representing these divisions increases. Motion information may also need to be transmitted in the bitstream. Furthermore, generally, the finer the block division, the greater the motion information overhead.

[0132] The most primitive method of representing motion information directly writes the complete motion information. Later, experts discovered that motion vectors can be represented using motion vector prediction (MVP) plus motion vector difference (MVD), i.e., MV = MVP + MVD. The more accurate the MVP, the smaller the MVD, which in turn reduces the bitstream overhead.

[0133] It's also understandable that for merge mode, each inter-coded block requires motion information. To simplify matters, we assume that CU division equals PU division equals TU division, meaning that each coding unit has a prediction unit (PU) and a transform unit (TU) of the same size and position. In reality, with the increased flexibility of CU division, VVC tends to decouple PU and TU division from HEVC. Differences in any of the steps involved in prediction, transform, quantization, and entropy coding can lead to CU division. For example, if two regions have different motion information, the encoder may divide them into different CUs. Alternatively, if two regions have identical or similar motion information but significantly different residual characteristics, the encoder may also divide them into different CUs. The division method is determined based on overall compression efficiency, not solely on a single factor. Consequently, the same object or regions with identical or similar motion may be divided into different CUs.

[0134] Figure 3 is a schematic diagram of the HEVC block division structure. As shown in Figure 3, (a) is the original image. In (a), there is an iron rod moving in the direction indicated by the arrow, and the background area moves less. (b) is the block division of HEVC, and (c) is the block boundary with the same motion information in (b) removed. It can be seen that many adjacent blocks use the same motion information. In this case, if the motion information is encoded separately for each block, it will result in obvious waste. The complete motion information of VVC mentioned above includes the reference image index, MV and the flag of whether it is used for RPL0, and the reference image index, MV and the flag of whether it is used for RPL1. The basic principle of the merge mode is that the current block can inherit the motion information of the adjacent blocks, including the reference image information and motion vector information.

[0135] Merge mode can build a merge candidate list. If the current block uses merge mode, an index can be used to indicate which motion information to merge with the current block, eliminating the need to encode the complete motion information. When building the merge candidate list, you can include motion information of spatially adjacent blocks of the current block, motion information in the temporal domain, motion information of non-adjacent blocks in the spatial domain, motion information of non-adjacent blocks in the temporal domain, motion information based on historical information, and synthesized motion information.

[0136] The spatially adjacent blocks refer to blocks adjacent to the current block in the same image, and the spatially non-adjacent blocks refer to blocks non-adjacent to the current block in the same image. The temporal motion information and the motion information of temporally non-adjacent blocks refer to the motion information at a specified position in the collocated reference image. For example, as shown in FIG4 , the black-filled block is the current block, where positions 1, 2, 3, 4, and 5 are the positions of spatially adjacent blocks used for merging, and the corresponding positions of the other dot-filled blocks are the positions of spatially non-adjacent blocks used for merging. Position 6 is the position used for temporal motion information. If the corresponding position at the lower right corner of the current block is unavailable, the position corresponding to the center of the current block is used. The corresponding positions of the other grid-filled blocks are the positions used for motion information of temporally non-adjacent blocks. Temporal motion information is derived based on the motion information at the corresponding positions in the collocated reference image. The specific derivation method is described below. It should be noted that the background grid in FIG4 is only a schematic representation of pixel coordinates and does not represent a specific block division.

[0137] Historical motion information is independent of position. The codec maintains a first-in, first-out list of motion information. Each time a block is encoded or decoded, the codec updates the list with the motion information of that block, ensuring that there is no duplication with existing motion information in the list. Historical motion information is obtained from this list.

[0138] It can also be understood that for the derivation of temporal motion information (vector), temporal motion information prediction is used as a supplement to spatial motion information prediction. Generally speaking, the correlation between adjacent regions in the same image is stronger than the correlation between regions in different images. However, there are also cases where temporal motion information is more useful. For example, if the current block and the surrounding adjacent blocks in the current image belong to different objects and have completely different motions, the motion of the block belonging to the same object as the current block in a reference image can provide better motion information prediction for the current block.

[0139] The motion vector of the co-located block on the co-located reference image (here, the block that obtains temporal motion information is called the co-located block) is the vector between the co-located reference image col_pic and the reference image col_ref of the co-located block. Specifically, as shown in Figure 5, for the current block, the motion vector it needs is the vector between the current image curr_pic and the reference image curr_ref of the current block. Let the POC distance between col_pic and col_ref be td, and the POC distance between curr_pic and curr_ref be tb. Assuming that the motion on the co-located block is unchanged to the motion on the current block, the scaling ratio can be determined based on td and tb. If the motion vector of the co-located block is (col_mv_x, col_mv_y), the temporal motion vector prediction (tmvp_x, tmvp_y) can be derived as follows: tmvp_x = col_mv_x*tb / td, tmvp_y = col_mv_y*tb / td.

[0140] In VVC, the smallest unit for storing motion information in a co-located reference image is 4×4. That is, each 4×4 sub-block stores a set of motion information. It's understandable that, if hardware implementation costs are not considered, a co-located reference image can also store a set of motion information per pixel.

[0141] It's also understandable that VVC introduces sub-block-based temporal motion vector prediction, or SbTMVP. Conventionally, MVP and TMVP are applied to the entire block, meaning the entire block shares the same MVP. However, SbTMVP is based on sub-blocks, allowing it to generate a unique MVP for each sub-block. This is the fundamental difference between SbTMVP and TMVP.

[0142] On the other hand, TMVP uses the position of the lower right corner of the current block or the position of the current block center to locate the co-located block, while SbTMVP finds a motion offset based on the motion of the surrounding blocks to determine the position. In VVC, if the block at position A1 refers to the co-located reference image, then the motion offset is set to the motion vector of A1 using the co-located reference image. Otherwise, the motion offset is set to (0, 0). As shown in Figure 6, the position is found according to the motion offset, and then the MV corresponding to the position of each sub-block in the "co-located block" is scaled to obtain the MVP of each sub-block.

[0143] It can also be understood that for the fusion technology using motion vector difference, namely MMVD, the motion information in the merge candidate list directly selected by the Merge mode is used as the motion information of the current block. In actual videos, there may sometimes be some differences between the actual motion vector of the current block and the motion vector in the selected merge candidate list. MMVD is a special merge mode in VVC, which uses an efficient method to encode the MVD in this case. Ordinary Merge does not require encoding and decoding of MVD. Ordinary inter mode requires direct encoding and decoding of MVD. MMVD takes advantage of the fact that MVD is more distributed in a single horizontal direction or a single vertical direction, with more MVDs for smaller values ​​and fewer MVDs for larger values, as shown in Figure 7. In Figure 7, circles of different shapes can represent MVDs of different values.

[0144] MMVD can only represent MVDs of specific values ​​in specific directions, and it cannot represent any MVD. It uses mmvd_direction_idx to represent the direction of the MVD, which can also be understood as whether the x and y values ​​of the MVD are non-zero and their positive and negative signs. mmvd_distance_idx represents the absolute value of the non-zero x and y values ​​of the MVD, MmvdDistance.

[0145] Here, Table 1 shows a schematic relationship between mmvd_distance_idx[x0][y0] and MmvdDistance[x0][y0].

[0146] Table 1

[0147] Among them, ph_mmvd_fullpel_only_flag is an image header flag that can set two different combinations of MMVD.

[0148] Here, Table 2 shows a schematic relationship between mmvd_direction_idx[x0][y0] and MmvdSign[x0][y0].

[0149] Table 2

[0150] Among them, the MVD of MMVD is obtained as follows: MmvdOffset[x0][y0][0] = (MmvdDistance[x0][y0] << 2) * MmvdSign[x0][y0][0]; MmvdOffset[x0][y0][1] = (MmvdDistance[x0][y0] << 2) * MmvdSign[x0][y0][1].

[0151] It can also be understood that for affine Affine, the simplest and most commonly used translation motion was introduced above. In the real world, there are not only translations, but also many forms of motion such as reduction, enlargement, rotation, perspective (perspective: objects close to the lens appear large, objects far from the lens appear small), and many irregular forms of motion. Affine can be used to represent more complex motion than translation. As shown in Figure 8, Affine uses a linear model to calculate the motion vector of each sub-block or each pixel in the current block based on the motion vectors of 2 control points (4 parameters, a motion vector includes two parameters x and y) or 3 control points (6 parameters). Among them, (a) provides the case of 2 control points, such as v0 and v1; (b) provides the case of 3 control points, such as v0, v1, and v2.

[0152] For the 4-parameter affine model, the motion vector at the (x, y) position in the current block is derived as follows:

[0153] For the 6-parameter affine model, the motion vector at the (x, y) position in the current block is derived as follows:

[0154] Among them, (mv 0x ,mv 0y ) is the motion vector of the control point at the upper left corner of the current block, (mv 1x ,mv 1y ) is the motion vector of the control point in the upper right corner of the current block, (mv 2x ,mv 2y ) is the motion vector of the control point at the lower left corner of the current block.

[0155] To simplify hardware implementation complexity, Affine, used in VVC, divides the current block into 4×4 sub-blocks, calculates an MV for each sub-block, and performs motion compensation. Figure 9 is a schematic diagram of how Affine derives motion vectors based on sub-blocks. It is understandable that with the improvement of hardware processing capabilities, Affine can also perform pixel-based processing. That is, a motion vector is derived for each pixel, and motion compensation is performed on the pixel based on this motion vector. Here, Affine only needs a few control points to derive a separate motion vector for each sub-block or each pixel, allowing for more precise predictions compared to whole-block motion compensation. Furthermore, compared to dividing the CU into smaller units, Affine has much less overhead.

[0156] It can also be understood that for the Geometric Partitioning Mode (GPM), HEVC supports a maximum CTU of 64×64 and can recursively perform quadtree division. VVC supports a more flexible block division method than HEVC, supporting a maximum CTU of 128×128, including quadtree, ternary tree and binary tree division. These division methods. Although block division is becoming more and more flexible, whether it is CU, PU or TU, it can only be divided into rectangular blocks. It should be noted that VVC has weakened the division of PU and TU. The boundaries of texture or motion in natural videos are diverse. For example, when encountering an oblique object boundary, if you simply use rectangular blocks to approach the boundary, you will divide it into many small blocks, which will significantly increase the overhead. The GPM geometric division mode can better handle textures and boundaries in natural videos.

[0157] GPM uses two prediction blocks of the same size as the current block. Some pixel locations in the GPM prediction block use 100% of the pixel values ​​corresponding to the first prediction block, while others use 100% of the pixel values ​​corresponding to the second prediction block. In the boundary region, or transition region, pixel values ​​from both prediction blocks are used in a certain proportion. The weights in the boundary region also gradually transition. Of course, for scenarios such as screen content encoding, the transition region can be omitted. The specific distribution of these weights is determined by the GPM's "partitioning" mode. The weight of each pixel position is determined based on the GPM's partitioning mode. However, in certain situations, such as very small block sizes, some GPM modes may not guarantee that some pixel locations will use 100% of the pixel values ​​corresponding to the first prediction block, while others will use 100% of the pixel values ​​corresponding to the second prediction block. Alternatively, GPM can be considered to use two prediction blocks of different block sizes, taking the required portion from each and discarding any portions with zero weights.

[0158] Figure 10 shows the weights of the 64 GPM modes in VVC on a square block. As shown in Figure 10, black indicates a weight of 0% for the position corresponding to the first prediction block, white indicates a weight of 100%, and gray areas, depending on the depth of the color, indicate a weight greater than 0% and less than 100% for the position corresponding to the first prediction block. The weight of the position corresponding to the second reference block is 100% minus the weight of the position corresponding to the first reference block.

[0159] GPM can be considered a prediction mode or method, as it ultimately produces a prediction block. It can also be considered a "partitioning" mode, simulating a partitioning of the prediction block, similar to implementing PU partitioning without actually partitioning the prediction block. The first and second prediction blocks used in GPM can be prediction blocks generated by intra-frame prediction, inter-frame unidirectional prediction, or inter-frame bidirectional prediction.

[0160] Understandably, the bitrate of general consumer video is limited, so video compression typically seeks a compromise between bitrate overhead and distortion. Taking block partitioning as an example, for the same content, within a certain range, finer the partitioning, the higher the overhead and lower the distortion; coarser the partitioning, the lower the overhead and higher the distortion. Taking motion information encoding as an example, for the same content, within a certain range, more precise motion information leads to higher overhead and lower distortion; coarser motion information leads to lower overhead and higher distortion. Some decoder-side methods utilize decoder-side information for processing and calculation without incurring overhead, thereby improving motion information, enhancing prediction, and reducing distortion. This overhead-free approach means that the encoder does not require instructions based on the original image; processing is performed automatically based on available information. Two typical decoder-side methods in VVC are decoder-side motion vector refinement (DMVR) and bidirectional optical flow (BDOF), which are described in detail below.

[0161] In one possible implementation, for DMVR, one condition for starting DMVR in VVC is that the two reference images of the current block come from the front and back of the current image respectively, and the distances between the two reference images and the current image are equal. Another starting condition is that the current CU uses the whole-block merge mode (including skip), which does not include sub-block-based merges such as SbTMVP and affine merge, because the motion vector in the merge mode is prone to inaccuracy. There are some other conditions that are not described here. DMVR in VVC uses bilateral matching (BM), which is to calculate the matching cost for the reference blocks on both sides, such as the sum of absolute differences (SAD). DMVR searches for the matching cost of the MVs around the original MV. When moving, the MVs of the two reference images are moved in a mirrored manner, that is, the MVs are moved on the basis of their respective original MVs. diff , move the other side - MV diff , as shown in Figure 11. In Figure 11, the two reference images include reference image L0 (refPic in ListL0) and reference image L1 (refPic in ListL1). The search also supports sub-pixel search, so DMVR may find an MV with higher accuracy than the original MV. The search is performed according to certain rules. Generally, the integer pixel MV within a certain range is searched first to find the integer pixel MV with the lowest matching cost, and then the sub-pixel MV is searched based on the integer pixel MV. If an MV with a lower matching cost than the original MV is found, the MV with the lower matching cost is used for motion compensation prediction. The MV improved by DMVR can theoretically be used to store MVs and surrounding blocks. For example, when constructing a merge candidate list for the current block, if the MV of the surrounding blocks is improved by DMVR, using the improved MV to construct the merge candidate list can achieve better compression effect. However, due to hardware implementation considerations, VVC does not do this.

[0162] DMVR can be processed on a sub-block basis. In fact, in VVC, if the horizontal or vertical size of a block is larger than 16 pixels, it will be divided into sub-blocks of 16 pixels. This is partly due to the complexity of hardware implementation, because DMVR needs to be searched at the decoding end, and limiting the size of sub-blocks can reduce the cost of caching. On the other hand, dividing the processing into sub-blocks provides better flexibility. Each sub-block can independently improve the MV, which to a certain extent achieves the effect of improving the division accuracy, which also improves the compression efficiency.

[0163] In another possible implementation, BDOF is also a typical decoder-side method. As its name suggests, BDOF improves MV and prediction based on the principle of optical flow. Optical flow is the instantaneous velocity of pixels moving across the observation imaging plane for a moving object. Optical flow has some basic assumptions, such as constant brightness (i.e., the brightness of the same object does not change when it moves between different images), and temporal continuity or small motion. This means that changes in time do not cause drastic changes in the object's position.

[0164] A condition for starting BDOF in VVC is that the two reference images of the current block come from the previous and next images respectively, and the distance between the two reference images and the current image is equal. For each 4×4 sub-block, VVC will derive a motion vector deviation (v x ,v y ), which is calculated by minimizing the difference between the predicted values ​​in the two directions. This motion vector deviation is also used to adjust the predicted value in the corresponding sub-block. The derivation process is as follows:

[0165] First, calculate the horizontal and vertical gradients of the two prediction blocks and k=0,1; the details are as follows:

[0166] Among them, I (k) (i, j) is the predicted value of the coordinate (i, j) in the reference image list k, k = 0, 1, and shift1 is calculated according to the bit depth bitDepth of the brightness, shift1 = max(6, bitDepth-6).

[0167] Next, calculate S1, S2, S3, S5, and S6 as follows:

[0168] S1=∑ (i,j)∈Ω Abs(ψ x (i,j)) (5)

[0169] S2=∑ (i,j)∈Ω ψ x (i,j)·Sign(ψ y (i,j)) (6)

[0170] S3=∑ (i,j)∈Ω θ(i,j)·Sign(ψ x (i,j)) (7)

[0171] S5=∑ (i,j)∈Ω Abs(ψ y (i,j)) (8)

[0172] S6=∑ (i,j)∈Ω θ(i,j)·Sign(ψ y (i,j)) (9)

[0173] in, θ(i,j)=(I (1) (i,j)>>n b )-(I (0) (i,j)>>nb) (12)

[0174] Where Ω is a 6×6 window around the current 4×4 sub-block, n a is min(1,bitDepth-11), n b is min(4,bitDepth-8).

[0175] Again, the motion vector deviation (v x ,v y ) is calculated as follows:

[0176] in, th′ BIO =2max(5,BD-7), is rounded down, BD is the bit depth bitDepth.

[0177] Again, based on the motion vector deviation and gradient, each prediction value within the 4×4 sub-block is adjusted as follows:

[0178] The final predicted value of BDOF is calculated as follows: pred BDOF (x,y)=(I (0) (x,y)+I (1) (x,y)+b(x,y)+o offset )>>shift (16)

[0179] Among them, offset and shift are calculated based on the bit depth of brightness. a 、n bBoth scalar and shift are processed to reduce the bit width during the calculation process.

[0180] In this way, the motion vector deviation of BDOF can achieve high precision, making the prediction more accurate, and the sub-block-based processing also improves flexibility. These two aspects are similar to DMVR.

[0181] It's also understood that both DMVR and BDOF improve motion vectors. DMVR is based on block matching, while BDOF is based on optical flow. They can be used in combination. For example, this can be referred to as Multi-pass Decoder-side Motion Vector Refinement (MDMVR).

[0182] The first step is to improve the motion vector based on bidirectional matching of the entire block. The second step is to improve the motion vector based on bidirectional matching of sub-blocks. The block size for this step can be 16×16. The third step is to improve the motion vector based on bidirectional optical flow of sub-blocks. The sub-block size for this step can be 8×8. Further steps can be added to this system, such as a fourth step to improve the motion vector based on bidirectional optical flow of 4×4 sub-blocks, or a point-based bidirectional optical flow improvement.

[0183] It's also understandable that the Template Matching (TM) method was first used in inter-frame prediction. It leverages the correlation between adjacent pixels and uses areas surrounding the current block as templates. When the current block is encoded or decoded, its left and upper sides have already been encoded and decoded according to the coding order. Of course, existing hardware decoder implementations don't guarantee that the left and upper sides have already been decoded when decoding begins. This refers to inter-frame blocks. For example, in HEVC, when generating prediction blocks for inter-frame coded blocks, the surrounding reconstructed pixels are not required, allowing the prediction process for inter-frame blocks to proceed in parallel. However, intra-frame coded blocks must use reconstructed pixels on the left and upper sides as reference pixels. Theoretically, the left and upper sides are available, meaning that this can be achieved by adjusting the hardware design accordingly. Comparatively, the right and lower sides are unavailable under current coding standards such as VVC.

[0184] As shown in Figure 12, the rectangular areas to the left and above the current block are used as templates. The height of the left template portion is generally the same as the height of the current block, and the width of the upper template portion is generally the same as the width of the current block, but they can also be different. The best matching position of the template is found in the reference image L0 to determine the motion information, or motion vector, of the current block. This process can be roughly described as starting from a starting position in a reference image and searching within a certain range around it. Search rules, such as the search range and search step size, can be predefined. At each position, the degree of match between the template corresponding to that position and the templates surrounding the current block is calculated. The degree of match can be measured using distortion metrics such as the sum of absolute differences (SAD), the sum of absolute transformed differences (SATD), and the mean-square error (MSE). SATD generally uses the Hadamard transform. Smaller values ​​of SAD, SATD, and MSE indicate a higher degree of match. The cost is calculated using the predicted block of the template corresponding to the position and the reconstructed blocks of the template surrounding the current block. In addition to searching at whole-pixel locations, sub-pixel locations can also be searched, with the motion information of the current block determined based on the location with the highest degree of match. By leveraging the correlation between adjacent pixels, the appropriate motion information for the template may also be appropriate for the current block. Of course, template matching may not be applicable to all blocks, so methods can be used to determine whether template matching should be used for the current block, such as using a control switch to indicate whether template matching should be used for the current block. This template matching method is called decoder-side motion vector derivation (DMVD). Both the encoder and decoder can use the template to search to derive motion information or find better motion information based on the existing motion information. This method does not require the transmission of specific motion vectors or motion vector differences. Instead, both the encoder and decoder perform the same search rules to ensure consistent encoding and decoding. Template matching can improve compression performance, but it requires a "search" at the decoder, which introduces a certain degree of decoding complexity.

[0185] (2) Intra-frame prediction.

[0186] There is a strong spatial correlation between adjacent parts or adjacent pixels within the image. Intra-frame prediction is a prediction method that uses the spatial correlation between the coded and decoded pixels around the current block and the pixels within the current block. For example, as shown in Figure 13, the 4×4 white filling pixels are the current block, and the grid filling pixels in the left column and the upper row of the current block are the reference pixels of the current block. Intra-frame prediction uses these reference pixels to predict the current block. These reference pixels may all be available, that is, all have been coded and decoded. Some may also be unavailable. For example, if the current block is the leftmost of the entire frame, then the reference pixels on the left side of the current block are unavailable. Or when encoding and decoding the current block, the lower left part of the current block has not been encoded and decoded, then the reference pixels on the lower left are also unavailable. For the case where reference pixels are unavailable, available reference pixels or certain values ​​or certain methods can be used for filling, or no filling can be performed.

[0187] It should also be noted that the multiple reference line (MRL) intra prediction method can use more reference pixels to improve coding efficiency. As shown in Figure 14, this is a schematic diagram using four reference rows / columns.

[0188] There are multiple prediction modes for intra-frame prediction, as shown in Figure 15. Here are the nine modes for intra-frame prediction of 4×4 blocks in H.264. Among them, mode 0 (vertical mode) copies the pixels above the current block vertically to the current block as the prediction value, mode 1 (horizontal mode) copies the reference pixels on the left side horizontally to the current block as the prediction value, mode 2 (DC mode) uses the average of the eight points A to D and I to L as the prediction value for all points, and modes 3 to 8 copy the reference pixels to the corresponding positions of the current block at a certain angle. Because some positions of the current block cannot correspond exactly to the reference pixels, it may be necessary to use the weighted average of the reference pixels, or the interpolated sub-pixels of the reference pixels.

[0189] In addition, there are modes such as PLANE and PLANAR. With technological advancements and the expansion of block sizes, the number of angular prediction modes is also increasing. For example, HEVC uses intra-frame prediction modes including PLANAR, DC, and 33 angular modes, for a total of 35 prediction modes (see Figure 16 for details). VVC uses intra-frame modes including PLANAR, DC, and 65 angular modes, for a total of 67 prediction modes (see Figure 17 for details). Of course, in addition to the 67 modes mentioned above, VVC also provides wide-angle modes for rectangular blocks with a large difference between length and width. These modes, indicated by the dashed lines in the figure, represent the ranges -14 to -1 and 67 to 80 degrees. These modes replace some conventional modes (see Figure 18 for details).

[0190] It can also be understood that intra block copy (IBC) can significantly improve the compression efficiency of screen content coding (SCC), and therefore IBC has been used for screen content coding from HEVC to VVC. Screen content is different from camera-captured content. It is computer-generated, noise-free, and contains text, computer graphics, and has clear boundaries. There is a large amount of repeated content in the screen content, as shown in Figure 19.

[0191] In the embodiments of this application, IBC can be considered to apply the inter-frame prediction method to intra-frame prediction. Inter-frame prediction uses a reference block in a reference image, which is not the current image, to generate the prediction block for the current block. IBC, on the other hand, uses a reference block from the coded or reconstructed portion of the current image to generate the prediction block for the current block. IBC is also known as intra picture block compensation or current picture referencing (CPR).

[0192] IBC uses a block vector (BV) to represent the position difference between the current block and the reference block, similar to the MV used in inter-frame prediction. The encoder uses block matching within the search range to determine the best matching block for the current block and encodes the BV. There are various methods for encoding the BV, such as the merge mode, which is similar to inter-frame prediction and will not be discussed here.

[0193] IBC can be considered an intra-frame prediction method, or a different type of prediction method independent of intra-frame and inter-frame prediction. IBC is highly efficient for encoding screen content and can also improve compression efficiency in natural sequences captured by cameras.

[0194] Intra Template Matching Prediction (IntraTMP) in ECM10 can be considered a special type of IBC. IntraTMP also searches for a reference block from the coded portion of the current image to generate a prediction block for the current block. IntraTMP uses the reconstructed pixels within a certain range to the left and above the current block as the template for the current block. Each time a BV is searched, the template of the reference block of reconstructed pixels within a certain range to the left and above the corresponding reference block of the same size as the current block is calculated. The matching cost between the current block's template and the reference block's template is calculated, and the prediction block is generated based on the matching cost.

[0195] It can also be understood that for decoder-side intra mode derivation (DIMD), DIMD uses the reconstructed pixels on the left and top sides of the current block to derive the prediction mode, but it does not predict on the template, but analyzes the gradient of the reconstructed pixels.

[0196] As shown in Figure 20, DIMD analyzes the gradient of black points, such as horizontal gradient and vertical gradient, and adapts an intra-frame prediction mode according to its gradient. The analysis of all points that need to be checked can obtain a result similar to the bar graph below. That is, the statistics of the number of points matched by each intra-frame prediction mode. Of course, the so-called bar graph is just to help understanding, and it can be implemented in a variety of simple forms. The current DIMD selects the two highest intra-frame prediction modes in the histogram, plus the PLANAR mode, and the prediction values ​​of a total of three intra-frame prediction modes are weighted. The weights are related to the results of the analysis. For example, as shown in Figure 21, the three intra-frame prediction modes include M1 mode, M2 mode and PLANAR mode. The prediction values ​​obtained for these three intra-frame prediction modes are set to Pred1, Pred2, and Pred3 respectively, and the weight values ​​of these three intra-frame prediction modes are set to w1, w2, and w3 respectively. The specific calculation formulas are as follows:

[0197] The final prediction block can be shown as follows:

[0198] In summary, DIMD uses gradient analysis of reconstructed pixels to select intra prediction modes, and can weight two intra prediction modes plus planar based on the analysis results. The advantage of DIMD is that if DIMD mode is selected for the current block, the decoder does not need to indicate the specific intra prediction mode to be used. Instead, the decoder can derive the selected mode through the above process, which saves a certain amount of overhead.

[0199] It can also be understood that for cross-component prediction (Cross-Component Prediction, CCP), since different components of the same space have a strong correlation, video coding and decoding technology can use this correlation to improve compression efficiency. In some cases, the first component of the same space will be encoded and decoded first, and then the second and third components will be encoded and decoded, so that the second and third components can use some information of the first component. For example, in the YUV format, the pixels of U and V can be predicted using the reconstructed pixels of Y at the corresponding positions. If it is in YUV4:2:0 format, the pixel positions of U and V do not correspond one to one to the position of Y, and the corresponding reconstructed pixels of Y can be found for prediction through methods such as downsampling.

[0200] A typical example of CCP in VVC is Cross-Component Linear Model (CCLM). Other cross-component prediction technologies in ECM include Multi-Model CCLM (MM-CCLM), Convolutional Cross-Component Model (CCCM), Multi-Model CCCM (MM-CCCM), Gradient Linear Model (GLM), inter-CCCM, etc. There are other derivative technologies that are not listed one by one. They are all technologies that use some information of the first color component, such as the reconstruction value, to predict the second / third color component. Cross-component prediction technology can be used for blocks encoded within a frame as well as for blocks encoded between frames. For example, inter-CCCM is used for blocks encoded between frames.

[0201] (1) Cross-component linear model CCLM.

[0202] CCLM, as the name implies, is a technique that uses a linear model of the first color component and the second / third color component for prediction. Specifically, it is as follows: pred C (i,j)=α·rec L ′(i,j)+β (21)

[0203] Among them, pred C (i, j) represents the predicted value of the chrominance pixel at position (i, j), which represents rec L The reconstructed value of the downsampled luminance pixel at the ′(i,j) position. The model parameters (α and β) of CCLM are derived based on the adjacent downsampled luminance pixels and chrominance pixels of the current block. For example, as shown in Figure 22, a sampling diagram of the adjacent reference values ​​of the luminance component and the chrominance component of the current block is shown; wherein, in (a), the larger bold box is used to highlight the chrominance block 21, and the gray solid circle is used to indicate the adjacent reference value of the chrominance block 21; in (b), the larger bold box is used to highlight the luminance block 22, and the gray solid circle is used to indicate the adjacent reference value of the luminance block 22. Among them, the chrominance block 21 is N×N in size, and the luminance block 22 is 2N×2N in size. Here, the adjacent reference values ​​of the chrominance block 21 and the adjacent reference values ​​of the luminance block 22 are both used to derive the model parameters α and β.

[0204] The basic principle is to use the adjacent luminance and chrominance pixels of the current block to derive a linear model, then apply this linear model to the current block, and determine the predicted value of chrominance based on the reconstructed value of luminance and this linear model.

[0205] (2) Multi-model CCLM.

[0206] MM-CCLM is an extension of CCLM. CCLM uses only one linear model in the current block, while MM-CCLM, as the name implies, uses multiple linear models. Specifically, two linear models are used in ECM-10. To derive the two linear models, the adjacent luminance pixels on the left and above sides of the current block used to derive the linear models are divided into two groups, with the grouping threshold being the median of these luminance pixel values. When predicting the current block, the same threshold is used to divide the luminance pixels of the current block into two groups, and prediction is performed using their respective models. Figure 23 is a schematic diagram of MM-CCLM grouping, and Figure 24 is a schematic diagram of MM-CCLM prediction.

[0207] (3) Convolutional Cross-Component Model CCCM.

[0208] Similar to CCLM, CCCM also derives a cross-component model based on the reconstructed portions to the left and above the current block. However, CCCM uses a larger reconstruction area, allowing it to derive a nonlinear model. Another difference is that CCLM predicts a chrominance value from a downsampled luma value, while CCCM uses the reconstructed luma value at the corresponding chrominance pixel, as well as the surrounding pixels above, below, and to the left and right of the pixel.

[0209] Specifically, CCCM uses a 7-tap convolution filter that includes five spatially adjacent pixels. C (center) is the luma pixel corresponding to the current chroma pixel, N (north) is the luma pixel above C, S (south) is the luma pixel below C, W (west) is the luma pixel to the left of C, and E is the luma pixel to the right of C. There is also a nonlinear term P, P = (C × C + midVal) >> bitDepth. Here, midVal means the median, and bitDepth is the bit width. For the 10-bit case, P = (C × C + 512) >> 10. There is also an offset term B, which is set to the median, which is 512 for the 10-bit case. The predicted value of the chroma pixel is predChromaVal = C0C + C1N + C2S + C3E + C4W + C5P + C6B.

[0210] In order to determine C0, C1, C2, C3, C4, C5, and C6, CCCM will apply the same model to predict the chrominance in the reference area as shown in Figure 25 and compare it with the reconstructed chrominance value to solve C0, C1, C2, C3, C4, C5, and C6 that minimizes the mean square error.

[0211] (4) Multi-model convolutional cross-component model MM-CCCM.

[0212] Similar to MM-CCLM, multiple models are applied to the current block. ECM-10 uses two models. The derivation method also uses a threshold to separate the reconstructed luma pixels and the luma pixels of the current block into two groups. CCCM models are derived for each group, and the predictions are combined into a single prediction block.

[0213] (5) Gradient linear model GLM.

[0214] GLM is a method for predicting chromaticity based on the gradient of brightness. There are two GLM modes, one is 2-parameter GLM and the other is 3-parameter GLM.

[0215] The formula for a 2-parameter GLM is pred C (i,j)=α·grad L (i,j)+β;

[0216] The formula for the 3-parameter GLM is pred C (i,j)=α0·grad L (i,j)+α1·rec L ′(i,j)+β.

[0217] Here, the 2-parameter GLM replaces the reconstructed luminance pixel values ​​from the downsampled CCLM with luminance gradients. The 3-parameter GLM adds a luminance gradient to the CCLM. There are four ways to calculate the luminance gradient, as shown in Figure 26. The filter squares correspond to luminance pixels, and the circles correspond to chrominance pixels. This is a set of filters designed for the YUV 4:2:0 format.

[0218] (6) CCCM between frames.

[0219] Intra-frame prediction and inter-frame prediction are different. Intra-frame prediction uses reconstructed pixels around the current block to predict the interior of the current block, while inter-frame prediction uses images of the same object at different times. The most basic principle of inter-frame prediction is translational motion: using a motion vector to find a reference block and use the reference block as the prediction block. Since the same object is found at different times, the reference image contains the same number of components as the current image. For YUV sequences, all three YUV components can be predicted from the reference block. Cross-component models such as CCLM and CCCM follow a similar approach to intra-frame prediction, using surrounding reconstructed pixels to derive the model. However, inter-CCCM uses the original inter-frame prediction block to derive the cross-component model (filter coefficients), as shown in Figure 27. resY, resCb, and resCr represent the luma residual, blue chroma residual, and red chroma residual, respectively. Adding the corresponding predicted values ​​yields the reconstructed luma value Y, blue chroma reconstructed value Cb, and red chroma reconstructed value Cr. In other words, after luma reconstruction, the derived model (filter coefficients) is applied to the luma reconstruction value to obtain a second chroma prediction value. The original prediction value and the second prediction value obtained by inter-CCCM are weighted to form the new prediction value. Inter-CCCM transforms the reconstruction value containing the luma residual into a chroma prediction through the model, thereby improving compression efficiency.

[0220] Furthermore, the following introduces the transformation technology.

[0221] During encoding, commonly used hybrid coding frameworks first perform a prediction. This prediction leverages spatial or temporal correlation to produce an image identical or similar to the current block. While it's possible for the predicted block to be identical to the current block for a given block, it's difficult to guarantee this for all blocks in a video, especially in natural video or video captured by a camera. Irregular motion, distortion, occlusion, and brightness changes in video are difficult to fully predict. Therefore, hybrid coding frameworks subtract the predicted image from the original image of the current block to produce a residual image, or, in other words, subtract the predicted block from the current block to produce a residual block. This residual block is typically much simpler than the original image, so prediction can significantly improve compression efficiency. The residual block isn't encoded directly; instead, it's usually first transformed. This transform converts the residual image from the spatial domain to the frequency domain to remove correlation. After the residual image is transformed to the frequency domain, since most of the energy is concentrated in the low-frequency region, the non-zero coefficients are concentrated in the upper left corner. Quantization is then used to further compress the image. Furthermore, since the human eye is less sensitive to high frequencies, a larger quantization step size can be used in high-frequency regions.

[0222] Figure 28 is a schematic diagram of a DCT transform. As shown in Figure 28, after the DCT transform of the original image, only the upper left corner has non-zero coefficients. Of course, this example performs a DCT transform on the entire image. In video codecs, images are processed by dividing them into blocks, so the transform is also performed on a block-by-block basis.

[0223] Transforms are very useful in typical video compression, but not all blocks require transforms. In some cases, transforms can even yield worse compression results than non-transforms. Therefore, in some standards, such as VVC, the encoder can choose whether to use transforms for the current block. DCT-II is the most commonly used transform in video compression standards, and its base image is shown in Figure 29.

[0224] In addition, VVC can also use DCT8 type (DCT-VIII) and DST7 type (DST-VII). The basic formulas of these transforms are shown in Table 3, which shows the basic transform formulas of DCT2, DCT8 and DST7 for N-point input.

[0225] Table 3

[0226] Because images are all two-dimensional, the computational complexity and memory overhead of performing a direct two-dimensional transform were prohibitive for the hardware available at the time. Therefore, the DCT2, DCT8, and DST7 transforms used in the standards were split into two steps: horizontal and vertical one-dimensional transforms. For example, the horizontal transform was performed first, followed by the vertical transform, or the vertical transform was performed first, followed by the horizontal transform.

[0227] (1) Multi-transformation selection MTS.

[0228] VVC supports transform kernels such as DCT2, DCT8, and DST7. For a block, the encoder selects the appropriate transform kernel and transmits the index to the bitstream. The decoder then uses the index to determine the transform kernel for the inverse transform. Different transform kernels can be selected for the horizontal and vertical directions, such as using DCT8 horizontally and DST7 vertically. This technique is generally referred to as MTS.

[0229] (2) Low-frequency non-separable transform LFNST.

[0230] The above transformation method is effective for horizontal and vertical textures, but less so for diagonal textures. Indeed, horizontal and vertical textures are the most common, making the above transformation method very useful for improving compression efficiency. As the demand for compression efficiency continues to increase, more efficient processing of diagonal textures could further improve compression efficiency.

[0231] In order to more effectively process the residual of oblique texture, LFNST transform is used in VVC. The above transforms such as DCT2, DCT8, and DST7 are called primary transforms. At the encoding end of VVC, LFNST is used after DCT2 transform and before quantization. At the decoding end of VVC, LFNST is used after inverse quantization and before inverse DCT2 transform. Because it is transformed on the basis of DCT2 (basic transform), LFNST is a secondary transform. Figure 30 is a schematic diagram of the encoding and decoding process without LFNST (secondary transform), and Figure 31 is a schematic diagram of the encoding and decoding process with LFNST (secondary transform). Of course, the encoding end can directly inverse quantize the saved quantization coefficients instead of entropy decoding, because entropy coding is lossless.

[0232] Figure 32 is a detailed schematic diagram of the encoding and decoding process with LFNST (secondary transform). As shown in Figure 32, at the encoding end, the first step is the forward basic transform, and then the LFNST performs a secondary transform on the low-frequency coefficients in the upper left corner after the basic transform. For example, there are 16 input coefficients for 4×4 LFNST and 64 input coefficients for 8×8 LFNST; the coefficients after the LFNST transform are then quantized and the quantized coefficients are written into the bitstream. At the decoding end, the transform coefficients can be obtained by decoding the bitstream and inverse quantization. Then, in the inverse LFNST transform, there are 8 input coefficients for 4×4 inverse LFNST and 16 input coefficients for 8×8 inverse LFNST. Finally, the inverse basic transform can obtain the residual block.

[0233] That is, at the encoder, LFNST performs a secondary transform on the low-frequency coefficients in the upper left corner after the base transform. The base transform decorrelates the image, concentrating the energy in the upper left corner. The secondary transform further decorrelates the low-frequency coefficients of the base transform. The result is intuitively shown in Figure 32. At the encoder, 16 coefficients are input to a 4×4 LFNST, and the output is 8 coefficients; 64 coefficients are input to an 8×8 LFNST, and the output is 16 coefficients. At the decoder, 8 coefficients are input to a 4×4 inverse LFNST, and the output is 16 coefficients; 16 coefficients are input to an 8×8 inverse LFNST, and the output is 64 coefficients.

[0234] Figure 33 shows some base images for the LFNST algorithm in VVC. Figure 33 shows some obvious diagonal textures. In addition to kernels optimized for certain diagonal textures, the LFNST algorithm also has kernels optimized for flat, gradient textures, such as kernel group 0 in the LFNST algorithm in VVC.

[0235] LFNST is only applied to intra-coded blocks. Angular prediction tiles the reference pixels at a specified angle onto the current block as the prediction value. This means the predicted block will have a distinct directional texture, and the residual of the current block after angular prediction will also statistically exhibit significant angular characteristics. Therefore, the transform kernel selected by LFNST can be tied to the intra-prediction mode. That is, once the intra-prediction mode is determined, LFNST can only use the set of transform kernels corresponding to that intra-prediction mode.

[0236] Specifically, the LFNST in VVC has a total of 4 groups of transform kernels, and each group can select 2 transform kernels. Table 4 shows the correspondence between intra prediction modes and transform kernel groups. Note that the cross-component prediction modes used for chroma intra prediction are 81 to 83, and there are no such modes for luma intra prediction. The transform kernel of LFNST can be transposed to process more angles with one transform kernel group. For example, modes 13 to 23 and 45 to 55 both correspond to transform kernel group 2, but 13 to 23 is obviously close to the horizontal mode and 45 to 55 is obviously close to the vertical mode.

[0237] Table 4

[0238] VVC's LFNST uses four sets of transform kernels, with the intra-prediction mode specifying which set to use. This leverages the correlation between the intra-prediction mode and the LFNST transform kernel, reducing the transmission of the selected LFNST transform kernel in the bitstream. Whether the current block uses LFNST, and if so, whether to use the first or second set within a set, is determined by the bitstream and certain conditions.

[0239] In the subsequent evolution of ECM technology, LFNST was further expanded. LFNST has more transform kernel groups, 35 in ECM. The correspondence between the transform kernel group index (LFNST set index) and the intra prediction mode (Intra pred.mode) is shown in Table 5. Each transform kernel group is more efficient for textures at the corresponding angle. Here, each transform kernel group can select three transform kernels.

[0240] Table 5

[0241] (3) Non-separable basis transformation NSPT.

[0242] LFNST is a horizontally and vertically inseparable transform. Because it involves a secondary transform, DCT2 can be called the base transform. This approach of performing DCT2 before LFNST is a compromise between performance and complexity. While directly performing the inseparable base transform is more efficient, it also incurs higher complexity, such as increased computational effort and storage space required for the transform kernel.

[0243] In ECM10, some small blocks can use NSPT, while large blocks still use DCT2+LFNST. The sizes of small blocks are 4×4, 4×8, 8×4, 8×8, 4×16, 16×4, 8×16, 16×8, 8×32, and 32×8. In ECM10, NSPT also matches the transform kernel group according to the intra prediction mode. The matching method can refer to the LFNST method. Each transform kernel group has 3 transform kernels to choose from. For example, an 8×8 base image of an NSPT in ECM10 is shown in Figure 34. Figure 34 corresponds to inter-frame angle prediction mode 7. It can be seen that it handles the texture of the corresponding angle better. It should be noted that NSPT is only applied to intra-coded blocks.

[0244] Furthermore, for the partitioning technology, it can be divided into single tree partitioning and dual tree partitioning. In the Single tree, luminance and chrominance are divided together, and a CU contains a luminance block and a chrominance block at the same position. In the Dual tree, luminance and chrominance are divided separately, and a CU has only luminance blocks or only chrominance blocks. HEVC only has Single tree. Dual tree is introduced in VVC, but the P and B slices in VVC can still only use Single tree. The I slice in VVC can use Dual tree. As shown in Figure 35, luminance and chrominance are divided separately, and it can be seen that luminance has a finer division than chrominance, because luminance has more details than chrominance, and generally luminance requires better quality than chrominance.

[0245] In summary, in related technologies, LFNST and NSPT are only applied to intra-coded blocks. Because intra-frame prediction cannot perfectly predict complex textures in many cases, intra-coded blocks typically have more residuals, and statistically, there is a certain correlation between the residuals of intra-frame prediction and the prediction angle. Inter-coded blocks can usually find better prediction blocks from the reference image, resulting in fewer residuals. In addition, there is no intra-frame prediction mode to match the corresponding transform kernel group. If the selection of the transform kernel group is indicated in the bitstream, the overhead will be very high. These two aspects may be the reason why LFNST and NSPT in related technologies are not used for inter-frame coding, which is not conducive to improving the performance of inter-frame encoding and decoding.

[0246] Based on this, an embodiment of the present application provides an encoding method, which determines the texture feature index of the current block; determines the transform kernel group of the current block based on the texture feature index; determines the transform kernel of the current block based on the transform kernel group; transforms the residual block of the current block based on the transform kernel to determine the transform coefficient of the current block; and encodes the transform coefficient of the current block and writes the obtained coded bits into the bitstream. An embodiment of the present application also provides a decoding method, which determines the texture feature index of the current block; determines the transform kernel group of the current block based on the texture feature index; determines the transform kernel of the current block based on the transform kernel group; and inversely transforms the transform coefficient of the current block based on the transform kernel to determine the residual block of the current block.

[0247] In this way, both the encoding and decoding ends first determine the texture feature index of the current block, then determine the transform core group of the current block based on the texture feature index, and then determine the transform kernel of the current block based on the transform kernel group. In other words, a correspondence between the texture feature index and the transform kernel group is established here, replacing the scheme of matching the transform kernel group according to the intra-frame prediction mode in related technologies. This allows LFNST and NSPT to be applied to the inter-frame prediction mode. This improves not only the compression efficiency, that is, the video encoding and decoding efficiency, but also the encoding and decoding performance for blocks that are difficult to predict in the inter-frame prediction mode, that is, blocks with large residuals.

[0248] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0249] FIG36 is a schematic diagram of a network architecture for video encoding and decoding provided in an embodiment of the present application. As shown in FIG36 , the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein electronic devices 13 to 1N can perform video interaction via the communication network 01. During implementation, the electronic devices can be various types of devices with video encoding and decoding capabilities. For example, the electronic devices can include mobile phones, tablet computers, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensor devices, servers, etc., and the embodiments of the present application do not limit this.

[0250] In an embodiment of the present application, a network architecture of a video encoding and decoding system including a decoding method and an encoding method is provided. The decoder or encoder in the embodiment of the present application can be the aforementioned electronic device. In other words, the electronic device in the embodiment of the present application has video encoding and decoding capabilities, and generally includes a video encoder (i.e., encoder) and a video decoder (i.e., decoder).

[0251] FIG37 is a block diagram of the system composition of an encoder provided in an embodiment of the present application. As shown in FIG37 , the encoder 100 may include: a segmentation unit 101, a prediction unit 102, a first adder 107, a transform unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transform unit 111, a second adder 112, a filtering unit 113, a decoded picture buffer (DPB) unit 114, and an entropy coding unit 115. Here, the input of the encoder 100 may be a video consisting of a series of pictures or a single still picture, and the output of the encoder 100 may be a bitstream (also referred to as a "codestream") used to represent a compressed version of the input video.

[0252] Among them, the segmentation unit 101 segments the picture in the input video into one or more Coding Tree Units (CTUs). The segmentation unit 101 divides the picture into multiple tiles (or tiles), and can further divide a tile into one or more bricks. Here, a tile or a brick may include one or more complete and / or partial CTUs. In addition, the segmentation unit 101 can form one or more slices, where a slice can include one or more tiles arranged in a grid order in the picture, or one or more tiles covering a rectangular area in the picture. The segmentation unit 101 can also form one or more sub-pictures, where a sub-picture can include one or more slices, tiles or bricks.

[0253] During the encoding process of encoder 100, segmentation unit 101 transmits the CTU to prediction unit 102. Generally, prediction unit 102 may be composed of block segmentation unit 103, motion estimation (ME) unit 104, motion compensation (MC) unit 105, and intra prediction unit 106. Specifically, block segmentation unit 103 iteratively uses quadtree segmentation, binary tree segmentation, and ternary tree segmentation to further divide the input CTU into smaller coding units (CUs). Prediction unit 102 may use ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks for the CU. Intra-frame prediction unit 106 may use various intra-frame prediction modes, including MIP mode, to obtain intra-frame prediction blocks for the CU. In an example, a rate-distortion optimized motion estimation method may be used by ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks, and a rate-distortion optimized mode determination method may be used by intra-frame prediction unit 106 to obtain intra-frame prediction blocks.

[0254] The prediction unit 102 outputs the prediction block of the CU, and the first adder 107 calculates the difference between the CU in the output of the segmentation unit 101 and the prediction block of the CU, i.e., the residual CU. The transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs the quantized coefficients (i.e., levels). The inverse quantization unit 110 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 111 performs one or more inverse transforms corresponding to the transform in the transform unit 108 and outputs the reconstructed residual. The second adder 112 calculates the reconstructed CU by adding the reconstructed residual and the prediction block of the CU from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 for use as an intra-frame prediction reference. After all CUs in the picture or sub-picture are reconstructed, the filtering unit 113 performs loop filtering on the reconstructed picture or sub-picture. Here, the filtering unit 113 includes one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping and chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, when the filtering unit 113 determines that a CU is not used as a reference for encoding other CUs, the filtering unit 113 performs loop filtering on one or more target pixels in the CU.

[0255] The output of the filtering unit 113 is a decoded picture or sub-picture, which is cached to the DPB unit 114. The DPB unit 114 outputs the decoded picture or sub-picture based on the timing and control information. Here, the picture stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, the entropy coding unit 115 converts the parameters required for decoding the picture from the encoder 100 (such as control parameters and supplementary information, etc.) into binary form and writes this binary form into the code stream according to the syntax structure of each data unit. That is, the encoder 100 finally outputs the code stream.

[0256] Furthermore, the encoder 100 can be a device having a first processor and a first memory for recording a computer program. When the first processor reads and executes the computer program, the encoder 100 reads the input video and generates a corresponding bitstream. Alternatively, the encoder 100 can be a computing device having one or more chips. These units implemented as integrated circuits on the chip have similar connection and data exchange functions as the corresponding units in FIG37 .

[0257] Figure 38 is a block diagram of the system components of a decoder provided in an embodiment of the present application. As shown in Figure 38, the decoder 200 may include: a parsing unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded image buffer unit 209. Here, the input of the decoder 200 is a bitstream representing a compressed version of a video or a still image, and the output of the decoder 200 may be a decoded video consisting of a series of images or a decoded still image.

[0258] The input codestream to decoder 200 may be the codestream generated by encoder 100. Parsing unit 201 parses the input codestream and obtains syntax element values ​​from the input codestream. Parsing unit 201 converts the binary representation of the syntax elements into digital values ​​and sends the digital values ​​to units within decoder 200 to obtain one or more decoded pictures. Parsing unit 201 may also parse one or more syntax elements from the input codestream to display decoded pictures.

[0259] During the decoding process of the decoder 200 , the parsing unit 201 sends the values ​​of the syntax elements and one or more variables set or determined according to the values ​​of the syntax elements and used to obtain one or more decoded pictures to the units in the decoder 200 .

[0260] The prediction unit 202 determines a prediction block for the current decoding block (e.g., CU). Here, the prediction unit 202 may include a motion compensation unit 203 and an intra-frame prediction unit 204. Specifically, when the inter-frame decoding mode is indicated for decoding the current decoding block, the prediction unit 202 passes the relevant parameters from the parsing unit 201 to the motion compensation unit 203 to obtain an inter-frame prediction block; when the intra-frame prediction mode (including the MIP mode indicated based on the MIP mode index value) is indicated for decoding the current decoding block, the prediction unit 202 passes the relevant parameters from the parsing unit 201 to the intra-frame prediction unit 204 to obtain an intra-frame prediction block.

[0261] The inverse quantization unit 205 has the same function as the inverse quantization unit 110 in the encoder 100. The inverse quantization unit 205 performs a scaling operation on the quantization coefficients (ie, levels) from the parsing unit 201 to obtain reconstructed coefficients.

[0262] The inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The inverse transform unit 206 performs one or more transform operations (ie, inverse operations of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain a reconstructed residual.

[0263] The adder 207 performs an addition operation on its input (the prediction block from the prediction unit 202 and the reconstructed residual from the inverse transform unit 206) to obtain a reconstructed block of the current decoded block. The reconstructed block is also sent to the prediction unit 202 to be used as a reference for other blocks encoded in the intra prediction mode.

[0264] After all CUs in the picture or sub-picture are reconstructed, the filtering unit 208 performs loop filtering on the reconstructed picture or sub-picture. The filtering unit 208 includes one or more filters, such as a deblocking filter, a sample adaptive offset filter, an adaptive loop filter, a luminance mapping and chroma scaling filter, and a neural network-based filter. Alternatively, when the filtering unit 208 determines that the reconstructed block is not used as a reference for decoding other blocks, the filtering unit 208 performs loop filtering on one or more target pixels in the reconstructed block. Here, the output of the filtering unit 208 is a decoded picture or sub-picture, which is cached to the DPB unit 209. The DPB unit 209 outputs the decoded picture or sub-picture based on timing and control information. The picture stored in the DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by the prediction unit 202.

[0265] Furthermore, the decoder 200 can be a second memory having a second processor and a computer program. When the first processor reads and runs the computer program, the decoder 200 reads the input code stream and generates the corresponding decoded video. In addition, the decoder 200 can also be a computing device having one or more chips. These units implemented as integrated circuits on the chip have connections and data exchange functions similar to those of the corresponding units in Figure 38.

[0266] It should also be noted that when the embodiment of the present application is applied to the encoder 100, the "current block" specifically refers to the current block to be encoded in the video image (which can also be simply referred to as the "encoding block"); when the embodiment of the present application is applied to the decoder 200, the "current block" specifically refers to the current block to be decoded in the video image (which can also be simply referred to as the "decoding block").

[0267] In one embodiment of the present application, referring to FIG39 , a flowchart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG39 , the method may include:

[0268] S3901: Determine the texture feature index of the current block.

[0269] It should be noted that in the embodiments of the present application, the method is applied to a decoder. Specifically, based on the structure of decoder 200 shown in FIG38 , the decoding method of the embodiments of the present application is primarily applied to blocks decoded for inter-frame decoding. Specifically, when the blocks decoded for inter-frame decoding use inter-frame prediction mode, the optimization scheme proposed here is mainly for the NSPT and LFNST transforms in inter-frame prediction mode to improve the compression efficiency of inter-frame prediction.

[0270] Here, NSPT and LFNST are both transformations that can efficiently process textures of various angles. There may be multiple transformation kernels, and one transformation kernel may be specially optimized for a certain specific angle texture. In addition to angle textures, NSPT and LFNST also include transformation kernels for processing gradient textures. In fact, these transformation kernels can also be said to be trained KL transforms (Karhunen-Loeve Transform, KLT). In other words, both NSPT and LFNST can have multiple transformation kernels, each designed for a specific texture. Among them, specific textures include angle textures, gradient textures, etc. In addition, gradient textures can be further extended to include horizontal gradient textures, vertical gradient textures, oblique gradient textures, etc. Furthermore, this technical solution is not limited to being used only for inseparable transformations such as NSPT and LFNST, but can also be applied to separable transformations optimized for specific textures.

[0271] It should also be noted that in the intra-frame predicted block, both NSPT and LFNST include multiple transform kernel groups, and each intra-frame prediction mode can correspond to a transform kernel group. However, the inter-frame predicted block does not have an intra-frame prediction mode, which is a problem in applying LFNST and NSPT to inter-frame prediction. In an embodiment of the present application, a virtual intra-frame prediction mode (index) can be derived based on the inter-frame predicted block, or it can be called a texture feature index. For example, the DC mode and the PLANAR mode correspond to gradient texture features, and a certain angle prediction mode corresponds to the texture features of this angle. That is to say, in an embodiment of the present application, the texture feature index can avoid the occurrence of intra-frame prediction mode in "inter-frame" on the one hand, and on the other hand, it is more conducive to possible expansion. For example, an intra-frame prediction mode can correspond to multiple texture features, such as the DC mode can correspond to horizontal gradient texture, vertical gradient texture, oblique gradient texture, etc.

[0272] In this embodiment, a virtual intra-frame prediction mode (or "texture feature index") is proposed to adapt to the NSPT and LFNST transform schemes used in inter-frame prediction. This virtual intra-frame prediction mode is used only to select the transform kernel group for NSPT or LFNST. The derivation of the texture feature index is described in detail below.

[0273] In some embodiments, determining the texture feature index of the current block may include: determining candidate pixels for deriving the texture feature index; and determining the texture feature index of the current block according to the candidate pixels.

[0274] In a possible implementation, for candidate pixels, a prediction block of the current block may be determined; and at least part of the pixels in the prediction block are used as candidate pixels.

[0275] In the embodiment of the present application, if a certain texture exists in the prediction block, it can be considered that the residual block has a texture with the same characteristics. In this way, the candidate pixels used for inter-frame texture feature index derivation can be all pixels in the prediction block or part of the pixels in the prediction block.

[0276] In another possible implementation, for candidate pixels, adjacent pixels of a reconstructed area of ​​the current block may be determined; and the adjacent pixels of the reconstructed area may be used as candidate pixels.

[0277] In the embodiment of the present application, the candidate pixels used for inter-frame texture feature index derivation can be pixels adjacent to the reconstructed area of ​​the current block, such as the reconstructed areas to the left and right of the current block. Because the reconstructed areas to the left and above are not the current block but are adjacent to the current block, for example, if the texture is connected, they can be used to estimate the texture of the current block to a certain extent.

[0278] In yet another possible implementation, more pixels are considered. For candidate pixels, adjacent pixels in the reconstructed area and at least part of the pixels in the prediction block may be used as candidate pixels.

[0279] In an embodiment of the present application, the candidate pixels used for inter-frame derivation of texture feature indexes may also be the predicted block of the current block and the adjacent pixels of the reconstructed areas to the left and above the current block. In this way, more pixels are used to derive the texture feature index, making the derived texture feature index more accurate.

[0280] In another possible implementation, considering the pipeline length of the hardware, for candidate pixels, a reference block of the current block may be determined; and at least part of the pixels in the reference block may be used as candidate pixels.

[0281] In an embodiment of the present application, for the current block, the texture feature index can only be derived after the prediction block is obtained. After the texture feature index is determined, the LFNST / NSPT transform kernel can be determined, and then the inverse transform and subsequent processes can be performed. Here, if a reference block is used to derive the texture feature index, theoretically, the process of generating the prediction block and the process of deriving the texture feature index can be performed in parallel, which is shorter than the pipeline using the prediction block. Therefore, it is also possible to use the reference block to derive the texture feature index, or to derive the texture feature index synchronously during the process of generating the prediction block, thereby shortening the pipeline length.

[0282] In some embodiments, for the reference block of the current block, the reference block may be determined to be an integer-pixel reference block; or, the reference block may be determined to be a fractional-pixel reference block.

[0283] In one possible implementation, integer-pixel reference blocks can be used directly as reference blocks, as there is no significant difference in texture direction. For example, for a bidirectionally predicted inter-frame block, a virtual intra-frame prediction mode can be derived based on the integer-pixel reference blocks.

[0284] In another possible implementation, the reference block may also use a pixel-by-pixel reference block that has been subjected to an interpolation filter. Specifically, two reference image blocks are determined for bidirectional prediction of the current block; pixel-by-pixel interpolation filtering is performed on the two reference image blocks to determine two pixel-by-pixel reference image blocks; and a weighted combination of the two pixel-by-pixel reference image blocks is performed to determine the reference block for the current block.

[0285] For example, for a bidirectionally predicted inter-frame block, two reference blocks are first subjected to pixel-by-pixel interpolation filtering, and then the two pixel-by-pixel reference blocks are weightedly combined. After obtaining the two interpolated filtered reference blocks, a weighted average of the interpolated filtered reference blocks can be used to obtain a prediction value, and a texture feature index can be derived from the interpolated filtered reference blocks.

[0286] It should also be noted that, in the embodiment of the present application, the number of candidate pixels used to derive the texture feature index may be at least one, such as 1, 2, 3 or more. In some embodiments, the number of candidate pixels may be determined based on the size parameter of the current block.

[0287] That is to say, when determining the texture feature index of the current block, the number of candidate pixels used can be determined by the size parameter of the current block. For example, if the size of the current block is small, then all available pixels can be counted; if the size of the current block is large, then the current block can be downsampled and counted, such as counting one pixel out of every 2, or 4, or 8 pixels in the horizontal and / or vertical directions. Alternatively, if the size of the current block in one of the horizontal or vertical directions is less than or equal to 8, then all available pixels in that direction are counted; otherwise, if the size of the current block in one of the horizontal or vertical directions is less than or equal to 16, then one pixel out of every 2 pixels in that direction is counted; otherwise, one pixel out of every 4 pixels in that direction is counted, and no specific limitation is given here.

[0288] In some embodiments, determining the texture feature index of the current block based on the candidate pixels may include: determining the horizontal gradient value and the vertical gradient value of the candidate pixels; determining the texture feature index and the gradient intensity value corresponding to the candidate pixels based on the horizontal gradient value and the vertical gradient value of the candidate pixels; constructing a texture feature statistics table based on the texture feature index and the gradient intensity value corresponding to the candidate pixels; and determining the texture feature index of the current block based on the texture feature statistics table.

[0289] It should be noted that in an embodiment of the present application, when determining the texture feature index and gradient intensity value corresponding to the candidate pixel based on the horizontal gradient value and vertical gradient value of the candidate pixel, it can include: performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; and performing gradient intensity calculation based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the gradient intensity value corresponding to the candidate pixel.

[0290] In a specific embodiment, performing angle mapping based on the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel may include: determining the texture feature index corresponding to the candidate pixel using a preset lookup table based on the horizontal gradient value and the vertical gradient value of the candidate pixel.

[0291] In the embodiment of the present application, the horizontal gradient value of the candidate pixel can be expressed as grad x Indicates that the vertical gradient value of the candidate pixel can be expressed as grad y In this way, according to grad x and grad y Deriving the virtual intra prediction mode can be achieved by looking up a table.

[0292] For example, if abs(grad x ) is equal to 0 and abs(grad y) is not equal to 0, then there is horizontal texture, corresponding to intra prediction mode 18 in some technologies. y ) is equal to 0 and abs(grad x ) is not equal to 0, then there is vertical texture, corresponding to the intra prediction mode 50 in some technologies. x ) and abs(grad y ) are not equal to 0, if abs(grad x ) is equal to abs(grad y ), and grad x and grad y The symbols are the same, corresponding to intra prediction mode 34 in some technologies. x ) is equal to 2 times abs(grad y ), and grad x and grad y The symbols are the same, corresponding to the intra-frame prediction mode 40 in some technologies. In addition, other situations can be determined by looking up the table according to the same principle.

[0293] In a specific embodiment, performing gradient strength calculation based on the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel may include: performing an addition operation on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient strength value corresponding to the candidate pixel.

[0294] Here, the gradient intensity value corresponding to the candidate pixel can be recorded as amp. For example, amp=abs(grad x )+abs(grad y ).

[0295] It should be noted that, in the embodiment of the present application, the horizontal gradient value and the vertical gradient value of the candidate pixel can be calculated using the Sobel operator. For example, for the Sobel operator, the specific calculation is as follows:

[0296] Operator for horizontal gradient value:

[0297] Operator for vertical gradient value:

[0298] So, suppose the pixel value at pixel position (x, y) is P x,y , then the horizontal gradient value grad x And the vertical gradient value grad y The calculation of grad is as follows: x =P x+1,y-1 +2*P x+1,y +Px+1,y+1 -P x-1,y-1 -2*P x-1,y -P x-1,y+1 (22) grad y =P x-1,y+1 +2*P x,y+1 +P x+1,y+1 -P x-1,y-1 -2*P x,y-1 -P x+1,y-1 (twenty three)

[0299] In some embodiments, constructing a texture feature statistics table based on the texture feature index and gradient intensity value corresponding to the candidate pixel may include: determining at least one texture feature index and at least one corresponding gradient intensity value when the number of candidate pixels is at least one; determining at least one reference texture feature index with mutually different characteristics based on the at least one texture feature index, and accumulating the gradient intensity values ​​belonging to the same reference texture feature index based on the at least one gradient intensity value to determine the gradient intensity cumulative value corresponding to the at least one reference texture feature index; constructing a texture feature statistics table based on the at least one reference texture feature index and the gradient intensity cumulative value corresponding to the at least one reference texture feature index.

[0300] That is to say, in an embodiment of the present application, taking at least some pixels in a prediction block as candidate pixels as an example, the gradient values ​​of all or some pixels in the prediction block are calculated. Generally speaking, the horizontal gradient value and the vertical gradient value can be calculated. Here, the Sobel operator can be used to calculate the gradient value. For a certain pixel, the texture direction of the pixel can be inferred based on its horizontal gradient value and vertical gradient value. For example, if the horizontal gradient value is non-zero and the vertical gradient value is zero, then the texture of the pixel is in the vertical direction. Conversely, if the horizontal gradient value is zero and the vertical gradient value is non-zero, then the texture of the pixel is in the horizontal direction. For example, if the horizontal gradient value and the vertical gradient value are equal and not zero, then the texture of the pixel is 45 degrees. Of course, there are many other cases in the embodiment of the present application where the horizontal gradient value and the vertical gradient value are not zero, and the texture direction of the pixel can be determined based on their ratio. In this way, the gradient intensity value of each pixel can be corresponded to the corresponding texture feature index. A texture feature statistical table is constructed, and the gradient intensity value of each calculated pixel is added to the corresponding texture feature index item in the statistical table to obtain the final texture feature statistical table, and then the texture feature index of the current block can be determined based on the texture feature statistical table.

[0301] In one possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the maximum gradient intensity accumulated value in the texture feature statistics table; and determining the reference texture feature index corresponding to the maximum gradient intensity accumulated value as the texture feature index of the current block.

[0302] In another possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the maximum gradient intensity accumulated value in the texture feature statistics table; when the maximum gradient intensity accumulated value is less than a first threshold, setting the texture feature index of the current block to DC mode or PLANANR mode.

[0303] In another possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the statistical sum of all gradient intensity accumulated values ​​in the texture feature statistics table; when the statistical sum is less than a second threshold, setting the texture feature index of the current block to DC mode or PLANANR mode.

[0304] That is to say, in the embodiment of the present application, the derivation of the virtual intra-frame prediction mode may also be referred to as the derivation of the texture feature index because the virtual intra-frame prediction mode (index) may also be referred to as the derivation of the texture feature index.

[0305] In an embodiment of the present application, an inter-frame prediction block can be used to derive a virtual intra-frame prediction mode. If a certain texture exists in the prediction block, it can be imagined that the residual block contains texture with the same characteristics. For example, the gradient values ​​of all or part of the pixels in the prediction block can be calculated. Generally, the horizontal gradient value and the vertical gradient value can be calculated. The Sobel operator can be used to calculate the gradient value. The corresponding gradient intensity value is then determined based on the horizontal and vertical gradient values. The gradient intensity value is then mapped to the corresponding intra-frame prediction mode, thereby constructing an intra-frame prediction mode statistics table (i.e., the aforementioned "texture feature statistics table"). The gradient intensity value of each calculated candidate pixel needs to be accumulated to the corresponding intra-frame prediction mode entry in the statistics table. After the gradient statistics are completed, one possible implementation method is to use the intra-frame prediction mode with the highest cumulative gradient intensity in the intra-frame prediction mode statistics table as the virtual intra-frame prediction mode for the current block. Alternatively, another possible implementation method is to determine that the virtual intra-frame prediction mode is the DC mode or the PLANANR mode when the cumulative gradient intensity value of the intra-frame prediction mode with the highest cumulative gradient intensity is less than a certain threshold. Alternatively, another possible implementation is to determine that the virtual intra prediction mode is the DC mode or the PLANANR mode when the sum of the accumulated gradient strength values ​​of all the counted pixels is less than a certain threshold.

[0306] In addition, similar statistical derivation of intra-frame prediction modes is required for DIMD, but the difference is that DIMD uses the surrounding reconstruction area of ​​the current block, while this solution uses the prediction block of the current block. In terms of implementation, this solution can reuse some logic with DIMD.

[0307] It's also worth noting that the pixels used to derive the virtual intra prediction mode between frames can also be derived from the reconstructed areas to the left and above of the current block, similar to the DIMD approach. Because the reconstructed areas to the left and above, while not the current block, are adjacent to it (e.g., if the texture is connected), they can be used to estimate the texture of the current block to some extent. Another possibility is to use both the prediction block of the current block and the reconstructed areas to the left and above of the current block, which increases the number of pixels available for inferring the virtual intra prediction mode. Another consideration is hardware pipeline length. For the current block, the virtual intra prediction mode can only be derived after the prediction block is obtained. Once the virtual intra prediction mode is determined, the LFNST / NSPT transform kernel can be determined, allowing for inverse transformation and subsequent processes. If a reference block is used to derive the virtual intra prediction mode, theoretically, the prediction block generation and virtual intra prediction mode derivation processes can be performed in parallel, shortening the pipeline compared to the aforementioned design. Therefore, the embodiments of the present application can also use reference blocks to derive virtual intra-frame prediction modes, or synchronously derive virtual intra-frame prediction modes in the process of generating prediction blocks. Among them, when using reference blocks, integer-pixel reference blocks can be used directly because there will be no obvious difference in texture direction. For example, for a bidirectionally predicted inter-frame block, on the one hand, a virtual intra-frame prediction mode is derived based on the integer-pixel reference block, and on the other hand, two reference blocks are subjected to pixel-by-pixel interpolation filtering, and then the two pixel-by-pixel reference blocks are weightedly combined. Specifically, pixel-by-pixel reference blocks that have been interpolated and filtered can also be used here. For example, for a bidirectionally predicted inter-frame block, it is necessary to first perform pixel-by-pixel interpolation filtering on the two reference blocks, and then the two pixel-by-pixel reference blocks are weightedly combined. Then, after obtaining the two interpolated and filtered reference blocks, on the one hand, a prediction value can be obtained by weighted averaging the interpolated and filtered reference blocks, and on the other hand, a virtual intra-frame prediction mode can be derived based on the interpolated and filtered reference blocks.

[0308] In some embodiments, determining the texture feature index of the current block may further include: determining an angle index when the current block is subjected to a geometric partitioning mode; and determining the texture feature index of the current block according to the angle index.

[0309] In the embodiment of the present application, when deriving a virtual intra-frame prediction mode for the geometric partitioning mode (GPM), the GPM prediction block is obtained by combining prediction blocks of different motions. Therefore, it may contain the content of two objects. Generally, it is difficult to perfectly predict the boundary between the two objects. Therefore, a large residual may exist at the boundary between the two objects, and the direction of this residual is consistent with the GPM "partitioning" direction. Therefore, for GPM, the GPM "partitioning" mode can be used to determine the virtual intra-frame prediction mode.

[0310] In the embodiments of the present application, the demarcation line can be considered to be a line consisting of points with the same weight in the region where the weight changes in the GPM weight matrix. Alternatively, it can be considered to be a line consisting of points with the median weight, which may not be located at an integer pixel position. For example, for weights ranging from 0 to 8, the median weight can be 4. Figure 40 shows a schematic diagram of the demarcation line of a GPM model. As shown in Figure 40, the bold solid line is the demarcation line described herein.

[0311] In fact, the weight of GPM is derived based on the dividing line. The following examples take some processes of GPM in some technologies as examples. The following merge_gpm_partition_idx[xCb][yCb] is used to determine the "division", which is the weight derivation mode mentioned in the embodiment of this application. According to merge_gpm_partition_idx[xCb][yCb], Table 6 is used to determine the "division" angle index variable angleIdx and distance index variable distanceIdx of GPM. Among them, the angle index variable angleIdx and the distance index variable distanceIdx can be considered as variables for determining the dividing line, which respectively determine the angle and offset of the dividing line.

[0312] Table 6 provides an example of the correspondence between angleIdx, distanceIdx, and on merge_gpm_partition_idx, as follows.

[0313] Table 6

[0314] Because all three color components (e.g., Y, Cb, and Cr) can use GPM, the standard text separates the process of generating the GPM prediction sample matrix from a component into a subprocess, namely the GPM weighted prediction process (Weighted Sample Prediction Process for Geometric Partitioning Mode). This process is called for all three color components, but with different parameters. Here, only the luma component is used as an example. The prediction matrix predSamplesL[xL][yL] for the current luma block (where xL = 0..cbWidth-1 and yL = 0..cbHeight-1) is derived from the GPM weighted prediction process. Here, nCbW is set to cbWidth, nCbH is set to cbHeight, and the prediction sample matrices predSamplesLAL and predSamplesLBL for the two prediction modes, along with angleIdx and distanceIdx, are used as input.

[0315] The following is the process of deriving the weighted prediction process of GPM:

[0316] The inputs to this process are:

[0317] - The width of the current block nCbW and the height of the current block nCbH;

[0318] - 2 (nCbW)x(nCbH) prediction sample matrices predSamplesLA and predSamplesLB;

[0319] - GPM's "division" angle index variable angleIdx;

[0320] - GPM distance index variable distanceIdx;

[0321] - Component index variable cIdx. Since this embodiment only uses the luminance component as an example, cIdx is 0, indicating the luminance component.

[0322] The output of this process is the (nCbW)×(nCbH) GPM prediction sample matrix pbSamples.

[0323] The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived as follows:

[0324] nW=(cIdx==0)? nCbW:nCbW*SubWidthC;

[0325] nH=(cIdx==0)? nCbH:nCbH*SubHeightC;

[0326] shift1 = Max(5,17-BitDepth), where BitDepth is the bit depth of the codec;

[0327] offset1 = 1 << (shift1 - 1);

[0328] displacementX=angleIdx;

[0329] displacementY=(angleIdx+8)%32;

[0330] partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1;

[0331] shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1;

[0332] The variables offsetX and offsetY are derived as follows:

[0333] - If the value of shiftHor is 0:

[0334] offsetX=(-nW)>>1;

[0335] offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3));

[0336] - Otherwise (i.e. the value of shiftHor is 1):

[0337] offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3);

[0338] offsetY=(-nH)>>1;

[0339] The prediction sample matrix pbSamples[x][y] (where x=0..nCbW-1, y=0..nCbH-1) is derived as follows:

[0340] - The variables xL and yL are derived as follows:

[0341] xL=(cIdx==0)? x:x*SubWidthC;

[0342] yL=(cIdx==0)? y:y*SubHeightC;

[0343] - The variable wValue representing the weight of the prediction sample at the current position is derived as follows: wValue is the weight of the prediction value predSamplesLA[x][y] of the prediction matrix of the first prediction mode at point (x, y), and (8-wValue) is the weight of the prediction value predSamplesLB[x][y] of the prediction matrix of the first prediction mode at point (x, y).

[0344] Table 7 provides an example definition of the distance matrix disLut. Thus, the value of disLut can be determined according to Table 7.

[0345] Table 7

[0346] Here, weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+(((yL+offsetY)<<1)+1)*disLut[displacementY];

[0347] weightIdxL=partFlip? 32+weightIdx:32-weightIdx;

[0348] wValue=Clip3(0,8,(weightIdxL+4)>>3);

[0349] - The values ​​of the predicted samples are derived as follows:

[0350] pbSamples[x][y]=Clip3(0,(1<<BitDepth)-1,(predSamplesLA[x][y]*wValue+predSamplesLB[x][y]*(8-wValue)+offset1)> >shift1).

[0351] It's important to note that the standard text derives a weight value wValue for each position, then calculates the GPM prediction value pbSamples[x][y]. While this approach doesn't require the weight wValue to be expressed as a matrix, it's understandable that if the wValue values ​​for each position are stored in a matrix, it becomes a weight matrix. The principle is the same whether weights are calculated for each point individually and then added together to obtain the GPM prediction value, or all weights are calculated and then weighted together to obtain the GPM prediction sample matrix. The term weight matrix is ​​used in many descriptions throughout this article for easier understanding and more intuitive visualization. However, the concept can also be expressed in terms of the weights at each position. For example, the weight matrix derivation mode can also be referred to as the weight derivation mode.

[0352] In this way, according to the derivation process of the weight wValue, it can be seen that wValue is derived based on angleIdx and distanceIdx. Therefore, when determining the intra-frame prediction mode corresponding to the dividing line, you can also first determine angleIdx, and then determine its corresponding intra-frame angle prediction mode based on angleIdx. Because according to Table 6 above, it can also be seen that multiple weight derivation modes correspond to one angleIdx. A possible correspondence between angleIdx and intra-frame angle prediction mode is shown in Table 8. It can be seen that some angleIdx corresponds to 0, that is, because these angleIdx are not used in GPM, that is, as shown in the example of 64 weights in Figure 10. It should be understood that if some angleIdx changes in a certain version, such as more angleIdx is used in the future, or the intra-frame angle prediction mode changes, such as there are more intra-frame prediction modes in the future, then this correspondence table can also change accordingly, and there is no specific limitation here.

[0353] Table 8

[0354] Furthermore, in an embodiment of the present application, the texture feature index of the current block may also directly copy the texture feature index of the reference block. In some embodiments, determining the texture feature index of the current block may further include: determining a virtual intra prediction mode of the current block based on the intra prediction mode of the reference block or the virtual intra prediction mode of the reference block, or determining the texture feature index of the current block based on the texture feature index of the reference block. If the reference block of the current block has an intra-frame decoded block, then the intra-frame decoded block has an intra prediction mode, and the intra prediction mode of the reference block may be used as the virtual intra prediction mode of the current block. If the reference block of the current block contains multiple intra-frame decoded blocks, the intra prediction mode of a certain position may be determined based on the coordinates, for example, the intra prediction mode of the reference block corresponding to the center position of the current block may be used as the virtual intra prediction mode of the current block. A virtual intra prediction mode may be saved for each inter-frame decoded block. If the reference block of the current block is an inter-frame decoded block, then it may also find a virtual intra prediction mode. Virtual intra-frame prediction modes can also be stored at a certain granularity, for example, each 4×4 pixel is a minimum storage unit, and each minimum storage unit shares the same intra-frame prediction mode or virtual intra-frame prediction mode. If the reference block of the current block contains multiple 4×4 minimum storage units, the (virtual) intra-frame prediction mode of a certain position can be determined based on the coordinates. For example, the (virtual) intra-frame prediction mode of the minimum storage unit of the reference block corresponding to the center position of the current block is used as the virtual intra-frame prediction mode of the current block.

[0355] In this way, after the virtual intra-frame angular prediction mode (ie, the texture feature index) is determined, the transformation kernel group of NSPT / LFNST can be determined according to the texture feature index.

[0356] Furthermore, in embodiments of the present application, a candidate list may be constructed to determine a virtual intra-frame angle prediction mode. Therefore, in some embodiments, determining the texture feature index of the current block may further include: constructing a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; decoding the bitstream to determine the feature index sequence number of the current block; and determining the texture feature index of the current block based on the candidate list and the feature index sequence number. The feature index sequence number represents the number of the texture feature index of the current block in the candidate list.

[0357] It should be noted that the aforementioned embodiment mentions the use of the prediction block of the current block or the reference block or the reconstructed image around the current block to derive a virtual intra-frame prediction mode. In a specific embodiment, an intra-frame prediction mode with the largest gradient strength value can be selected as the virtual intra-frame prediction mode. In addition, a step can be added to construct a candidate list, that is, a candidate list of virtual intra-frame prediction modes, or a candidate list of feature indexes. Then a syntax element is used to write in the bitstream to indicate which candidate is finally selected. The syntax element used here is the feature index number of the current block, which can be represented by lfnst_nspt_feature_idx.

[0358] It should also be noted that the value of lfnst_nspt_feature_idx can be an integer such as 0, 1, 2, or 3. For example, if the value of lfnst_nspt_feature_idx is 0, the first element of the candidate list can be selected; if lfnst_nspt_feature_idx is 1, the second element of the candidate list can be selected.

[0359] In some embodiments, constructing a candidate list may include: sorting at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity cumulative value, and determining a preset number of reference texture feature indexes with the highest sorting; and constructing a candidate list based on the preset number of reference texture feature indexes with the highest sorting.

[0360] In some embodiments, constructing a candidate list may include: determining a first texture feature index corresponding to the maximum gradient intensity accumulated value in a texture feature statistics table, and determining a second texture feature index corresponding to the geometric division mode of the current block; and constructing a candidate list based on the first texture feature index and the second texture feature index.

[0361] That is to say, in an embodiment of the present application, an example of constructing a candidate list is to still follow the above-mentioned method of calculating the gradient strength, and select the top N intra-frame prediction modes (texture feature indexes) according to the gradient strength from large to small to form a candidate list. Among them, the value of N may be 2, 3, 4, etc. Another example is to assume that the value of N is 2, that is, the intra-frame prediction mode (texture feature index) with the largest gradient strength is the first element of the candidate list, and the intra-frame prediction mode (texture feature index) with the second largest gradient strength is the second element of the candidate list. Another example is that for GPM, the first element of the candidate list can be set to the intra-frame prediction mode (texture feature index) corresponding to the "division" mode of GPM, and the second element can be set to the intra-frame prediction mode (texture feature index) with the largest gradient strength, or vice versa; no specific limitation is made here.

[0362] In some embodiments, constructing the candidate list may further include: determining a reference block of the current block; and constructing the candidate list according to a texture feature index corresponding to at least one candidate position in the reference block.

[0363] That is, in an embodiment of the present application, a candidate list is constructed based on the intra-frame prediction mode (texture feature index) of the reference block. For example, a candidate list is constructed based on the intra-frame prediction mode (texture feature index) of the minimum storage unit of 4×4 corresponding to certain positions in the reference block. The coordinates of the upper left corner of the current block are (x, y), the width of the current block is nCbW, the height of the current block is nCbH, the center point posC of the current block is (x+nCbW / 2, y+nCbH / 2), the upper left corner is posTL(x, y), the upper right corner is posTR(x+nCbW-1, y), the lower left corner is posBL(x, y+nCbH-1), and the lower right corner is posBR(x+nCbW-1, y+nCbH-1). The candidate list is constructed using the intra-frame prediction mode (texture feature index) of the minimum storage unit corresponding to posC, posTL, posTR, posBL, and posBR in sequence. Here, the candidate position can be at least one of posC, posTL, posTR, posBL, and posBR, but is not limited to this.

[0364] It should also be noted that when constructing the list, the decoder needs to ensure that each item in the candidate list is not repeated. If the available intra-frame prediction mode (texture feature index) cannot fill the list, a default intra-frame prediction mode (texture feature index) can be added, such as the horizontal and vertical intra-frame prediction modes (texture feature indexes).

[0365] It should also be noted that this method is applicable not only to inter-frame prediction but also to intra-frame prediction. If N is 2, only a single binary symbol is required; if N is greater than 2, a truncated unary code can be used. Here, all binary symbols can be decoded using the CABAC context model.

[0366] In this way, after the candidate list is constructed, the virtual intra-frame angle prediction mode (ie, the texture feature index of the current block) can be determined according to the feature index sequence number obtained from the decoded code stream.

[0367] S3902: Determine a transformation kernel group of the current block according to the texture feature index.

[0368] S3903: Determine a transformation core of the current block according to the transformation core group.

[0369] It should be noted that after determining the texture feature index of the current block, the transform kernel group of the current block can be determined based on the correspondence between the texture feature index and the transform kernel group. For example, some technologies use 4 transform kernel groups for LFNST. The correspondence between intra-frame prediction modes and transform kernel groups is detailed in Table 4. Some technologies use LFNST with more transform kernel groups, for example, 35. The correspondence between intra-frame prediction modes and transform kernel groups is detailed in Table 5.

[0370] In addition, each transformation core group may include at least two transformation cores. For example, a transformation core group may include two transformation cores, or three transformation cores, or even four optional transformation cores, or a larger number of optional transformation cores, which are not specifically limited here.

[0371] In some embodiments, referring to FIG. 41 , after step S3902, the method may further include:

[0372] S4101: Decode the code stream and determine the value of the first syntax identification information of the current block.

[0373] S4102: When the first syntax identification information indicates that the current block uses the first transform mode, determine a transform core index of the current block, and determine a transform core of the current block according to the transform core group and the transform core index.

[0374] It should be noted that, in the embodiment of the present application, the first syntax identification information can be represented by lfnst_nspt_idx. The first syntax identification information can be used to indicate whether the current block uses the first transform mode. When the current block uses the first transform mode, the value of the first syntax identification information can also be used to indicate the transform core index used by the current block.

[0375] It should also be noted that in an embodiment of the present application, the first transform mode can be LFNST transform or NSPT transform. That is, lfnst_nspt_idx is used to indicate whether the current block uses LFNST transform or NSPT transform, and when the current block uses LFNST transform or NSPT transform, the value of lfnst_nspt_idx can also be used to indicate the transform core index used by the current block. Among them, whether the current block uses LFNST transform or NSPT transform can be determined based on the size parameter of the current block. For example, if the size parameter of the current block is small, then it can be determined that lfnst_nspt_idx is used to indicate whether the current block uses NSPT transform and the transform core index of the corresponding NSPT used; if the size parameter of the current block is large, then it can be determined that lfnst_nspt_idx is used to indicate whether the current block uses LFNST transform and the transform core index of the corresponding LFNST used.

[0376] It should also be noted that, in the embodiment of the present application, the first syntax identification information lfnst_nspt_idx may be replaced by two syntax identification information, lfnst_idx and nspt_idx. lfnst_idx is used to indicate whether the current block uses LFNST transformation and the corresponding LFNST transformation core index, and nspt_idx is used to indicate whether the current block uses NSPT transformation and the corresponding NSPT transformation core index, which are not specifically limited here.

[0377] In some embodiments, when the first syntax identification information indicates that the current block uses the first transform mode, determining the transform core index of the current block may include: if the current block uses the intra-frame prediction mode, decoding the code stream to determine the transform core index of the current block; if the current block uses the inter-frame prediction mode, determining the transform core index of the current block according to the value of the first syntax identification information.

[0378] It should be noted that, in an embodiment of the present application, when the current block uses the intra-frame prediction mode, the first syntax identification information is used to indicate whether the current block uses the first transform mode; when the first syntax identification information indicates that the current block uses the first transform mode, it is also necessary to decode the code stream to determine the transform core index of the current block, and then determine the transform core of the current block based on the transform core group and the transform core index; wherein the transform core index is used to indicate the number of the transform core of the current block in the transform core group. Exemplarily, if the transform core index of the current block is 0, then the transform core of the current block is the first transform core of the transform core group; if the transform core index of the current block is 1, then the transform core of the current block is the second transform core of the transform core group; if the transform core index of the current block is 2, then the transform core of the current block is the third transform core of the transform core group.

[0379] It should also be noted that in this embodiment of the present application, when the current block uses inter-frame prediction mode, a transform core group for LFNST / NSPT has three selectable transform cores. In addition to the case where LFNST / NSPT is not used, the current block has four possible choices for LFNST / NSPT. Therefore, lfnst_nspt_idx can be used here to indicate whether the current block uses the first transform mode and the transform core index used by the current block. In this way, the transform core index of the current block can be determined based on the value of the first syntax identification information, and then the transform core group and transform core index can be used to determine the transform core of the current block. For example, if the value of the first syntax identification information is 0, it is determined that the current block does not use LFNST / NSPT; if the value of the first syntax identification information is 1, it is determined that the current block uses LFNST / NSPT, and the transform core of the current block is the first transform core of the transform core group; if the value of the first syntax identification information is 2, it is determined that the current block uses LFNST / NSPT, and the transform core of the current block is the second transform core of the transform core group; if the value of the first syntax identification information is 3, it is determined that the current block uses LFNST / NSPT, and the transform core of the current block is the third transform core of the transform core group. That is, in this embodiment of the present application, the value of lfnst_nspt_idx can be 0, 1, 2, 3, etc.

[0380] It should also be noted that, in an embodiment of the present application, the first syntax identification information lfnst_nspt_idx can also be replaced by two other syntax identification information. Among them, one syntax identification information is used to indicate whether the current block uses LFNST / NSPT, and the other syntax identification information is used to indicate the corresponding transform core index when the current block uses LFNST / NSPT. In this way, two syntax elements need to be transmitted in the bitstream, resulting in a large bitstream overhead. In this case, for the case where the transform core index needs to be transmitted in the bitstream, if there is only one transform core in the transform core group, then there is no need to transmit the transform core index at this time. Specifically, when the current block uses LFNST / NSPT, the only transform core in the transform core group can be directly used as the transform core of the current block.

[0381] Furthermore, with respect to the case where the texture feature index is determined through a candidate list, in some embodiments, the method may further include: decoding the code stream to determine the value of the first syntax identification information of the current block; and when the first syntax identification information indicates that the current block uses the first transform mode, executing the step of decoding the code stream to determine the feature index sequence number of the current block.

[0382] That is, in this embodiment of the present application, the first syntax identification information is represented by lfnst_nspt_idx, and the feature index number is represented by lfnst_nspt_feature_idx. Here, lfnst_nspt_feature_idx can be used to select a virtual intra-frame prediction mode or texture feature index. For example, if lfnst_nspt_feature_idx is 0, the first element of the candidate list is selected; if lfnst_nspt_feature_idx is 1, the second element of the candidate list is selected. In addition, lfnst_nspt_feature_idx can also be parsed here when the current block uses LFNST or NSPT. Specifically, if the current block does not use LFNST / NSPT, lfnst_nspt_feature_idx is not parsed. For example, since lfnst_nspt_idx is used to indicate whether the current block uses LFNST / NSPT and which transform core is selected in the LFNST / NSPT transform core group, if lfnst_nspt_idx is 0, it means that the current block does not use LFNST / NSPT, in which case there is no need to parse lfnst_nspt_feature_idx; otherwise, if lfnst_nspt_idx is not 0, it means that the current block uses LFNST / NSPT, in which case lfnst_nspt_feature_idx can be parsed. It should be noted that this method is applicable not only to inter-frame prediction, but also to intra-frame prediction, without specific limitation here.

[0383] S3904: Determine the transformation coefficients of the current block, and perform inverse transformation on the transformation coefficients of the current block according to the transformation kernel to determine a residual block of the current block.

[0384] It should be noted that, in the embodiment of the present application, determining the transformation coefficient of the current block may include: decoding the code stream to determine the quantization coefficient of the current block; and dequantizing the quantization coefficient of the current block to determine the transformation coefficient of the current block.

[0385] It should also be noted that, in an embodiment of the present application, when performing an inverse transform on the transform coefficients of the current block according to the transform kernel to determine the residual block of the current block, it can include: if the size parameter of the current block meets the first condition, then performing an inverse transform of the inseparable basic transform on the transform coefficients of the current block according to the transform kernel to determine the residual block of the current block; if the size parameter of the current block meets the second condition, then performing an inverse transform of the low-frequency inseparable transform on the transform coefficients of the current block according to the transform kernel to determine the transform block of the current block; and performing an inverse transform of the discrete cosine transform on the transform block of the current block to determine the residual block of the current block.

[0386] Here, the size parameter of the current block satisfies the first condition, including: the size parameter of the current block is relatively small, for example, the size parameter of the current block is less than a certain threshold. In other words, for relatively small blocks, an NSPT transform kernel is used, i.e., an inverse NSPT transform is performed on the transform coefficients of the current block according to the transform kernel to determine a residual block for the current block.

[0387] Here, the size parameter of the current block satisfies the second condition, including: the size parameter of the current block is relatively large, for example, the size parameter of the current block is greater than a certain threshold. In other words, for relatively large blocks, an LFNST transform kernel is used. Specifically, an inverse LFNST transform is performed on the transform coefficients of the current block based on the transform kernel to determine the transform block of the current block; and an inverse DCT2 transform is performed on the transform block of the current block to determine the residual block of the current block.

[0388] It should also be noted that in the embodiments of the present application, the "inverse transformation" of the transformation coefficients by the decoding end may also be referred to as "transformation" in the standard text. The "transformation" and "inverse transformation" in this article correspond to two opposite processes. For example, if the "transformation" converts the numerical value of the spatial domain to the coefficient of the frequency domain, then the "inverse transformation" converts the coefficient of the frequency domain to the numerical value of the spatial domain. "Inverse" is relative to "positive", and they are essentially both transformations. It should be noted that if the standard only stipulates decoding, then the "transformation" in the standard text is the decoding part, specifically referring to the "inverse transformation" in this article.

[0389] In some embodiments, referring to FIG. 42 , after step S3904, the method may further include:

[0390] S4201: Perform inter-frame prediction on the current block to determine a prediction block for the current block.

[0391] S4202: Determine a reconstructed block of the current block according to the prediction block of the current block and the residual block of the current block.

[0392] It should be noted that in the embodiment of the present application, for step S4201, this step can be performed in parallel with steps S3901 to S3903, or it can be performed before steps S3901 to 3903. The order of the steps is not specifically limited here.

[0393] It should also be noted that, in the embodiment of the present application, after the prediction block of the current block is determined, an addition operation may be performed on the prediction block of the current block and the residual block of the current block to determine the reconstructed block of the current block.

[0394] Simply put, after determining the prediction block, the decoder derives a virtual intra-frame prediction mode based on the prediction block. The decoder then determines the NSPT / LFNST transform core group based on the virtual intra-frame prediction mode. If a transform core group has multiple selectable transform cores, the decoder determines the transform core by decoding the lfnst_nspt_idx field in the bitstream. The decoding of lfnst_nspt_idx in the bitstream is independent of the process of determining the transform core group. Quantized coefficients are obtained from the bitstream through entropy decoding.

[0395] If it is NSPT transformation, the quantized coefficients are inversely quantized to obtain decoded transform coefficients, the decoded transform coefficients are inversely NSPT transformed to obtain decoded residual blocks, and finally a reconstructed block is obtained based on the decoded residual block and the prediction block.

[0396] If it is LFNST transform, the quantized coefficients are inversely quantized to obtain decoded transform coefficients, the decoded transform coefficients are inversely LFNST transformed, and then inverse DCT2 transformed to obtain a decoded residual block, and finally a reconstructed block is obtained based on the decoded residual block and the prediction block.

[0397] It is understandable that embodiments of the present application can use a high-level syntax to control the switching of the present technical solution. In some embodiments, the method further includes: decoding the bitstream and determining the value of the second syntax identification information; when the second syntax identification information indicates that the current sequence allows the use of the first transform mode, performing the step of determining the texture feature index of the current block; wherein the current sequence includes the current block.

[0398] It should be noted that, in the embodiment of the present application, the second syntax identification information can be represented by sps_inter_lfnst_nspt_enabled_flag, and the second syntax identification information is a syntax element in a sequence parameter set (SPS).

[0399] It should also be noted that, in an embodiment of the present application, if the value of the second grammar identification information is the first value, it is determined that the second grammar identification information indicates that the current sequence allows the use of the first transformation mode; if the value of the second grammar identification information is the second value, it is determined that the second grammar identification information indicates that the current sequence does not allow the use of the first transformation mode.

[0400] In an embodiment of the present application, the first value is different from the second value, and the first value and the second value may be in parameter form or in digital form. Specifically, the first syntax identification information may be a parameter written in the profile, or may be the value of a flag, which is not specifically limited here. Exemplarily, the first value may be 1 and the second value may be 0; or, the first value may be 0 and the second value may be 1; or, the first value may be true and the second value may be false; or, the first value may be false and the second value may be true. In a specific embodiment, the first value is 1 and the second value is 0.

[0401] That is to say, the embodiment of the present application can use a high-level syntax to control the switch of the present technical solution. For example, a sequence-level flag is used, such as adding a syntax element sps_inter_lfnst_nspt_enabled_flag in the sequence parameter set. If the value of sps_inter_lfnst_nspt_enabled_flag is 1, the current sequence allows the use of this technical solution; if the value of sps_inter_lfnst_nspt_enabled_flag is 0, the current sequence does not allow the use of this technical solution. Among them, when the use of this technical solution is allowed, the decoder needs to decode the transform core index of LFNST or NSPT when decoding inter-frame coded blocks, and perform inverse transform processing of LFNST or NSPT. Of course, the embodiment of the present application can also set separate syntax elements for LFNST and NSPT, namely sps_inter_lfnst_enabled_flag and sps_inter_nspt_enabled_flag. sps_inter_lfnst_enabled_flag is used to indicate whether the current sequence is allowed to use LFNST, and sps_inter_nspt_enabled_flag is used to indicate whether the current sequence is allowed to use NSPT.

[0402] Of course, in the embodiment of the present application, the same flag, such as sps_lfnst_nspt_enabled_flag, can be set for both inter-frame LFNST / NSPT and intra-frame LFNST / NSPT. For example, if the value of sps_inter_lfnst_nspt_enabled_flag is 0, it can be determined whether the current sequence allows the use of LFNST and NSPT; if the value of sps_inter_lfnst_nspt_enabled_flag is 1, it can be determined that the current sequence allows intra-frame decoded blocks to use LFNST and NSPT; if the value of sps_inter_lfnst_nspt_enabled_flag is 2, it can be determined that the current sequence allows inter-frame decoded blocks to use LFNST and NSPT.

[0403] Furthermore, in some embodiments, the method further includes: decoding the code stream to determine the value of the second syntax identification information; when the second syntax identification information indicates that the current sequence allows the use of the first transform mode, decoding the code stream to determine the value of the third syntax identification information; when the third syntax identification information indicates that the current image allows the use of the first transform mode, executing the step of determining the texture feature index of the current block.

[0404] In the embodiment of the present application, the current sequence may include a current picture, and the current picture includes a current block. The third syntax identification information may be represented by ph_inter_lfnst_nspt_enabled_flag, and the third syntax identification information is a syntax element at the picture level.

[0405] It should also be noted that, in an embodiment of the present application, if the value of the third grammar identification information is the first value, it is determined that the third grammar identification information indicates that the current image allows the use of the first transformation mode; if the value of the third grammar identification information is the second value, it is determined that the third grammar identification information indicates that the current image does not allow the use of the first transformation mode.

[0406] Furthermore, in some embodiments, the method further includes: decoding the bitstream to determine a value of the second syntax identification information; when the first syntax identification information indicates that the current sequence allows the use of the first transform mode, decoding the bitstream to determine a value of the fourth syntax identification information; when the fourth syntax identification information indicates that the current slice allows the use of the first transform mode, executing the step of determining the texture feature index of the current block.

[0407] In the embodiment of the present application, the current sequence may include a current slice, and the current slice includes a current block. The fourth syntax identification information may be represented by sh_inter_lfnst_nspt_enabled_flag, and the fourth syntax identification information is a syntax element at the slice level.

[0408] It should also be noted that, in an embodiment of the present application, if the value of the fourth grammar identification information is the first value, it is determined that the fourth grammar identification information indicates that the current slice allows the use of the first transformation mode; if the value of the fourth grammar identification information is the second value, it is determined that the fourth grammar identification information indicates that the current slice does not allow the use of the first transformation mode.

[0409] In an embodiment of the present application, the first value is different from the second value, and the first value and the second value may be in parameter form or in digital form. Specifically, the first syntax identification information may be a parameter written in the profile, or may be the value of a flag, which is not specifically limited here. Exemplarily, the first value may be 1 and the second value may be 0; or, the first value may be 0 and the second value may be 1; or, the first value may be true and the second value may be false; or, the first value may be false and the second value may be true. In a specific embodiment, the first value is 1 and the second value is 0.

[0410] That is to say, in an embodiment of the present application, a high-level syntax can be used to control the switch of this technical solution. For example, a sequence-level flag is used, such as adding a syntax element sps_inter_lfnst_nspt_enabled_flag in the sequence parameter set SPS. If the value of sps_inter_lfnst_nspt_enabled_flag is 1, the current sequence allows the use of this technical solution. If the value of sps_inter_lfnst_nspt_enabled_flag is 0, the current sequence does not allow the use of this technical solution. If this technical solution is allowed, the decoder needs to decode lfnst_nspt_idx when decoding inter-frame coded blocks and perform LFNST or NSPT processing. Of course, separate flags can also be set for LFNST and NSPT, namely sps_inter_lfnst_enabled_flag and sps_inter_nspt_enabled_flag.

[0411] Furthermore, embodiments of the present application may also use syntax elements at other levels to achieve more flexible control, such as flags in the Picture Parameter Set (PPS), or flags in the picture header or slice header. For example, the sequence parameter set (SPS) determines whether the current sequence can use this technical solution. If the current sequence uses this technical solution, a sh_inter_lfnst_nspt_enabled_flag in the slice header is set to determine whether the current slice uses this technical solution, providing greater flexibility. Because for inter-frame coding, especially RA, the QPs of different images or slices vary greatly. Among them, images with a low GOP temporal level usually have a lower QP, while images with a higher GOP temporal level usually have a higher QP. This technical solution does not significantly improve compression efficiency when the QP is particularly high or particularly low, so a flag in the picture header or slice header can be set for more flexible control.

[0412] It should be noted that in the embodiments of the present application, LFNST and NSPT can be applied to inter-frame predicted blocks. For blocks that are not well predicted between frames, that is, blocks with large residuals, compared with the related art MTS, they can better decorrelate and improve compression efficiency.

[0413] It should also be noted that, in the embodiment of the present application, in addition to applying LFNST and NSPT to inter-frame predicted blocks, they can also be applied to intra block copy (IBC) blocks.

[0414] This embodiment provides a decoding method for determining a texture feature index of a current block; determining a transform kernel group of the current block based on the texture feature index; determining a transform kernel of the current block based on the transform kernel group; determining a transform coefficient of the current block, and inversely transforming the transform coefficient of the current block based on the transform kernel to determine a residual block of the current block; and then determining a reconstructed block of the current block based on the prediction block and the residual block of the inter-frame prediction. In other words, a correspondence between the texture feature index and the transform kernel group is established here, replacing the scheme of matching the transform kernel group based on the intra-frame prediction mode in the related art, so that LFNST and NSPT can also be applied to the inter-frame prediction mode, thereby improving not only the compression efficiency but also the encoding and decoding performance for blocks that are difficult to predict in the inter-frame prediction mode, i.e., blocks with large residuals.

[0415] In another embodiment of the present application, see Figure 43, which shows a schematic flow chart of an encoding method provided by an embodiment of the present application. As shown in Figure 43, the method may include:

[0416] S4301: Determine the texture feature index of the current block.

[0417] It should be noted that in the embodiments of the present application, the method is applied to an encoder. Specifically, based on the structure of encoder 100 shown in FIG37 , the encoding method of the embodiments of the present application is primarily applied to inter-frame coded blocks. Specifically, when the inter-frame coded blocks use inter-frame prediction mode, the optimization scheme proposed here is mainly for the NSPT and LFNST transforms in inter-frame prediction mode to improve the compression efficiency of inter-frame prediction.

[0418] Here, NSPT and LFNST are both transformations that can efficiently process textures of various angles. There may be multiple transformation kernels, and one transformation kernel may be specially optimized for a certain specific angle texture. In addition to angle textures, NSPT and LFNST also include transformation kernels for processing gradient textures. In fact, these transformation kernels can also be said to be trained KL transformations. In other words, both NSPT and LFNST can have multiple transformation kernels, each designed for a specific texture. Specific textures include angle textures, gradient textures, etc. In addition, gradient textures can be further extended to horizontal gradient textures, vertical gradient textures, oblique gradient textures, etc. Furthermore, this technical solution is not limited to being used only for inseparable transformations such as NSPT and LFNST, but can also be applied to separable transformations optimized for specific textures.

[0419] It should also be noted that in the intra-frame predicted block, both NSPT and LFNST include multiple transform kernel groups, and each intra-frame prediction mode can correspond to a transform kernel group. However, the inter-frame predicted block does not have an intra-frame prediction mode, which is a problem in applying LFNST and NSPT to inter-frame prediction. In an embodiment of the present application, a virtual intra-frame prediction mode (index) can be derived based on the inter-frame predicted block, or it can be called a texture feature index. For example, the DC mode and the PLANAR mode correspond to gradient texture features, and a certain angle prediction mode corresponds to the texture features of this angle. That is to say, in an embodiment of the present application, the texture feature index can avoid the occurrence of intra-frame prediction mode in "inter-frame" on the one hand, and on the other hand, it is more conducive to possible expansion. For example, an intra-frame prediction mode can correspond to multiple texture features, such as the DC mode can correspond to horizontal gradient texture, vertical gradient texture, oblique gradient texture, etc.

[0420] In this embodiment, a virtual intra-frame prediction mode (or "texture feature index") is proposed to adapt to the NSPT and LFNST transform schemes used in inter-frame prediction. This virtual intra-frame prediction mode is used only to select the transform kernel group for NSPT or LFNST. The derivation of the texture feature index is described in detail below.

[0421] In some embodiments, determining the texture feature index of the current block may include: determining candidate pixels for deriving the texture feature index; and determining the texture feature index of the current block according to the candidate pixels.

[0422] In a possible implementation, for candidate pixels, a prediction block of the current block may be determined; and at least part of the pixels in the prediction block are used as candidate pixels.

[0423] In the embodiment of the present application, if a certain texture exists in the prediction block, it can be considered that the residual block has a texture with the same characteristics. In this way, the candidate pixels used for inter-frame texture feature index derivation can be all pixels in the prediction block or part of the pixels in the prediction block.

[0424] In another possible implementation, for candidate pixels, adjacent pixels of a reconstructed area of ​​the current block may be determined; and the adjacent pixels of the reconstructed area may be used as candidate pixels.

[0425] In the embodiment of the present application, the candidate pixels used for inter-frame texture feature index derivation can be pixels adjacent to the reconstructed area of ​​the current block, such as the reconstructed areas to the left and right of the current block. Because the reconstructed areas to the left and above are not the current block but are adjacent to the current block, for example, if the texture is connected, they can be used to estimate the texture of the current block to a certain extent.

[0426] In yet another possible implementation, more pixels are considered. For candidate pixels, adjacent pixels in the reconstructed area and at least part of the pixels in the prediction block may be used as candidate pixels.

[0427] In an embodiment of the present application, the candidate pixels used for inter-frame derivation of texture feature indexes may also be the predicted block of the current block and the adjacent pixels of the reconstructed areas to the left and above the current block. In this way, more pixels are used to derive the texture feature index, making the derived texture feature index more accurate.

[0428] In another possible implementation, considering the pipeline length of the hardware, for candidate pixels, a reference block of the current block may be determined; and at least part of the pixels in the reference block may be used as candidate pixels.

[0429] In an embodiment of the present application, for the current block, the texture feature index can only be derived after the prediction block is obtained, and the transformation kernel of LFNST / NSPT can be determined after the texture feature index is determined, and then the transformation and subsequent encoding processes can be performed. Here, if a reference block is used to derive the texture feature index, theoretically, the process of generating the prediction block and the process of deriving the texture feature index can be performed in parallel, which is shorter than the pipeline using the prediction block. Therefore, it is also possible to use the reference block to derive the texture feature index, or to derive the texture feature index synchronously during the process of generating the prediction block, thereby shortening the pipeline length.

[0430] In some embodiments, for the reference block of the current block, the reference block may be determined to be an integer-pixel reference block; or, the reference block may be determined to be a fractional-pixel reference block.

[0431] In one possible implementation, integer-pixel reference blocks can be used directly as reference blocks, as there is no significant difference in texture direction. For example, for a bidirectionally predicted inter-frame block, a virtual intra-frame prediction mode can be derived based on the integer-pixel reference blocks.

[0432] In another possible implementation, the reference block may also use a pixel-by-pixel reference block that has been subjected to an interpolation filter. Specifically, two reference image blocks are determined for bidirectional prediction of the current block; pixel-by-pixel interpolation filtering is performed on the two reference image blocks to determine two pixel-by-pixel reference image blocks; and a weighted combination of the two pixel-by-pixel reference image blocks is performed to determine the reference block for the current block.

[0433] For example, for a bidirectionally predicted inter-frame block, two reference blocks are first subjected to pixel-by-pixel interpolation filtering, and then the two pixel-by-pixel reference blocks are weightedly combined. After obtaining the two interpolated filtered reference blocks, a weighted average of the interpolated filtered reference blocks can be used to obtain a prediction value, and a texture feature index can be derived from the interpolated filtered reference blocks.

[0434] It should also be noted that, in the embodiment of the present application, the number of candidate pixels used to derive the texture feature index may be at least one, such as 1, 2, 3 or more. In some embodiments, the number of candidate pixels may be determined based on the size parameter of the current block.

[0435] That is to say, when determining the texture feature index of the current block, the number of candidate pixels used can be determined by the size parameter of the current block. For example, if the size of the current block is small, then all available pixels can be counted; if the size of the current block is large, then the current block can be downsampled and counted, such as counting one pixel out of every 2, or 4, or 8 pixels in the horizontal and / or vertical directions. Alternatively, if the size of the current block in one of the horizontal or vertical directions is less than or equal to 8, then all available pixels in that direction are counted; otherwise, if the size of the current block in one of the horizontal or vertical directions is less than or equal to 16, then one pixel out of every 2 pixels in that direction is counted; otherwise, one pixel out of every 4 pixels in that direction is counted, and no specific limitation is given here.

[0436] In some embodiments, determining the texture feature index of the current block based on the candidate pixels may include: determining the horizontal gradient value and the vertical gradient value of the candidate pixels; determining the texture feature index and the gradient intensity value corresponding to the candidate pixels based on the horizontal gradient value and the vertical gradient value of the candidate pixels; constructing a texture feature statistics table based on the texture feature index and the gradient intensity value corresponding to the candidate pixels; and determining the texture feature index of the current block based on the texture feature statistics table.

[0437] It should be noted that in an embodiment of the present application, when determining the texture feature index and gradient intensity value corresponding to the candidate pixel based on the horizontal gradient value and vertical gradient value of the candidate pixel, it can include: performing angle mapping based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; and performing gradient intensity calculation based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the gradient intensity value corresponding to the candidate pixel.

[0438] In a specific embodiment, performing angle mapping based on the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel may include: determining the texture feature index corresponding to the candidate pixel using a preset lookup table based on the horizontal gradient value and the vertical gradient value of the candidate pixel.

[0439] In the embodiment of the present application, the horizontal gradient value of the candidate pixel can be expressed as grad x Indicates that the vertical gradient value of the candidate pixel can be expressed as grad y In this way, according to grad x and grad y Deriving the virtual intra prediction mode can be achieved by looking up a table.

[0440] For example, if abs(grad x ) is equal to 0 and abs(grad y) is not equal to 0, then there is horizontal texture, corresponding to intra prediction mode 18 in some technologies. y ) is equal to 0 and abs(grad x ) is not equal to 0, then there is vertical texture, corresponding to the intra prediction mode 50 in some technologies. x ) and abs(grad y ) are not equal to 0, if abs(grad x ) is equal to abs(grad y ), and grad x and grad y The symbols are the same, corresponding to intra prediction mode 34 in some technologies. x ) is equal to 2 times abs(grad y ), and grad x and grad y The symbols are the same, corresponding to the intra-frame prediction mode 40 in some technologies. In addition, other situations can be determined by looking up the table according to the same principle.

[0441] In a specific embodiment, performing gradient strength calculation based on the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel may include: performing an addition operation on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient strength value corresponding to the candidate pixel.

[0442] Here, the gradient intensity value corresponding to the candidate pixel can be recorded as amp. For example, amp=abs(grad x )+abs(grad y ).

[0443] It should be noted that, in the embodiment of the present application, the horizontal gradient value and the vertical gradient value of the candidate pixel can be calculated using the Sobel operator. For example, for the Sobel operator, the specific calculation is as follows:

[0444] Operator for horizontal gradient value:

[0445] Operator for vertical gradient value:

[0446] So, suppose the pixel value at pixel position (x, y) is P x,y , then the horizontal gradient value grad x And the vertical gradient value grad y The calculation of grad is as follows: x =P x+1,y-1 +2*P x+1,y +Px+1,y+1 -P x-1,y-1 -2*P x-1,y -P x-1,y+1 (24) grad y =P x-1,y+1 +2*P x,y+1 +P x+1,y+1 -P x-1,y-1 -2*P x,y-1 -P x+1,y-1 (25)

[0447] In some embodiments, constructing a texture feature statistics table based on the texture feature index and gradient intensity value corresponding to the candidate pixel may include: determining at least one texture feature index and at least one corresponding gradient intensity value when the number of candidate pixels is at least one; determining at least one reference texture feature index with mutually different characteristics based on the at least one texture feature index, and accumulating the gradient intensity values ​​belonging to the same reference texture feature index based on the at least one gradient intensity value to determine the gradient intensity cumulative value corresponding to the at least one reference texture feature index; constructing a texture feature statistics table based on the at least one reference texture feature index and the gradient intensity cumulative value corresponding to the at least one reference texture feature index.

[0448] That is to say, in an embodiment of the present application, taking at least some pixels in a prediction block as candidate pixels as an example, the gradient values ​​of all or some pixels in the prediction block are calculated. Generally speaking, the horizontal gradient value and the vertical gradient value can be calculated. Here, the Sobel operator can be used to calculate the gradient value. For a certain pixel, the texture direction of the pixel can be inferred based on its horizontal gradient value and vertical gradient value. For example, if the horizontal gradient value is non-zero and the vertical gradient value is zero, then the texture of the pixel is in the vertical direction. Conversely, if the horizontal gradient value is zero and the vertical gradient value is non-zero, then the texture of the pixel is in the horizontal direction. For example, if the horizontal gradient value and the vertical gradient value are equal and not zero, then the texture of the pixel is 45 degrees. Of course, there are many other cases in the embodiment of the present application where the horizontal gradient value and the vertical gradient value are not zero, and the texture direction of the pixel can be determined based on their ratio. In this way, the gradient intensity value of each pixel can be corresponded to the corresponding texture feature index. A texture feature statistical table is constructed, and the gradient intensity value of each calculated pixel is added to the corresponding texture feature index item in the statistical table to obtain the final texture feature statistical table, and then the texture feature index of the current block can be determined based on the texture feature statistical table.

[0449] In one possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the maximum gradient intensity accumulated value in the texture feature statistics table; and determining the reference texture feature index corresponding to the maximum gradient intensity accumulated value as the texture feature index of the current block.

[0450] In another possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the maximum gradient intensity accumulated value in the texture feature statistics table; when the maximum gradient intensity accumulated value is less than a first threshold, setting the texture feature index of the current block to DC mode or PLANANR mode.

[0451] In another possible implementation, when determining the texture feature index of the current block based on the texture feature statistics table, it can include: determining the statistical sum of all gradient intensity accumulated values ​​in the texture feature statistics table; when the statistical sum is less than a second threshold, setting the texture feature index of the current block to DC mode or PLANANR mode.

[0452] That is to say, in the embodiment of the present application, the derivation of the virtual intra-frame prediction mode may also be referred to as the derivation of the texture feature index because the virtual intra-frame prediction mode (index) may also be referred to as the derivation of the texture feature index.

[0453] In an embodiment of the present application, an inter-frame prediction block can be used to derive a virtual intra-frame prediction mode. If a certain texture exists in the prediction block, it can be imagined that the residual block contains texture with the same characteristics. For example, the gradient values ​​of all or part of the pixels in the prediction block can be calculated. Generally, the horizontal gradient value and the vertical gradient value can be calculated. The Sobel operator can be used to calculate the gradient value. The corresponding gradient intensity value is then determined based on the horizontal and vertical gradient values. The gradient intensity value is then mapped to the corresponding intra-frame prediction mode, thereby constructing an intra-frame prediction mode statistics table (i.e., the aforementioned "texture feature statistics table"). The gradient intensity value of each calculated candidate pixel needs to be accumulated to the corresponding intra-frame prediction mode entry in the statistics table. After the gradient statistics are completed, one possible implementation method is to use the intra-frame prediction mode with the highest cumulative gradient intensity in the intra-frame prediction mode statistics table as the virtual intra-frame prediction mode for the current block. Alternatively, another possible implementation method is to determine that the virtual intra-frame prediction mode is the DC mode or the PLANANR mode when the cumulative gradient intensity value of the intra-frame prediction mode with the highest cumulative gradient intensity is less than a certain threshold. Alternatively, another possible implementation is to determine that the virtual intra prediction mode is the DC mode or the PLANANR mode when the sum of the accumulated gradient strength values ​​of all the counted pixels is less than a certain threshold.

[0454] In addition, similar statistical derivation of intra-frame prediction modes is required for DIMD, but the difference is that DIMD uses the surrounding reconstruction area of ​​the current block, while this solution uses the prediction block of the current block. In terms of implementation, this solution can reuse some logic with DIMD.

[0455] It's also worth noting that the pixels used to derive the virtual intra prediction mode between frames can also be derived from the reconstructed areas to the left and above of the current block, similar to the DIMD approach. Because the reconstructed areas to the left and above, while not the current block, are adjacent to it (e.g., if the texture is connected), they can be used to estimate the texture of the current block to some extent. Another possibility is to use both the prediction block of the current block and the reconstructed areas to the left and above of the current block, which increases the number of pixels available for inferring the virtual intra prediction mode. Another consideration is hardware pipeline length. For the current block, the virtual intra prediction mode can only be derived after the prediction block is obtained. Once the virtual intra prediction mode is determined, the LFNST / NSPT transform kernel can be determined, allowing for inverse transformation and subsequent processes. If a reference block is used to derive the virtual intra prediction mode, theoretically, the prediction block generation and virtual intra prediction mode derivation processes can be performed in parallel, shortening the pipeline compared to the aforementioned design. Therefore, the embodiments of the present application can also use reference blocks to derive virtual intra-frame prediction modes, or synchronously derive virtual intra-frame prediction modes in the process of generating prediction blocks. Among them, when using reference blocks, integer-pixel reference blocks can be used directly because there will be no obvious difference in texture direction. For example, for a bidirectionally predicted inter-frame block, on the one hand, a virtual intra-frame prediction mode is derived based on the integer-pixel reference block, and on the other hand, two reference blocks are subjected to pixel-by-pixel interpolation filtering, and then the two pixel-by-pixel reference blocks are weightedly combined. Specifically, pixel-by-pixel reference blocks that have been interpolated and filtered can also be used here. For example, for a bidirectionally predicted inter-frame block, it is necessary to first perform pixel-by-pixel interpolation filtering on the two reference blocks, and then the two pixel-by-pixel reference blocks are weightedly combined. Then, after obtaining the two interpolated and filtered reference blocks, on the one hand, a prediction value can be obtained by weighted averaging the interpolated and filtered reference blocks, and on the other hand, a virtual intra-frame prediction mode can be derived based on the interpolated and filtered reference blocks.

[0456] In some embodiments, determining the texture feature index of the current block may further include: determining an angle index when the current block is subjected to a geometric partitioning mode; and determining the texture feature index of the current block according to the angle index.

[0457] In the embodiment of the present application, when deriving a virtual intra-frame prediction mode for the geometric partitioning mode (GPM), the GPM prediction block is obtained by combining prediction blocks of different motions. Therefore, it may contain the content of two objects. Generally, it is difficult to perfectly predict the boundary between the two objects. Therefore, a large residual may exist at the boundary between the two objects, and the direction of this residual is consistent with the GPM "partitioning" direction. Therefore, for GPM, the GPM "partitioning" mode can be used to determine the virtual intra-frame prediction mode.

[0458] In the embodiments of the present application, the demarcation line can be considered to be a line consisting of points with the same weight in the region where the weight changes in the GPM weight matrix. Alternatively, it can be considered to be a line consisting of points with the median weight, which may not be located at an integer pixel position. For example, for weights ranging from 0 to 8, the median weight can be 4. Figure 40 shows a schematic diagram of the demarcation line of a GPM model. As shown in Figure 40, the bold solid line is the demarcation line described herein.

[0459] In fact, the weight of GPM is derived based on the dividing line. The following examples are given of some GPM processes in some technologies. The following merge_gpm_partition_idx[xCb][yCb] is used to determine the "division", which is the weight derivation mode mentioned in the embodiment of this application. According to merge_gpm_partition_idx[xCb][yCb], the aforementioned Table 6 is used to determine the "division" angle index variable angleIdx and the distance index variable distanceIdx of GPM. Among them, the angle index variable angleIdx and the distance index variable distanceIdx can be considered as variables for determining the dividing line, which respectively determine the angle and offset of the dividing line.

[0460] Because all three color components (e.g., Y, Cb, and Cr) can use GPM, the standard text separates the process of generating the GPM prediction sample matrix from a component into a subprocess, namely the GPM weighted prediction process (Weighted Sample Prediction Process for Geometric Partitioning Mode). This process is called for all three color components, but with different parameters. Here, only the luma component is used as an example. The prediction matrix predSamplesL[xL][yL] for the current luma block (where xL = 0..cbWidth-1 and yL = 0..cbHeight-1) is derived from the GPM weighted prediction process. Here, nCbW is set to cbWidth, nCbH is set to cbHeight, and the prediction sample matrices predSamplesLAL and predSamplesLBL for the two prediction modes, along with angleIdx and distanceIdx, are used as input.

[0461] The following is the process of deriving the weighted prediction process of GPM:

[0462] The inputs to this process are:

[0463] - The width of the current block nCbW and the height of the current block nCbH;

[0464] - 2 (nCbW)x(nCbH) prediction sample matrices predSamplesLA and predSamplesLB;

[0465] - GPM's "division" angle index variable angleIdx;

[0466] - GPM distance index variable distanceIdx;

[0467] - Component index variable cIdx. Since this embodiment only uses the luminance component as an example, cIdx is 0, indicating the luminance component.

[0468] The output of this process is the (nCbW)×(nCbH) GPM prediction sample matrix pbSamples.

[0469] The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived as follows:

[0470] nW=(cIdx==0)? nCbW:nCbW*SubWidthC;

[0471] nH=(cIdx==0)? nCbH:nCbH*SubHeightC;

[0472] shift1 = Max(5,17-BitDepth), where BitDepth is the bit depth of the codec;

[0473] offset1 = 1 << (shift1 - 1);

[0474] displacementX=angleIdx;

[0475] displacementY=(angleIdx+8)%32;

[0476] partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1;

[0477] shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1;

[0478] The variables offsetX and offsetY are derived as follows:

[0479] - If the value of shiftHor is 0:

[0480] offsetX=(-nW)>>1;

[0481] offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3));

[0482] - Otherwise (i.e. the value of shiftHor is 1):

[0483] offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3);

[0484] offsetY=(-nH)>>1;

[0485] The prediction sample matrix pbSamples[x][y] (where x=0..nCbW-1, y=0..nCbH-1) is derived as follows:

[0486] - The variables xL and yL are derived as follows:

[0487] xL=(cIdx==0)? x:x*SubWidthC;

[0488] yL=(cIdx==0)? y:y*SubHeightC;

[0489] The variable wValue, representing the weight of the predicted sample at the current location, is derived as follows: wValue is the weight of the predicted value predSamplesLA[x][y] of the prediction matrix of the first prediction mode at point (x, y), and (8-wValue) is the weight of the predicted value predSamplesLB[x][y] of the prediction matrix of the first prediction mode at point (x, y). Table 7 above provides an example definition of the distance matrix disLut. Therefore, the value of disLut can be determined according to Table 7.

[0490] Here, weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+(((yL+offsetY)<<1)+1)*disLut[displacementY];

[0491] weightIdxL=partFlip? 32+weightIdx:32-weightIdx;

[0492] wValue=Clip3(0,8,(weightIdxL+4)>>3);

[0493] - The values ​​of the predicted samples are derived as follows:

[0494] pbSamples[x][y]=Clip3(0,(1<<BitDepth)-1,(predSamplesLA[x][y]*wValue+predSamplesLB[x][y]*(8-wValue)+offset1)> >shift1).

[0495] It's important to note that the standard text derives a weight value wValue for each position, then calculates the GPM prediction value pbSamples[x][y]. While this approach doesn't require the weight wValue to be expressed as a matrix, it's understandable that if the wValue values ​​for each position are stored in a matrix, it becomes a weight matrix. The principle is the same whether weights are calculated for each point individually and then added together to obtain the GPM prediction value, or all weights are calculated and then weighted together to obtain the GPM prediction sample matrix. The term weight matrix is ​​used in many descriptions throughout this article for easier understanding and more intuitive visualization. However, the concept can also be expressed in terms of the weights at each position. For example, the weight matrix derivation mode can also be referred to as the weight derivation mode.

[0496] In this way, according to the derivation process of the weight wValue, it can be seen that wValue is derived based on angleIdx and distanceIdx. Therefore, when determining the intra-frame prediction mode corresponding to the dividing line, you can also first determine angleIdx, and then determine its corresponding intra-frame angle prediction mode based on angleIdx. Because according to Table 6 above, it can also be seen that multiple weight derivation modes correspond to one angleIdx. A possible correspondence between angleIdx and intra-frame angle prediction mode is shown in Table 8 above. It can be seen that some angleIdx corresponds to 0, that is, because these angleIdx are not used in GPM, that is, as shown in the example of 64 weights in Figure 10. It should be understood that if some angleIdx changes in a certain version, such as more angleIdx is used in the future, or the intra-frame angle prediction mode changes, such as there are more intra-frame prediction modes in the future, then this correspondence table can also change accordingly, and there is no specific limitation here.

[0497] Furthermore, in an embodiment of the present application, the texture feature index of the current block may also directly copy the texture feature index of the reference block. In some embodiments, determining the texture feature index of the current block may also include: determining a virtual intra-frame prediction mode of the current block based on the intra-frame prediction mode of the reference block or the virtual intra-frame prediction mode of the reference block, or determining the texture feature index of the current block based on the texture feature index of the reference block. If the reference block of the current block has an intra-frame coded block, then the intra-frame coded block has an intra-frame prediction mode, and the intra-frame prediction mode of the reference block can be used as the virtual intra-frame prediction mode of the current block. If the reference block of the current block contains multiple intra-frame coded blocks, the intra-frame prediction mode of a certain position can be determined based on the coordinates, for example, the intra-frame prediction mode of the reference block corresponding to the center position of the current block can be used as the virtual intra-frame prediction mode of the current block. A virtual intra-frame prediction mode can be saved for each inter-frame coded block. If the reference block of the current block is an inter-frame coded block, it can also find a virtual intra-frame prediction mode. Virtual intra-frame prediction modes can also be stored at a certain granularity, for example, each 4×4 pixel is a minimum storage unit, and each minimum storage unit shares the same intra-frame prediction mode or virtual intra-frame prediction mode. If the reference block of the current block contains multiple 4×4 minimum storage units, the (virtual) intra-frame prediction mode of a certain position can be determined based on the coordinates. For example, the (virtual) intra-frame prediction mode of the minimum storage unit of the reference block corresponding to the center position of the current block is used as the virtual intra-frame prediction mode of the current block.

[0498] In this way, after the virtual intra-frame angular prediction mode (ie, the texture feature index) is determined, the transformation kernel group of NSPT / LFNST can be determined according to the texture feature index.

[0499] Furthermore, in embodiments of the present application, a candidate list may be constructed to determine a virtual intra-frame angle prediction mode. Therefore, in some embodiments, determining the texture feature index of the current block may further include: constructing a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; performing cost value calculations on the preset number of candidate texture feature indexes to determine cost values ​​for each of the preset number of candidate texture feature indexes; determining a minimum cost value from the cost values ​​of the preset number of candidate texture feature indexes, and determining the candidate texture feature index corresponding to the minimum cost value as the texture feature index of the current block.

[0500] It should be noted that, in the embodiment of the present application, the preset number may be 1, 2, 3, or more. If the candidate list includes only one candidate texture feature index, then this one candidate texture feature index may be directly used as the texture feature index of the current block without performing cost calculation.

[0501] It should be noted that in the embodiment of the present application, cost values ​​are calculated for each of a preset number of candidate texture feature indices to determine a cost value for each of the preset number of candidate texture feature indices. Here, the cost value can be determined based on the cost result of Rate Distortion Optimization (RDO), the cost result of Sum of Absolute Difference (SAD), or even the cost result of Sum of Absolute Transformed Difference (SATD), but this is not limited to any of the above.

[0502] For example, taking the rate-distortion optimization method as an example, the rate-distortion cost value can be calculated according to a preset number of candidate texture feature indexes, and the cost value of each of the preset number of candidate texture feature indexes can be determined. Then, the minimum cost value is selected therefrom, and the candidate texture feature index corresponding to the minimum cost value is determined as the texture feature index of the current block, thereby improving the coding efficiency.

[0503] Furthermore, in some embodiments, the method further includes: determining a feature index serial number of the current block based on the texture feature index of the current block; wherein the feature index serial number is used to indicate the number of the texture feature index of the current block in the candidate list; encoding the feature index serial number of the current block, and writing the obtained encoded bits into the bitstream.

[0504] It should be noted that the aforementioned embodiment mentions the use of the prediction block of the current block or the reference block or the reconstructed image around the current block to derive a virtual intra-frame prediction mode. In a specific embodiment, an intra-frame prediction mode with the largest gradient strength value can be selected as the virtual intra-frame prediction mode. In addition, a step can be added to construct a candidate list, that is, a candidate list of virtual intra-frame prediction modes, or a candidate list of feature indexes. Then a syntax element is used to write in the bitstream to indicate which candidate is finally selected. The syntax element used here is the feature index number of the current block, which can be represented by lfnst_nspt_feature_idx.

[0505] That is, during encoding, the encoder can use the above method to construct a candidate list, then attempt to encode all possible candidates, select the candidate with the lowest encoding cost as the transform kernel used for the current block, and determine the value of lfnst_nspt_feature_idx and write it into the bitstream. The value of lfnst_nspt_feature_idx can be an integer such as 0, 1, 2, or 3. For example, if the first element of the candidate list is selected, then the value of lfnst_nspt_feature_idx can be determined to be 0; if the second element of the candidate list is selected, then the value of lfnst_nspt_feature_idx can be determined to be 1.

[0506] It should also be noted that, in an embodiment of the present application, if the candidate list includes only one candidate texture feature index, then not only can this one candidate texture feature index be directly used as the texture feature index of the current block without performing cost value calculation; but also it is not necessary to determine the value of lfnst_nspt_feature_idx, nor is it necessary to write the value of lfnst_nspt_feature_idx into the bitstream.

[0507] In some embodiments, constructing a candidate list may include: sorting at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity cumulative value, and determining a preset number of reference texture feature indexes with the highest sorting; and constructing a candidate list based on the preset number of reference texture feature indexes with the highest sorting.

[0508] In some embodiments, for constructing a candidate list, the method may also include: determining a first texture feature index corresponding to the maximum gradient intensity accumulated value in the texture feature statistics table, and determining a second texture feature index corresponding to the geometric division mode of the current block; constructing a candidate list based on the first texture feature index and the second texture feature index.

[0509] That is to say, in an embodiment of the present application, an example of constructing a candidate list is to still follow the above-mentioned method of calculating the gradient strength, and select the top N intra-frame prediction modes (texture feature indexes) according to the gradient strength from large to small to form a candidate list. Among them, the value of N may be 2, 3, 4, etc. Another example is to assume that the value of N is 2, that is, the intra-frame prediction mode (texture feature index) with the largest gradient strength is the first element of the candidate list, and the intra-frame prediction mode (texture feature index) with the second largest gradient strength is the second element of the candidate list. Another example is that for GPM, the first element of the candidate list can be set to the intra-frame prediction mode (texture feature index) corresponding to the "division" mode of GPM, and the second element can be set to the intra-frame prediction mode (texture feature index) with the largest gradient strength, or vice versa; no specific limitation is made here.

[0510] In some embodiments, constructing the candidate list may further include: determining a reference block of the current block; and constructing the candidate list according to a texture feature index corresponding to at least one candidate position in the reference block.

[0511] That is, in an embodiment of the present application, a candidate list is constructed based on the intra-frame prediction mode (texture feature index) of the reference block. For example, a candidate list is constructed based on the intra-frame prediction mode (texture feature index) of the minimum storage unit of 4×4 corresponding to certain positions in the reference block. The coordinates of the upper left corner of the current block are (x, y), the width of the current block is nCbW, the height of the current block is nCbH, the center point posC of the current block is (x+nCbW / 2, y+nCbH / 2), the upper left corner is posTL(x, y), the upper right corner is posTR(x+nCbW-1, y), the lower left corner is posBL(x, y+nCbH-1), and the lower right corner is posBR(x+nCbW-1, y+nCbH-1). The candidate list is constructed using the intra-frame prediction mode (texture feature index) of the minimum storage unit corresponding to posC, posTL, posTR, posBL, and posBR in sequence. Here, the candidate position can be at least one of posC, posTL, posTR, posBL, and posBR, but is not limited to this.

[0512] It should also be noted that when constructing the list, the encoder needs to ensure that each item in the candidate list is not repeated. If the available intra-frame prediction mode (texture feature index) cannot fill the list, a default intra-frame prediction mode (texture feature index) can be added, such as the horizontal and vertical intra-frame prediction modes (texture feature indexes).

[0513] It should also be noted that this method is applicable not only to inter-frame prediction but also to intra-frame prediction. If the value of N is 2, only a single binary symbol is required; if the value of N is greater than 2, a truncated unary code can be used. Here, all binary symbols can be encoded using the CABAC context model.

[0514] For example, referring to Table 9, for the value of the feature index number lfnst_nspt_feature_idx of the current block, a truncated unary code may be used for binarization processing, and then each coding bit may be encoded based on the context model.

[0515] Table 9

[0516] In this way, after the candidate list is constructed, the virtual intra-frame angle prediction mode (ie, the texture feature index of the current block) can be determined according to the feature index sequence number obtained from the decoded code stream.

[0517] S4302: Determine a transformation kernel group of the current block according to the texture feature index.

[0518] S4303: Determine a transformation core of the current block according to the transformation core group.

[0519] It should be noted that after determining the texture feature index of the current block, the transform kernel group of the current block can be determined based on the correspondence between the texture feature index and the transform kernel group. For example, some technologies use 4 transform kernel groups for LFNST. The correspondence between intra-frame prediction modes and transform kernel groups is detailed in Table 4. Some technologies use LFNST with more transform kernel groups, for example, 35. The correspondence between intra-frame prediction modes and transform kernel groups is detailed in Table 5.

[0520] In addition, each transform core group may include at least two transform cores. For example, a transform core group may include two transform cores, or three transform cores. However, a transform core group may also include four optional transform cores, or a larger number of optional transform cores, which are not specifically limited here.

[0521] In some embodiments, the transform core group includes at least one candidate transform core. Accordingly, determining the transform core for the current block based on the transform core group may include: calculating a cost value for each of the at least one candidate transform core to determine a cost value for each of the at least one candidate transform core; determining a minimum cost value from the cost values ​​of the at least one candidate transform core, and determining the candidate transform core corresponding to the minimum cost value as the transform core for the current block.

[0522] In one possible implementation, cost values ​​are calculated for at least one candidate transform kernel respectively. Taking the first candidate transform kernel as an example, the method may include: transforming and quantizing the residual block of the current block based on the first candidate transform kernel, determining the first candidate quantization coefficient of the current block, and performing entropy coding on the first candidate quantization coefficient to determine the first generation value of the first candidate transform kernel; inverse quantizing and inverse transforming the first candidate quantization coefficient to determine the first candidate residual block of the current block, and determining the first candidate prediction block of the current block based on the first candidate residual block; performing cost calculation based on the first candidate prediction block and the original image of the current block to determine the second generation value of the first candidate transform kernel; and determining the cost value of the first candidate transform kernel based on the first generation value and the second generation value of the first candidate transform kernel.

[0523] It should be noted that, in the embodiment of the present application, the first candidate transformation core is any one of the at least one candidate transformation core, so that the cost value of each of the at least one candidate transformation core can be determined.

[0524] It should also be noted that, in the embodiment of the present application, the first generation value may represent the cost of the first candidate transform core incurred in the codestream, and the second generation value may represent the cost of the distortion of the first candidate transform core. Here, determining the cost value of the first candidate transform core based on the first generation value and the second generation value of the first candidate transform core may include: summing the first generation value and the second generation value of the first candidate transform core, and using the sum as the cost value of the first candidate transform core.

[0525] It should also be noted that in the embodiment of the present application, the cost value calculation here can be determined based on the cost result of RDO, or based on the cost result of SAD, or even based on the cost result of SATD, but is not specifically limited.

[0526] It should also be noted that, in the embodiments of the present application, the transformation core group may include one, two, three, or more candidate transformation cores. If the transformation core group includes only one candidate transformation core, then this candidate transformation core can be directly used as the transformation core of the current block without performing cost calculation.

[0527] In some embodiments, the method further includes: determining a value of first syntax identification information of the current block; wherein the first syntax identification information is used to indicate whether the current block uses a first transform mode and the corresponding transform core index used; encoding the value of the first syntax identification information, and writing the obtained coded bits into the bitstream.

[0528] It should be noted that, in the embodiment of the present application, the first syntax identification information can be represented by lfnst_nspt_idx. The first syntax identification information can be used to indicate whether the current block uses the first transform mode. When the current block uses the first transform mode, the value of the first syntax identification information can also be used to indicate the transform core index used by the current block.

[0529] It should also be noted that in an embodiment of the present application, the first transform mode can be LFNST transform or NSPT transform. That is, lfnst_nspt_idx is used to indicate whether the current block uses LFNST transform or NSPT transform, and when the current block uses LFNST transform or NSPT transform, the value of lfnst_nspt_idx can also be used to indicate the transform core index used by the current block. Among them, whether the current block uses LFNST transform or NSPT transform can be determined based on the size parameter of the current block. For example, if the size parameter of the current block is small, then it can be determined that lfnst_nspt_idx is used to indicate whether the current block uses NSPT transform and the transform core index of the corresponding NSPT used; if the size parameter of the current block is large, then it can be determined that lfnst_nspt_idx is used to indicate whether the current block uses LFNST transform and the transform core index of the corresponding LFNST used.

[0530] It should also be noted that, in the embodiment of the present application, the first syntax identification information lfnst_nspt_idx may be replaced by two syntax identification information, lfnst_idx and nspt_idx. lfnst_idx is used to indicate whether the current block uses LFNST transformation and the corresponding LFNST transformation core index, and nspt_idx is used to indicate whether the current block uses NSPT transformation and the corresponding NSPT transformation core index, which are not specifically limited here.

[0531] In some embodiments, the method further includes: determining a transform core index of the current block; wherein the transform core index is used to indicate the number of the transform core of the current block in the transform core group; if the current block uses an intra-frame prediction mode, encoding the transform core index of the current block, and writing the obtained coded bits into the bitstream; if the current block uses an inter-frame prediction mode, determining a value of the first syntax identification information according to the transform core index of the current block, encoding the value of the first syntax identification information, and writing the obtained coded bits into the bitstream.

[0532] It should be noted that, in an embodiment of the present application, when the current block uses the intra-frame prediction mode, the first syntax identification information is used to indicate whether the current block uses the first transform mode; when the current block uses the first transform mode, it is also necessary to determine the transform core index of the current block, and encode the transform core index of the current block, and write the obtained coded bits into the bitstream; so that at the decoding end, the transform core of the current block can be determined based on the transform core group and the transform core index obtained by decoding; wherein the transform core index is used to indicate the number of the transform core of the current block in the transform core group. For example, if the transform core index of the current block is 0, then the transform core of the current block is the first transform core of the transform core group; if the transform core index of the current block is 1, then the transform core of the current block is the second transform core of the transform core group; if the transform core index of the current block is 2, then the transform core of the current block is the third transform core of the transform core group.

[0533] It should also be noted that in an embodiment of the present application, when the current block uses the inter-frame prediction mode, there are three optional transform cores in a transform core group of LFNST / NSPT, plus the case where LFNST / NSPT is not used, that is, the current block has four possible choices for LFNST / NSPT. Therefore, lfnst_nspt_idx can be used here to indicate whether the current block uses the first transform mode and the transform core index used by the current block. In this way, after determining the transform core index of the current block, the value of the first syntax identification information can be determined according to the transform core index of the current block, the value of the first syntax identification information is encoded, and the obtained coded bits are written into the bitstream; so that at the decoding end, the transform core of the current block can be determined based on the transform core group and the value of the first syntax identification information obtained by decoding.

[0534] In some embodiments, for the value of the first syntax identification information, if the current block does not use the first transform mode, then the value of the first syntax identification information is determined to be a first value; if the current block uses the first transform mode and the transform core index used by the current block is 0, then the value of the first syntax identification information is determined to be a second value; if the current block uses the first transform mode and the transform core index used by the current block is 1, then the value of the first syntax identification information is determined to be a third value; if the current block uses the first transform mode and the transform core index used by the current block is 2, then the value of the first syntax identification information is determined to be a fourth value.

[0535] In a specific embodiment, the first value is equal to 0, the second value is equal to 1, the third value is equal to 2, and the fourth value is equal to 3.

[0536] For example, if the current block does not use LFNST / NSPT, the value of the first syntax identification information is determined to be 0; if the current block uses LFNST / NSPT and the transform core of the current block is the first transform core of the transform core group, the value of the first syntax identification information is determined to be 1; if the current block uses LFNST / NSPT and the transform core of the current block is the second transform core of the transform core group, the value of the first syntax identification information is determined to be 2; if the current block uses LFNST / NSPT and the transform core of the current block is the third transform core of the transform core group, the value of the first syntax identification information is determined to be 3. That is, in this embodiment of the present application, the value of lfnst_nspt_idx can be 0, 1, 2, 3, etc.

[0537] It should also be noted that, in an embodiment of the present application, the first syntax identification information lfnst_nspt_idx can also be replaced by two other syntax identification information. Among them, one syntax identification information is used to indicate whether the current block uses LFNST / NSPT, and the other syntax identification information is used to indicate the corresponding transform core index when the current block uses LFNST / NSPT. In this way, two syntax elements need to be transmitted in the bitstream, resulting in a large bitstream overhead. In this case, for the case where the transform core index needs to be transmitted in the bitstream, if the transform core group includes only one transform core, then at this time not only is there no need to calculate the cost value, but there is also no need to transmit the transform core index. Specifically, when the current block uses LFNST / NSPT, the only transform core in the transform core group can be directly used as the transform core of the current block.

[0538] In some embodiments, when the first syntax identification information indicates that the current block uses the first transform mode, determining the transform core index of the current block may include: if the current block uses the intra-frame prediction mode, decoding the code stream to determine the transform core index of the current block; if the current block uses the inter-frame prediction mode, determining the transform core index of the current block according to the value of the first syntax identification information.

[0539] Furthermore, in the case where the texture feature index is determined by a candidate list, before encoding the feature index number of the current block, the method also includes: when the current block uses the first transform mode, performing encoding processing on the feature index number of the current block, and writing the obtained encoding bits into the bitstream.

[0540] That is to say, in an embodiment of the present application, the first syntax identification information is represented by lfnst_nspt_idx, and the feature index number is represented by lfnst_nspt_feature_idx. Here, lfnst_nspt_feature_idx can be used to select a virtual intra-frame prediction mode or texture feature index. For example, if the first element of the candidate list is selected, then lfnst_nspt_feature_idx can be determined to be 0; if the second element of the candidate list is selected, then lfnst_nspt_feature_idx can be determined to be 1. In addition, here it can be determined whether lfnst_nspt_feature_idx needs to be encoded when the current block uses LFNST or NSPT. Specifically, if the current block does not use LFNST / NSPT, then lfnst_nspt_feature_idx does not need to be encoded. For example, since lfnst_nspt_idx is used to indicate whether the current block uses LFNST / NSPT and which transform core is selected in the transform core group of LFNST / NSPT, if lfnst_nspt_idx is 0, it means that the current block does not use LFNST / NSPT. In this case, there is no need to continue to encode lfnst_nspt_feature_idx; otherwise, if lfnst_nspt_idx is not 0, it means that the current block uses LFNST / NSPT. In this case, lfnst_nspt_feature_idx can be continued to be encoded, so that at the decoding end, the texture feature index of the current block can be determined according to the decoded lfnst_nspt_feature_idx.

[0541] It should be noted that the above method is applicable not only to inter-frame prediction but also to intra-frame prediction, which is not specifically limited here.

[0542] S4304: Determine a residual block of the current block, and transform the residual block of the current block according to the transformation kernel to determine a transformation coefficient of the current block.

[0543] S4305: Encode the transform coefficients of the current block and write the obtained coded bits into the bitstream.

[0544] It should be noted that, in an embodiment of the present application, when encoding the transform coefficients of the current block, the method may include: quantizing the transform coefficients of the current block to determine the quantization coefficients of the current block; encoding the quantization coefficients of the current block and writing the obtained coded bits into the bitstream.

[0545] It should also be noted that in the embodiments of this application, the "transformation" of the residual block by the encoder can also be called a "forward transform," specifically referring to the transformation from the spatial domain to the frequency domain to remove residual correlation. It should be noted that if the standard only specifies decoding, then the "transformation" in the standard text refers to the decoding part, specifically referring to the "inverse transform" in this article.

[0546] It should also be noted that, in the embodiment of the present application, referring to FIG. 44 , for step S4304, the method may include:

[0547] S4401: Perform inter-frame prediction on the current block to determine a prediction block for the current block.

[0548] S4402: Determine a residual block of the current block according to the original block of the current block and the predicted block of the current block.

[0549] S4403: Transform the residual block of the current block according to the transformation kernel to determine the transformation coefficient of the current block.

[0550] It should be noted that in the embodiment of the present application, steps S4401 to S4402 can be operated in parallel with steps S4301 to S4303, or can be executed before steps S4301 to 4303, or can be executed after steps S4301 to 4303. The order of the steps is not specifically limited here.

[0551] It should also be noted that, in the embodiment of the present application, after determining the prediction block of the current block, a subtraction operation may be performed on the original block of the current block and the prediction block of the current block to determine the residual block of the current block.

[0552] It should also be noted that, in an embodiment of the present application, when transforming the residual block of the current block according to the transform kernel to determine the transform coefficient of the current block, it can include: if the size parameter of the current block meets the first condition, performing an inseparable basic transform on the residual block of the current block according to the transform kernel to determine the transform coefficient of the current block; if the size parameter of the current block meets the second condition, performing a discrete cosine transform on the residual block of the current block to determine the transform block of the current block; and performing a low-frequency inseparable transform on the transform block of the current block according to the transform kernel to determine the transform coefficient of the current block.

[0553] Here, the size parameter of the current block satisfies the first condition, including: the size parameter of the current block is relatively small, for example, the size parameter of the current block is less than a certain threshold. In other words, for relatively small blocks, an NSPT transform kernel is used. That is, an NSPT transform is performed on the residual block of the current block according to the transform kernel to determine the transform coefficients of the current block.

[0554] Here, the size parameter of the current block satisfies the second condition, including: the size parameter of the current block is relatively large, for example, the size parameter of the current block is greater than a certain threshold. In other words, for relatively large blocks, the LFNST transform kernel is used. Specifically, a basic DCT2 transform is first performed on the residual block of the current block, and then an LFNST transform is performed on the transform block of the current block based on the transform kernel to determine the transform coefficients of the current block.

[0555] In simple terms, after determining the prediction block, the encoder derives a virtual intra-frame prediction mode based on the prediction block, and then determines the transform kernel group for NSPT / LFNST based on the virtual intra-frame prediction mode. If a transform kernel group has multiple transform kernels to choose from, the encoder tries each transform kernel in the transform kernel group.

[0556] If the NSPT transform is used, the residual block can be forward transformed using NSPT to obtain transform coefficients, the transform coefficients are quantized to obtain quantized coefficients, and then the quantized coefficients are entropy encoded. Entropy encoding can be used to determine the overhead cost in the bitstream for this transform kernel. The quantized coefficients are inversely quantized to obtain decoded transform coefficients, and the decoded transform coefficients are inversely NSPT transformed to obtain the decoded residual block. The decoded transform coefficients may be different from the original transform coefficients because quantization is lossy. Similarly, the decoded residual block may also be different from the original residual block. A reconstructed block is obtained based on the decoded residual block and the prediction block. The distortion cost can be determined based on the reconstructed block and the original image of the current block. The cost of encoding using the current NSPT transform kernel is the sum of the overhead cost and the distortion cost. The costs of several transform kernels are compared, and the smallest one is selected as the optimal NSPT for the current block.

[0557] If the LFNST transform is used, the residual block can be forward transformed using DCT2, then forward transformed using LFNST to obtain transform coefficients. These transform coefficients are quantized to obtain quantized coefficients, and then entropy encoded. Entropy encoding can be used to determine the overhead cost in the bitstream for this transform kernel. The quantized coefficients are then inversely quantized to obtain decoded transform coefficients. These decoded transform coefficients are then subjected to an inverse LFNST transform and then an inverse DCT2 transform to obtain the decoded residual block. The decoded transform coefficients may differ from the original transform coefficients because quantization is lossy. Similarly, the decoded residual block may also differ from the original residual block. The decoded residual block and the prediction block are used to obtain a reconstructed block. The distortion cost can be determined based on the reconstructed block and the original image of the current block. The cost of encoding using the current NSPT transform kernel is the sum of the overhead cost and the distortion cost. The costs of several transform kernels are compared, and the one with the smallest cost is selected as the optimal NSPT for the current block.

[0558] It is understandable that embodiments of the present application may use a high-level syntax to control the on / off of the present technical solution. In some embodiments, the method further includes: determining a value of the second syntax identification information; encoding the value of the second syntax identification information, and writing the resulting encoded bits into the bitstream.

[0559] In this embodiment of the present application, the second syntax identification information is used to indicate whether the current sequence allows the use of the first transformation mode. Specifically, if the current sequence uses the first transformation mode, the value of the second syntax identification information can be determined to be the first value; if the current sequence does not use the first transformation mode, the value of the second syntax identification information can be determined to be the second value.

[0560] Furthermore, in some embodiments, the method further comprises: when the current sequence allows the use of the first transform mode, executing the step of determining the texture feature index of the current block; wherein the current sequence includes the current block.

[0561] It should be noted that, in the embodiment of the present application, the second syntax identification information can be represented by sps_inter_lfnst_nspt_enabled_flag, and the second syntax identification information is a syntax element in a sequence parameter set (SPS).

[0562] It should also be noted that, in the embodiment of the present application, the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile, or it can be the value of a flag, which is not specifically limited here. Exemplarily, 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. In a specific embodiment, the first value is 1 and the second value is 0.

[0563] That is, the embodiment of the present application can use a high-level syntax to control the switch of the technical solution. For example, a sequence-level flag is used, such as adding a syntax element sps_inter_lfnst_nspt_enabled_flag to the sequence parameter set. If the current sequence allows the use of the technical solution, then the value of sps_inter_lfnst_nspt_enabled_flag can be determined to be 1; if the current sequence does not allow the use of the technical solution, then the value of sps_inter_lfnst_nspt_enabled_flag can be determined to be 0. In which case, when the use of the technical solution is allowed, the encoder can continue to determine the texture feature index of the current block, as well as the transform core index of the LFNST or NSPT, and encode the transform core index or the value of lfnst_nspt_idx. Of course, the embodiment of the present application can also set separate syntax elements for LFNST and NSPT, namely sps_inter_lfnst_enabled_flag and sps_inter_nspt_enabled_flag. sps_inter_lfnst_enabled_flag is used to indicate whether the current sequence is allowed to use LFNST, and sps_inter_nspt_enabled_flag is used to indicate whether the current sequence is allowed to use NSPT.

[0564] It should also be noted that, in the embodiment of the present application, the same flag, such as sps_lfnst_nspt_enabled_flag, may be set for both inter-frame LFNST / NSPT and intra-frame LFNST / NSPT. For example, if the value of sps_inter_lfnst_nspt_enabled_flag is 0, it can be determined whether the current sequence allows the use of LFNST and NSPT; if the value of sps_inter_lfnst_nspt_enabled_flag is 1, it can be determined that the current sequence allows intra-frame coded blocks to use LFNST and NSPT; if the value of sps_inter_lfnst_nspt_enabled_flag is 2, it can be determined that the current sequence allows inter-frame coded blocks to use LFNST and NSPT.

[0565] In some embodiments, the method further includes: determining a value of second grammar identification information and a value of third grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transformation mode, and the third grammar identification information is used to indicate whether the current image allows the use of the first transformation mode; encoding the value of the second grammar identification information and the value of the third grammar identification information, and writing the obtained coded bits into the bitstream.

[0566] Furthermore, in some embodiments, when the current sequence allows the use of the first transform mode, it is determined whether the current image allows the use of the first transform mode; when the current image allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed.

[0567] In the embodiment of the present application, the current sequence may include a current picture, and the current picture includes a current block. The third syntax identification information may be represented by ph_inter_lfnst_nspt_enabled_flag, and the third syntax identification information is a syntax element at the picture level.

[0568] In an embodiment of the present application, if the current image allows the use of the first transformation mode, then the value of the third syntax identification information can be determined to be the first value; if the current image does not allow the use of the first transformation mode, then the value of the third syntax identification information can be determined to be the second value.

[0569] In some embodiments, the method further includes: determining a value of second grammar identification information and a value of fourth grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transformation mode, and the fourth grammar identification information is used to indicate whether the current slice allows the use of the first transformation mode; encoding the value of the second grammar identification information and the value of the fourth grammar identification information, and writing the obtained coded bits into the bitstream.

[0570] Furthermore, in some embodiments, when the current sequence allows the use of the first transform mode, it is determined whether the current slice allows the use of the first transform mode; when the current slice allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed.

[0571] In the embodiment of the present application, the current sequence may include a current slice, and the current slice includes a current block. The fourth syntax identification information may be represented by sh_inter_lfnst_nspt_enabled_flag, and the fourth syntax identification information is a syntax element at the slice level.

[0572] In an embodiment of the present application, if the current slice allows the use of the first transformation mode, then the value of the fourth grammar identification information can be determined to be the first value; if the current slice does not allow the use of the first transformation mode, then the value of the fourth grammar identification information can be determined to be the second value.

[0573] It should also be noted that, in the embodiment of the present application, the first value is different from the second value, and the first value and the second value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile, or it can be the value of a flag, which is not specifically limited here. Exemplarily, 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. In a specific embodiment, the first value is 1 and the second value is 0.

[0574] That is to say, in an embodiment of the present application, a high-level syntax can be used to control the switch of the technical solution. For example, a sequence-level flag is used, such as adding a syntax element sps_inter_lfnst_nspt_enabled_flag in the sequence parameter set SPS. If the current sequence allows the use of this technical solution, then the value of sps_inter_lfnst_nspt_enabled_flag can be determined to be 1; if the current sequence does not allow the use of this technical solution, then the value of sps_inter_lfnst_nspt_enabled_flag can be determined to be 0. If this technical solution is allowed, the encoder can continue to determine the texture feature index of the current block, as well as the transform core index of LFNST or NSPT, and encode the transform core index or the value of lfnst_nspt_idx. So that the decoder can decode lfnst_nspt_idx when decoding inter-frame coded blocks and perform LFNST or NSPT processing. Of course, you can also set separate flags for LFNST and NSPT, namely sps_inter_lfnst_enabled_flag and sps_inter_nspt_enabled_flag.

[0575] Furthermore, embodiments of the present application may also use syntax elements at other levels to achieve more flexible control, such as flags in the Picture Parameter Set (PPS), or flags in the picture header or slice header. For example, the sequence parameter set (SPS) determines whether the current sequence can use this technical solution. If the current sequence uses this technical solution, a sh_inter_lfnst_nspt_enabled_flag in the slice header is set to determine whether the current slice uses this technical solution, providing greater flexibility. Because for inter-frame coding, especially RA, the QPs of different images or slices vary greatly. Among them, images with a low GOP temporal level usually have a lower QP, while images with a higher GOP temporal level usually have a higher QP. This technical solution does not significantly improve compression efficiency when the QP is particularly high or particularly low, so a flag in the picture header or slice header can be set for more flexible control.

[0576] It should also be noted that in the embodiments of the present application, LFNST and NSPT can be applied to inter-frame predicted blocks. For blocks that are not well predicted between frames, that is, blocks with large residuals, compared with the related art MTS, they can better decorrelate and improve compression efficiency.

[0577] It should also be noted that, in the embodiment of the present application, in addition to applying LFNST and NSPT to inter-frame predicted blocks, they can also be applied to intra block copy (IBC) blocks.

[0578] In another embodiment of the present application, the embodiment of the present application provides a code stream, 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: a quantization coefficient of the current block, a feature index number of the current block, a value of the first syntax identification information, a value of the second syntax identification information, a value of the third syntax identification information, and a value of the fourth syntax identification information.

[0579] In an embodiment of the present application, the first syntax identification information is used to indicate whether the current block uses the first transform mode and the corresponding transform kernel index used, the second syntax identification information is used to indicate whether the current sequence allows the use of the first transform mode, and the third syntax identification information is used to indicate whether the current image allows the use of the first transform mode; the fourth syntax identification information is used to indicate whether the current slice allows the use of the first transform mode.

[0580] This embodiment provides an encoding method, which includes determining a texture feature index of a current block; determining a transform kernel group of the current block based on the texture feature index; determining a transform kernel of the current block based on the transform kernel group; determining a residual block of the current block, and transforming the residual block of the current block based on the transform kernel to determine the transform coefficient of the current block; encoding the transform coefficient of the current block, and writing the resulting coded bits into a bitstream. In other words, a correspondence between the texture feature index and the transform kernel group is established here, replacing the scheme of matching the transform kernel group based on the intra-frame prediction mode in the related art. This allows LFNST and NSPT to be applied to the inter-frame prediction mode, thereby improving not only the compression efficiency but also the encoding and decoding performance for blocks that are difficult to predict in the inter-frame prediction mode, i.e., blocks with large residuals.

[0581] In another embodiment of the present application, based on the same inventive concept as the above embodiment, see Figure 45, which shows a schematic diagram of the composition structure of an encoder provided by an embodiment of the present application. As shown in Figure 45, the encoder 450 may include: a first determination unit 4501, a transformation unit 4502 and an encoding unit 4503, wherein:

[0582] The first determining unit 4501 is configured to determine a texture feature index of a current block; determine a transform kernel group of the current block according to the texture feature index; and determine a transform kernel of the current block according to the transform kernel group;

[0583] a transform unit 4502 configured to determine a residual block of a current block, and transform the residual block of the current block according to a transform kernel to determine a transform coefficient of the current block;

[0584] The encoding unit 4503 is configured to perform encoding processing on the transformation coefficients of the current block and write the obtained encoding bits into the bitstream.

[0585] In some embodiments, referring to FIG. 45 , the encoder 450 may further include a first prediction unit 4504 configured to perform inter-frame prediction on the current block and determine a prediction block for the current block;

[0586] The first determining unit 4501 is further configured to determine a residual block of the current block according to the original block of the current block and the predicted block of the current block.

[0587] In some embodiments, referring to FIG45 , the encoder 450 may further include a quantization unit 4505 configured to quantize the transform coefficients of the current block to determine the quantization coefficients of the current block;

[0588] The encoding unit 4503 is further configured to perform encoding processing on the quantized coefficients of the current block and write the obtained encoding bits into the bit stream.

[0589] In some embodiments, the first determination unit 4501 is further configured to quantize the transform coefficients of the current block to determine the quantization coefficients of the current block; the encoding unit 4503 is further configured to encode the quantization coefficients of the current block and write the obtained encoding bits into the bitstream.

[0590] In some embodiments, the first determining unit 4501 is further configured to determine candidate pixels for deriving a texture feature index; and determine the texture feature index of the current block according to the candidate pixels.

[0591] In some embodiments, the first determination unit 4501 is further configured to determine the horizontal gradient value and the vertical gradient value of the candidate pixel; determine the texture feature index and the gradient intensity value corresponding to the candidate pixel based on the horizontal gradient value and the vertical gradient value of the candidate pixel; construct a texture feature statistics table based on the texture feature index and the gradient intensity value corresponding to the candidate pixel; and determine the texture feature index of the current block based on the texture feature statistics table.

[0592] In some embodiments, the first determining unit 4501 is further configured to determine the number of candidate pixels according to a size parameter of the current block.

[0593] In some embodiments, the first determining unit 4501 is further configured to determine a prediction block of the current block; and use at least part of the pixels in the prediction block as candidate pixels.

[0594] In some embodiments, the first determining unit 4501 is further configured to determine adjacent pixels of a reconstructed area of ​​the current block; and use the adjacent pixels of the reconstructed area as candidate pixels.

[0595] In some embodiments, the first determining unit 4501 is further configured to use adjacent pixels in the reconstructed area and at least part of the pixels in the prediction block as candidate pixels.

[0596] In some embodiments, the first determining unit 4501 is further configured to determine a reference block of the current block; and use at least part of the pixels in the reference block as candidate pixels.

[0597] In some embodiments, the first determining unit 4501 is further configured to determine that the reference block is an integer-pixel reference block; or, determine that the reference block is a fractional-pixel reference block.

[0598] In some embodiments, the first determination unit 4501 is further configured to determine two reference image blocks when the current block is bidirectionally predicted; perform pixel-by-pixel interpolation filtering on the two reference image blocks to determine two pixel-by-pixel reference image blocks; and perform weighted combination on the two pixel-by-pixel reference image blocks to determine the reference block of the current block.

[0599] In some embodiments, the first determination unit 4501 is further configured to perform angle mapping based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; and to perform gradient intensity calculation based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the gradient intensity value corresponding to the candidate pixel.

[0600] In some embodiments, the first determining unit 4501 is further configured to determine the texture feature index corresponding to the candidate pixel using a preset lookup table according to the horizontal gradient value and the vertical gradient value of the candidate pixel.

[0601] In some embodiments, the first determining unit 4501 is further configured to perform an addition operation on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient intensity value corresponding to the candidate pixel.

[0602] In some embodiments, the first determination unit 4501 is further configured to determine at least one texture feature index and at least one corresponding gradient intensity value when the number of candidate pixels is at least one; determine at least one reference texture feature index with different characteristics based on the at least one texture feature index, and perform cumulative calculation on the gradient intensity values ​​belonging to the same reference texture feature index based on the at least one gradient intensity value to determine the gradient intensity cumulative value corresponding to the at least one reference texture feature index; and construct the texture feature statistical table based on the at least one reference texture feature index and the gradient intensity cumulative value corresponding to the at least one reference texture feature index.

[0603] In some embodiments, the first determining unit 4501 is further configured to determine a maximum gradient strength accumulated value in the texture feature statistics table; and determine the reference texture feature index corresponding to the maximum gradient strength accumulated value as the texture feature index of the current block.

[0604] In some embodiments, the first determination unit 4501 is further configured to determine the maximum gradient strength accumulated value in the texture feature statistics table; when the maximum gradient strength accumulated value is less than the first threshold, the texture feature index of the current block is set to DC mode or PLANANR mode.

[0605] In some embodiments, the first determination unit 4501 is further configured to determine the statistical sum of all gradient intensity accumulated values ​​in the texture feature statistics table; when the statistical sum is less than the second threshold, the texture feature index of the current block is set to DC mode or PLANANR mode.

[0606] In some embodiments, the first determining unit 4501 is further configured to determine an angle index when the current block is subjected to a geometric partitioning mode; and determine a texture feature index of the current block according to the angle index.

[0607] In some embodiments, the first determining unit 4501 is further configured to determine a reference block of the current block; and determine the texture feature index of the current block according to the texture feature index of the reference block.

[0608] In some embodiments, the first determination unit 4501 is further configured to construct a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; perform cost value calculations on the preset number of candidate texture feature indexes respectively to determine the cost values ​​of the preset number of candidate texture feature indexes; and determine the minimum cost value from the cost values ​​of the preset number of candidate texture feature indexes, and determine the candidate texture feature index corresponding to the minimum cost value as the texture feature index of the current block.

[0609] In some embodiments, the first determination unit 4501 is further configured to determine the feature index serial number of the current block based on the texture feature index of the current block; wherein the feature index serial number is used to indicate the number of the texture feature index of the current block in the candidate list; the encoding unit 4503 is further configured to encode the feature index serial number of the current block and write the obtained encoded bits into the bitstream.

[0610] In some embodiments, the first determination unit 4501 is further configured to sort at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity cumulative value, and determine a preset number of reference texture feature indexes with the highest sorting; and construct a candidate list based on the preset number of reference texture feature indexes with the highest sorting.

[0611] In some embodiments, the first determination unit 4501 is further configured to determine the first texture feature index corresponding to the maximum gradient intensity accumulated value in the texture feature statistics table, and to determine the second texture feature index corresponding to the geometric division mode of the current block; and to construct a candidate list based on the first texture feature index and the second texture feature index.

[0612] In some embodiments, the first determining unit 4501 is further configured to determine a reference block of the current block; and construct the candidate list according to a texture feature index corresponding to at least one candidate position in the reference block.

[0613] In some embodiments, the encoding unit 4503 is further configured to perform a step of encoding the feature index number of the current block and writing the obtained encoding bits into the bitstream when the current block uses the first transform mode.

[0614] In some embodiments, the first determination unit 4501 is further configured to determine the value of the first syntax identification information of the current block; wherein the first syntax identification information is used to indicate whether the current block uses the first transform mode and the corresponding transform core index used; the encoding unit 4503 is further configured to encode the value of the first syntax identification information and write the obtained encoded bits into the bitstream.

[0615] In some embodiments, the first determination unit 4501 is further configured to determine the transform core index of the current block; wherein the transform core index is used to indicate the number of the transform core of the current block in the transform core group; the encoding unit 4503 is further configured to, if the current block uses the intra-frame prediction mode, encode the transform core index of the current block and write the obtained coded bits into the bitstream; and if the current block uses the inter-frame prediction mode, determine the value of the first syntax identification information according to the transform core index of the current block, encode the value of the first syntax identification information, and write the obtained coded bits into the bitstream.

[0616] In some embodiments, the transformation core group includes at least one candidate transformation core; accordingly, the first determination unit 4501 is further configured to perform cost value calculations on the at least one candidate transformation core respectively, and determine the cost value of each of the at least one candidate transformation core; determine the minimum cost value from the cost values ​​of the at least one candidate transformation core, and determine the candidate transformation core corresponding to the minimum cost value as the transformation core of the current block.

[0617] In some embodiments, the first determination unit 4501 is further configured to transform and quantize the residual block of the current block based on the first candidate transform kernel, determine the first candidate quantization coefficient of the current block, and perform entropy coding on the first candidate quantization coefficient to determine the first generation value of the first candidate transform kernel; dequantize and detransform the first candidate quantization coefficient to determine the first candidate residual block of the current block, and determine the first candidate prediction block of the current block based on the first candidate residual block; perform cost calculation based on the first candidate prediction block and the original image of the current block to determine the second generation value of the first candidate transform kernel; and determine the cost value of the first candidate transform kernel based on the first generation value and the second generation value of the first candidate transform kernel; wherein the first candidate transform kernel is any one of at least one candidate transform kernel.

[0618] In some embodiments, the transformation unit 4502 is further configured to, if the size parameter of the current block meets the first condition, perform an inseparable basic transform on the residual block of the current block according to the transformation kernel to determine the transformation coefficient of the current block; if the size parameter of the current block meets the second condition, perform a discrete cosine transform on the residual block of the current block to determine the transformation block of the current block; and perform a low-frequency inseparable transform on the transformation block of the current block according to the transformation kernel to determine the transformation coefficient of the current block.

[0619] In some embodiments, the first determination unit 4501 is further configured to determine a value of second syntax identification information; wherein the second syntax identification information is used to indicate whether the current sequence allows the use of the first transformation mode; the encoding unit 4503 is further configured to encode the value of the second syntax identification information and write the obtained encoded bits into the bitstream.

[0620] In some embodiments, the first determining unit 4501 is further configured to, when the current sequence allows the use of the first transform mode, perform a step of determining a texture feature index of the current block; wherein the current sequence includes the current block.

[0621] In some embodiments, the first determination unit 4501 is further configured to determine a value of the second grammar identification information and a value of the third grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transform mode, and the third grammar identification information is used to indicate whether the current image allows the use of the first transform mode; the encoding unit 4503 is further configured to encode the value of the second grammar identification information and the value of the third grammar identification information, and write the obtained coded bits into the bitstream.

[0622] In some embodiments, the first determination unit 4501 is further configured to determine whether the current image allows the use of the first transformation mode when the current sequence allows the use of the first transformation mode; and to perform the step of determining the texture feature index of the current block when the current image allows the use of the first transformation mode; wherein the current sequence includes the current image, and the current image includes the current block.

[0623] In some embodiments, the first determination unit 4501 is further configured to determine a value of the second grammar identification information and a value of the fourth grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transform mode, and the fourth grammar identification information is used to indicate whether the current slice allows the use of the first transform mode; the encoding unit 4503 is further configured to encode the value of the second grammar identification information and the value of the fourth grammar identification information, and write the obtained coded bits into the bitstream.

[0624] In some embodiments, the first determination unit 4501 is further configured to determine whether the current slice allows the use of the first transform mode when the current sequence allows the use of the first transform mode; and when the current slice allows the use of the first transform mode, perform the step of determining the texture feature index of the current block; wherein the current sequence includes the current slice, and the current slice includes the current block.

[0625] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.

[0626] 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, the technical solution of this embodiment, or the portion 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 for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0627] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 450. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the aforementioned embodiments.

[0628] Based on the composition of the encoder 450 and the computer-readable storage medium, refer to Figure 46, which shows a specific hardware structure diagram of the encoder 450 provided in an embodiment of the present application. As shown in Figure 46, the encoder 450 may include: a first communication interface 4601, a first memory 4602 and a first processor 4603; each component is coupled together through a first bus system 4604. It can be understood that the first bus system 4604 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 4604 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 4604 in Figure 46. Among them,

[0629] The first communication interface 4601 is used to receive and send signals when sending and receiving information with other external network elements;

[0630] A first memory 4602 is used to store computer programs that can be run on the first processor 4603;

[0631] The first processor 4603 is configured to, when running the computer program, execute:

[0632] Determine a texture feature index of the current block; determine a transform kernel group of the current block based on the texture feature index; determine a transform kernel of the current block based on the transform kernel group; determine a residual block of the current block, and transform the residual block of the current block based on the transform kernel to determine a transform coefficient of the current block; encode the transform coefficient of the current block and write the obtained coded bits into a bitstream.

[0633] It is understood that the first memory 4602 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 4602 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0634] The first processor 4603 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 4603. The above-mentioned first processor 4603 can 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. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 4602 , and the first processor 4603 reads the information in the first memory 4602 and completes the steps of the above method in combination with its hardware.

[0635] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0636] Optionally, as another embodiment, the first processor 4603 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.

[0637] This embodiment provides an encoder in which a correspondence between texture feature indices and transform kernel groups is established, replacing the scheme of matching transform kernel groups according to intra-frame prediction modes in related technologies. This allows LFNST and NSPT to be applied to inter-frame prediction modes, thereby improving not only the compression efficiency but also the encoding and decoding performance for blocks that are difficult to predict in the inter-frame prediction mode, i.e., blocks with large residuals.

[0638] Based on the same inventive concept as the above embodiment, referring to FIG47 , a schematic diagram of the structure of a decoder provided by an embodiment of the present application is shown. As shown in FIG47 , the decoder 470 may include a second determination unit 4701 and an inverse transformation unit 4702, wherein:

[0639] The second determining unit 4701 is configured to determine a texture feature index of the current block; and determine a transform kernel group of the current block according to the texture feature index;

[0640] The second determining unit 4701 is further configured to determine a transform core of the current block according to the transform core group;

[0641] The inverse transform unit 4702 is configured to determine the transform coefficients of the current block, and perform inverse transform on the transform coefficients of the current block according to the transform kernel to determine the residual block of the current block.

[0642] In some embodiments, referring to FIG. 47 , the decoder 470 may further include a decoding unit 4703 and an inverse quantization unit 4704 , wherein:

[0643] The decoding unit 4703 is configured to decode the code stream and determine the quantization coefficient of the current block;

[0644] The inverse quantization unit 4704 is further configured to perform inverse quantization on the quantization coefficients of the current block to determine the transformation coefficients of the current block.

[0645] In some embodiments, referring to FIG. 47 , the decoder 470 may further include a second prediction unit 4705 configured to perform inter-frame prediction on the current block and determine a prediction block for the current block;

[0646] The second determining unit 4701 is further configured to determine a reconstructed block of the current block according to the prediction block of the current block and the residual block of the current block.

[0647] In some embodiments, the decoding unit 4703 is further configured to decode the code stream and determine the value of the first syntax identification information of the current block; the second determination unit 4701 is further configured to determine the transform core index of the current block when the first syntax identification information indicates that the current block uses the first transform mode, and determine the transform core of the current block based on the transform core group and the transform core index.

[0648] In some embodiments, the decoding unit 4703 is further configured to decode the code stream and determine the transform core index of the current block if the current block uses the intra-frame prediction mode; the second determination unit 4701 is further configured to determine the transform core index of the current block according to the value of the first syntax identification information if the current block uses the inter-frame prediction mode.

[0649] In some embodiments, the second determining unit 4701 is further configured to determine candidate pixels for deriving a texture feature index; and determine the texture feature index of the current block according to the candidate pixels.

[0650] In some embodiments, the second determining unit 4701 is further configured to construct a texture feature statistics table according to the texture feature index and the gradient intensity value corresponding to the candidate pixel; and determine the texture feature index of the current block according to the texture feature statistics table.

[0651] In some embodiments, the second determining unit 4701 is further configured to determine the number of candidate pixels according to a size parameter of the current block.

[0652] In some embodiments, the second determining unit 4701 is further configured to determine a prediction block of the current block; and use at least part of the pixels in the prediction block as candidate pixels.

[0653] In some embodiments, the second determining unit 4701 is further configured to determine adjacent pixels of a reconstructed area of ​​the current block; and use the adjacent pixels of the reconstructed area as candidate pixels.

[0654] In some embodiments, the second determining unit 4701 is further configured to use adjacent pixels in the reconstructed area and at least part of the pixels in the prediction block as candidate pixels.

[0655] In some embodiments, the second determining unit 4701 is further configured to determine a reference block of the current block; and use at least part of the pixels in the reference block as the candidate pixels.

[0656] In some embodiments, the second determining unit 4701 is further configured to determine that the reference block is an integer-pixel reference block; or, determine that the reference block is a fractional-pixel reference block.

[0657] In some embodiments, the second determination unit 4701 is further configured to determine two reference image blocks when the current block is bidirectionally predicted; perform pixel-by-pixel interpolation filtering on the two reference image blocks to determine two pixel-by-pixel reference image blocks; and perform weighted combination on the two pixel-by-pixel reference image blocks to determine the reference block of the current block.

[0658] In some embodiments, the second determination unit 4701 is further configured to perform angle mapping based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; and to perform gradient intensity calculation based on the horizontal gradient value and vertical gradient value of the candidate pixel to determine the gradient intensity value corresponding to the candidate pixel.

[0659] In some embodiments, the second determining unit 4701 is further configured to determine the texture feature index corresponding to the candidate pixel using a preset lookup table according to the horizontal gradient value and the vertical gradient value of the candidate pixel.

[0660] In some embodiments, the second determining unit 4701 is further configured to perform an addition operation on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient intensity value corresponding to the candidate pixel.

[0661] In some embodiments, the second determination unit 4701 is further configured to determine at least one texture feature index and at least one corresponding gradient intensity value when the number of candidate pixels is at least one; determine at least one reference texture feature index with different characteristics based on the at least one texture feature index, and perform cumulative calculation on the gradient intensity values ​​belonging to the same reference texture feature index based on the at least one gradient intensity value to determine the gradient intensity cumulative value corresponding to the at least one reference texture feature index; and construct a texture feature statistical table based on the at least one reference texture feature index and the gradient intensity cumulative value corresponding to the at least one reference texture feature index.

[0662] In some embodiments, the second determining unit 4701 is further configured to determine a maximum gradient intensity accumulated value in the texture feature statistics table; and determine the reference texture feature index corresponding to the maximum gradient intensity accumulated value as the texture feature index of the current block.

[0663] In some embodiments, the second determination unit 4701 is further configured to determine the maximum gradient strength accumulated value in the texture feature statistics table; when the maximum gradient strength accumulated value is less than the first threshold, the texture feature index of the current block is set to DC mode or PLANANR mode.

[0664] In some embodiments, the second determination unit 4701 is further configured to determine the statistical sum of all gradient intensity accumulated values ​​in the texture feature statistics table; when the statistical sum is less than the second threshold, the texture feature index of the current block is set to DC mode or PLANANR mode.

[0665] In some embodiments, the second determining unit 4701 is further configured to determine an angle index when the current block is subjected to a geometric partitioning mode; and determine a texture feature index of the current block according to the angle index.

[0666] In some embodiments, the second determining unit 4701 is further configured to determine a reference block of the current block; and determine the texture feature index of the current block according to the texture feature index of the reference block.

[0667] In some embodiments, the second determining unit 4701 is further configured to construct a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; the decoding unit 4703 is further configured to decode the code stream to determine the feature index sequence number of the current block.

[0668] In some embodiments, the second determination unit 4701 is further configured to sort at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity cumulative value, and determine a preset number of reference texture feature indexes with the highest sorting; and construct the candidate list based on the preset number of reference texture feature indexes with the highest sorting.

[0669] In some embodiments, the second determination unit 4701 is further configured to determine the first texture feature index corresponding to the maximum gradient intensity accumulated value in the texture feature statistics table, and determine the second texture feature index corresponding to the geometric division mode of the current block; and construct a candidate list based on the first texture feature index and the second texture feature index.

[0670] In some embodiments, the second determining unit 4701 is further configured to determine a reference block of the current block; and construct a candidate list according to a texture feature index corresponding to at least one candidate position in the reference block.

[0671] In some embodiments, the decoding unit 4703 is further configured to decode the code stream and determine the value of the first syntax identification information of the current block; the second determination unit 4701 is further configured to perform the step of decoding the code stream and determining the feature index number of the current block when the first syntax identification information indicates that the current block uses the first transformation mode.

[0672] In some embodiments, the inverse transform unit 4702 is further configured to, if the size parameter of the current block meets the first condition, perform an inverse transform of the inseparable basic transform on the transform coefficients of the current block according to the transform kernel to determine the residual block of the current block; if the size parameter of the current block meets the second condition, perform an inverse transform of the low-frequency inseparable transform on the transform coefficients of the current block according to the transform kernel to determine the transform block of the current block; and perform an inverse transform of the discrete cosine transform on the transform block of the current block to determine the residual block of the current block.

[0673] In some embodiments, the decoding unit 4703 is further configured to decode the code stream, determine the value of the second syntax identification information; and when the second syntax identification information indicates that the current sequence allows the use of the first transform mode, perform the step of determining the texture feature index of the current block; wherein the current sequence includes the current block.

[0674] In some embodiments, the decoding unit 4703 is further configured to decode the code stream and determine the value of the second syntax identification information; when the second syntax identification information indicates that the current sequence allows the use of the first transform mode, decode the code stream and determine the value of the third syntax identification information; and when the third syntax identification information indicates that the current image allows the use of the first transform mode, perform the step of determining the texture feature index of the current block; wherein the current sequence includes the current image, and the current image includes the current block.

[0675] In some embodiments, the decoding unit 4703 is further configured to decode the code stream and determine the value of the second syntax identification information; when the first syntax identification information indicates that the current sequence allows the use of the first transform mode, decode the code stream and determine the value of the fourth syntax identification information; and when the fourth syntax identification information indicates that the current slice allows the use of the first transform mode, perform the step of determining the texture feature index of the current block; wherein the current sequence includes the current slice, and the current slice includes the current block.

[0676] It is understood that 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 system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.

[0677] 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, which is applied to decoder 470 and stores a computer program. When the computer program is executed by the second processor, it implements any of the methods in the aforementioned embodiments.

[0678] Based on the composition of the decoder 470 and the computer-readable storage medium, refer to Figure 48, which shows a specific hardware structure diagram of the decoder 470 provided in an embodiment of the present application. As shown in Figure 48, the decoder 470 may include: a second communication interface 4801, a second memory 4802 and a second processor 4803; each component is coupled together through a second bus system 4804. It can be understood that the second bus system 4804 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 4804 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the second bus system 4804 in Figure 48. Among them,

[0679] The second communication interface 4801 is used to receive and send signals when sending and receiving information with other external network elements;

[0680] The second memory 4802 is used to store computer programs that can be run on the second processor 4803;

[0681] The second processor 4803 is configured to, when running the computer program, execute:

[0682] Determine a texture feature index of the current block; determine a transform kernel group of the current block according to the texture feature index; determine a transform kernel of the current block according to the transform kernel group; determine a transform coefficient of the current block, and inversely transform the transform coefficient of the current block according to the transform kernel to determine a residual block of the current block.

[0683] Optionally, as another embodiment, the second processor 4803 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.

[0684] It can be understood that the hardware functions of the second memory 4802 are similar to those of the first memory 4602, and the hardware functions of the second processor 4803 are similar to those of the first processor 4603; they will not be described in detail here.

[0685] This embodiment provides a decoder in which a correspondence between texture feature indices and transform kernel groups is established, replacing the scheme of matching transform kernel groups according to intra-frame prediction modes in related technologies. This allows LFNST and NSPT to be applied to inter-frame prediction modes, thereby improving not only compression efficiency but also encoding and decoding performance for blocks that are difficult to predict in the inter-frame prediction mode, i.e., blocks with large residuals.

[0686] In yet another embodiment of the present application, referring to FIG49 , a schematic diagram of the structure of a coding and decoding system provided by an embodiment of the present application is shown. As shown in FIG49 , a coding and decoding system 490 may include an encoder 4901 and a decoder 4902 .

[0687] In an embodiment of the present application, the encoder 4901 may be the encoder described in any one of the aforementioned embodiments, and the decoder 4902 may be the decoder described in any one of the aforementioned embodiments.

[0688] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0689] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

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

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

[0692] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0693] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims. Industrial Applicability

[0694] In an embodiment of the present application, at the encoding end, the texture feature index of the current block is determined; based on the texture feature index, the transform core group of the current block is determined; based on the transform core group, the transform core of the current block is determined; the residual block of the current block is determined, and the residual block of the current block is transformed based on the transform core to determine the transform coefficient of the current block; the transform coefficient of the current block is encoded, and the obtained coded bits are written into the bitstream. At the decoding end, the texture feature index of the current block is determined; based on the texture feature index, the transform core group of the current block is determined; based on the transform core group, the transform core of the current block is determined; the transform coefficient of the current block is determined, and the transform coefficient of the current block is inversely transformed based on the transform core to determine the residual block of the current block. In this way, whether it is the encoding end or the decoding end, the texture feature index of the current block is first determined, and then the transform core group of the current block is determined based on the texture feature index, and then t...

Claims

1. A decoding method, applied to a decoder, the method comprising: Determine the texture feature index of the current block; Determining a transformation core group of the current block according to the texture feature index; Determining a transformation core of the current block according to the transformation core group; A transformation coefficient of the current block is determined, and the transformation coefficient of the current block is inversely transformed according to the transformation kernel to determine a residual block of the current block.

2. The method according to claim 1, wherein: The determining of the transform coefficient of the current block comprises: Decoding a bitstream to determine a quantization coefficient of the current block; De-quantize the quantized coefficients of the current block to determine the transform coefficients of the current block.

3. The method according to claim 1, wherein: The method further comprises: Performing inter-frame prediction on the current block to determine a prediction block of the current block; A reconstructed block of the current block is determined according to the prediction block of the current block and the residual block of the current block.

4. The method according to claim 1, wherein: The step of determining the transformation core of the current block according to the transformation core group includes: Decoding the bitstream to determine a value of first syntax identification information of the current block; When the first syntax identification information indicates that the current block uses a first transform mode, a transform core index of the current block is determined, and the transform core of the current block is determined according to the transform core group and the transform core index.

5. The method according to claim 4, wherein: When the first syntax identification information indicates that the current block uses a first transform mode, determining a transform core index of the current block includes: If the current block uses an intra prediction mode, decoding the bitstream to determine a transform kernel index of the current block; If the current block uses the inter-frame prediction mode, the transform core index of the current block is determined according to the value of the first syntax identification information.

6. The method according to claim 1, wherein: The determining of the texture feature index of the current block includes: Determining candidate pixels for deriving the texture feature index; A texture feature index of the current block is determined according to the candidate pixels.

7. The method according to claim 6, wherein: The step of determining the texture feature index of the current block according to the candidate pixels includes: Determining a horizontal gradient value and a vertical gradient value of the candidate pixel; Determine a texture feature index and a gradient intensity value corresponding to the candidate pixel according to the horizontal gradient value and the vertical gradient value of the candidate pixel; Constructing a texture feature statistics table according to the texture feature index and the gradient intensity value corresponding to the candidate pixel; According to the texture feature statistics table, a texture feature index of the current block is determined.

8. The method according to claim 6, wherein: The method further comprises: The number of the candidate pixels is determined according to a size parameter of the current block.

9. The method according to claim 6, wherein: The method further comprises: Determining a prediction block of the current block; At least part of the pixels in the prediction block are used as the candidate pixels.

10. The method according to claim 9, wherein: The method further comprises: Determining neighboring pixels of a reconstructed area of ​​the current block; Adjacent pixels of the reconstructed area are used as the candidate pixels.

11. The method according to claim 10, wherein: The method further comprises: Adjacent pixels of the reconstructed area and at least part of pixels in the prediction block are used as the candidate pixels.

12. The method according to claim 6, wherein: The method further comprises: Determining a reference block of the current block; At least part of the pixels in the reference block are used as the candidate pixels.

13. The method according to claim 12, wherein: The determining a reference block of the current block comprises: Determine that the reference block is an integer-pixel reference block; or, The reference block is determined to be a sub-pixel reference block.

14. The method according to claim 13, wherein: When the reference block is a sub-pixel reference block, determining the reference block of the current block includes: Determine two reference image blocks when the current block is bidirectionally predicted; Performing pixel-by-pixel interpolation filtering on the two reference image blocks to determine two pixel-by-pixel reference image blocks; The reference image blocks of the two sub-pixels are weightedly combined to determine a reference block of the current block.

15. The method according to claim 7, wherein: The determining, according to the horizontal gradient value and the vertical gradient value of the candidate pixel, a texture feature index and a gradient intensity value corresponding to the candidate pixel comprises: Performing angle mapping according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; A gradient strength calculation is performed according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel.

16. The method according to claim 15, wherein: The step of performing angle mapping according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel includes: According to the horizontal gradient value and the vertical gradient value of the candidate pixel, a texture feature index corresponding to the candidate pixel is determined using a preset lookup table.

17. The method according to claim 15, wherein: The step of calculating the gradient strength according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel includes: An addition operation is performed on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient intensity value corresponding to the candidate pixel.

18. The method according to claim 7, wherein: The step of constructing a texture feature statistics table according to the texture feature index and the gradient intensity value corresponding to the candidate pixel comprises: When the number of the candidate pixels is at least one, determining at least one texture feature index and at least one corresponding gradient intensity value; Determining at least one reference texture feature index having different characteristics according to the at least one texture feature index, and accumulating the gradient intensity values ​​belonging to the same reference texture feature index according to the at least one gradient intensity value to determine the gradient intensity accumulation value corresponding to the at least one reference texture feature index; The texture feature statistics table is constructed according to the at least one reference texture feature index and the gradient intensity accumulation value corresponding to the at least one reference texture feature index.

19. The method according to claim 18, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the maximum gradient intensity accumulated value in the texture feature statistical table; The reference texture feature index corresponding to the maximum gradient intensity accumulated value is determined as the texture feature index of the current block.

20. The method according to claim 18, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the maximum gradient intensity accumulated value in the texture feature statistical table; When the maximum gradient strength accumulated value is less than a first threshold, the texture feature index of the current block is set to a DC mode or a PLANANR mode.

21. The method according to claim 18, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the statistical sum of all the gradient intensity accumulated values ​​in the texture feature statistical table; When the statistical sum value is less than a second threshold, the texture feature index of the current block is set to a DC mode or a PLANANR mode.

22. The method according to claim 1, wherein: The determining of the texture feature index of the current block includes: Determine an angle index when the current block is in a geometric partitioning mode; According to the angle index, a texture feature index of the current block is determined.

23. The method according to claim 1, wherein: The determining of the texture feature index of the current block includes: Determining a reference block of the current block; The texture feature index of the current block is determined according to the texture feature index of the reference block.

24. The method according to claim 1, wherein: The determining of the texture feature index of the current block includes: Constructing a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; Decoding the bitstream to determine the feature index number of the current block; The texture feature index of the current block is determined according to the candidate list and the feature index sequence number.

25. The method according to claim 24, wherein: The candidate list is constructed, including: Sorting at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity accumulated value, and determining a preset number of reference texture feature indexes that are ranked first; The candidate list is constructed according to the preset number of reference texture feature indexes that are ranked first.

26. The method according to claim 24, wherein: The candidate list is constructed, including: Determine a first texture feature index corresponding to the maximum gradient intensity accumulated value in the texture feature statistics table, and determine a second texture feature index corresponding to the current block when the current block is subjected to a geometric partitioning mode; The candidate list is constructed according to the first texture feature index and the second texture feature index.

27. The method according to claim 24, wherein: The candidate list is constructed, including: Determining a reference block of the current block; The candidate list is constructed according to a texture feature index corresponding to at least one candidate position in the reference block.

28. The method of claim 24, wherein: The method further comprises: Decoding the bitstream to determine a value of first syntax identification information of the current block; When the first syntax identification information indicates that the current block uses the first transform mode, a step of decoding a code stream and determining a feature index sequence number of the current block is performed.

29. The method of claim 1, wherein: The inverse transformation of the transformation coefficient of the current block according to the transformation kernel to determine the residual block of the current block includes: If the size parameter of the current block satisfies the first condition, performing an inverse transformation of an inseparable basic transformation on the transformation coefficients of the current block according to the transformation kernel to determine a residual block of the current block; If the size parameter of the current block satisfies the second condition, an inverse transform of a low-frequency inseparable transform is performed on the transform coefficients of the current block according to the transform kernel to determine the transform block of the current block; and an inverse transform of a discrete cosine transform is performed on the transform block of the current block to determine the residual block of the current block.

30. The method according to any one of claims 1 to 29, wherein: The method further comprises: Decoding the code stream to determine a value of the second syntax identification information; When the second syntax identification information indicates that the current sequence allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes the current block.

31. The method according to any one of claims 1 to 29, wherein: The method further comprises: Decoding the code stream to determine a value of the second syntax identification information; When the second syntax identification information indicates that the current sequence allows the use of the first transformation mode, decoding the code stream and determining a value of the third syntax identification information; When the third syntax identification information indicates that the current image allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes the current image, and the current image includes the current block.

32. The method according to any one of claims 1 to 29, wherein: The method further comprises: Decoding the code stream to determine a value of the second syntax identification information; When the first syntax identification information indicates that the current sequence allows the use of the first transformation mode, decoding the code stream and determining a value of the fourth syntax identification information; When the fourth syntax identification information indicates that the current slice allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes the current slice, and the current slice includes the current block.

33. A coding method, applied to an encoder, the method comprising: Determine the texture feature index of the current block; Determining a transformation core group of the current block according to the texture feature index; Determining a transformation core of the current block according to the transformation core group; Determine a residual block of the current block, and transform the residual block of the current block according to the transform kernel to determine a transform coefficient of the current block; The transform coefficients of the current block are coded, and the obtained coded bits are written into a bit stream.

34. The method of claim 33, wherein: The determining of the residual block of the current block comprises: Performing inter-frame prediction on the current block to determine a prediction block of the current block; A residual block of the current block is determined according to an original block of the current block and a predicted block of the current block.

35. The method of claim 33, wherein: The encoding process is performed on the transform coefficient of the current block, and the obtained encoding bits are written into a bit stream, including: quantizing the transform coefficients of the current block to determine the quantization coefficients of the current block; The quantized coefficients of the current block are coded, and the obtained coded bits are written into a bit stream.

36. The method of claim 33, wherein: The determining of the texture feature index of the current block includes: Determining candidate pixels for deriving the texture feature index; A texture feature index of the current block is determined according to the candidate pixels.

37. The method of claim 36, wherein: The step of determining the texture feature index of the current block according to the candidate pixels includes: Determining a horizontal gradient value and a vertical gradient value of the candidate pixel; Determine a texture feature index and a gradient intensity value corresponding to the candidate pixel according to the horizontal gradient value and the vertical gradient value of the candidate pixel; Constructing a texture feature statistics table according to the texture feature index and the gradient intensity value corresponding to the candidate pixel; According to the texture feature statistics table, a texture feature index of the current block is determined.

38. The method of claim 36, wherein: The method further comprises: The number of the candidate pixels is determined according to a size parameter of the current block.

39. The method of claim 36, wherein: The method further comprises: Determining a prediction block of the current block; At least part of the pixels in the prediction block are used as the candidate pixels.

40. The method of claim 39, wherein: The method further comprises: Determining neighboring pixels of a reconstructed area of ​​the current block; Adjacent pixels of the reconstructed area are used as the candidate pixels.

41. The method of claim 40, wherein: The method further comprises: Adjacent pixels of the reconstructed area and at least part of pixels in the prediction block are used as the candidate pixels.

42. The method of claim 36, wherein: The method further comprises: Determining a reference block of the current block; At least part of the pixels in the reference block are used as the candidate pixels.

43. The method of claim 42, wherein: The determining a reference block of the current block comprises: Determine that the reference block is an integer-pixel reference block; or, The reference block is determined to be a sub-pixel reference block.

44. The method of claim 43, wherein: When the reference block is a sub-pixel reference block, determining the reference block of the current block includes: Determine two reference image blocks when the current block is bidirectionally predicted; Performing pixel-by-pixel interpolation filtering on the two reference image blocks to determine two pixel-by-pixel reference image blocks; The reference image blocks of the two sub-pixels are weightedly combined to determine a reference block of the current block.

45. The method of claim 37, wherein: The determining, according to the horizontal gradient value and the vertical gradient value of the candidate pixel, a texture feature index and a gradient intensity value corresponding to the candidate pixel comprises: Performing angle mapping according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel; A gradient strength calculation is performed according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel.

46. ​​The method of claim 45, wherein: The step of performing angle mapping according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the texture feature index corresponding to the candidate pixel includes: According to the horizontal gradient value and the vertical gradient value of the candidate pixel, a texture feature index corresponding to the candidate pixel is determined using a preset lookup table.

47. The method of claim 45, wherein: The step of calculating the gradient strength according to the horizontal gradient value and the vertical gradient value of the candidate pixel to determine the gradient strength value corresponding to the candidate pixel includes: An addition operation is performed on the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value to determine the gradient intensity value corresponding to the candidate pixel.

48. The method of claim 37, wherein: The step of constructing a texture feature statistics table according to the texture feature index and the gradient intensity value corresponding to the candidate pixel comprises: When the number of the candidate pixels is at least one, determining at least one texture feature index and at least one corresponding gradient intensity value; Determining at least one reference texture feature index having different characteristics according to the at least one texture feature index, and accumulating the gradient intensity values ​​belonging to the same reference texture feature index according to the at least one gradient intensity value to determine the gradient intensity accumulation value corresponding to the at least one reference texture feature index; The texture feature statistics table is constructed according to the at least one reference texture feature index and the gradient intensity accumulation value corresponding to the at least one reference texture feature index.

49. The method of claim 48, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the maximum gradient intensity accumulated value in the texture feature statistical table; The reference texture feature index corresponding to the maximum gradient intensity accumulated value is determined as the texture feature index of the current block.

50. The method of claim 48, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the maximum gradient intensity accumulated value in the texture feature statistical table; When the maximum gradient strength accumulated value is less than a first threshold, the texture feature index of the current block is set to a DC mode or a PLANANR mode.

51. The method of claim 48, wherein: The step of determining the texture feature index of the current block according to the texture feature statistics table includes: Determine the statistical sum of all the gradient intensity accumulated values ​​in the texture feature statistical table; When the statistical sum value is less than a second threshold, the texture feature index of the current block is set to a DC mode or a PLANANR mode.

52. The method of claim 33, wherein: The determining of the texture feature index of the current block includes: Determine an angle index when the current block is in a geometric partitioning mode; According to the angle index, a texture feature index of the current block is determined.

53. The method of claim 33, wherein: The determining of the texture feature index of the current block includes: Determining a reference block of the current block; The texture feature index of the current block is determined according to the texture feature index of the reference block.

54. The method of claim 33, wherein: The determining of the texture feature index of the current block includes: Constructing a candidate list, wherein the candidate list includes a preset number of candidate texture feature indexes; Calculating cost values ​​for the preset number of candidate texture feature indexes respectively to determine cost values ​​for the preset number of candidate texture feature indexes; A minimum cost value is determined from the cost values ​​of the preset number of candidate texture feature indexes, and the candidate texture feature index corresponding to the minimum cost value is determined as the texture feature index of the current block.

55. The method of claim 54, wherein: The method further comprises: Determine a feature index sequence number of the current block according to the texture feature index of the current block; wherein the feature index sequence number is used to indicate the number of the texture feature index of the current block in the candidate list; The characteristic index number of the current block is encoded, and the obtained encoding bits are written into a bit stream.

56. The method of claim 54, wherein: The candidate list is constructed, including: Sorting at least one reference texture feature index in the texture feature statistics table from large to small according to the corresponding gradient intensity accumulated value, and determining a preset number of reference texture feature indexes that are ranked first; The candidate list is constructed according to the preset number of reference texture feature indexes that are ranked first.

57. The method of claim 54, wherein: The candidate list is constructed, including: Determine a first texture feature index corresponding to the maximum gradient intensity accumulated value in the texture feature statistics table, and determine a second texture feature index corresponding to the current block when the current block is subjected to a geometric partitioning mode; The candidate list is constructed according to the first texture feature index and the second texture feature index.

58. The method of claim 54, wherein: The candidate list is constructed, including: Determining a reference block of the current block; The candidate list is constructed according to a texture feature index corresponding to at least one candidate position in the reference block.

59. The method of claim 55, wherein: The method further comprises: When the current block uses the first transformation mode, a step of encoding the feature index number of the current block and writing the obtained encoding bits into a bit stream is performed.

60. The method of claim 33, wherein: The method further comprises: Determine a value of first syntax identification information of the current block; wherein the first syntax identification information is used to indicate whether the current block uses a first transform mode and a corresponding transform core index used; The value of the first syntax identification information is encoded, and the obtained encoded bits are written into a bit stream.

61. The method of claim 60, wherein: The method further comprises: Determine a transform core index of the current block; wherein the transform core index is used to indicate the number of the transform core of the current block in the transform core group; If the current block uses the intra prediction mode, encoding the transform kernel index of the current block, and writing the obtained encoding bits into a bitstream; If the current block uses the inter-frame prediction mode, the first syntax identification information is determined according to the transform core index of the current block. value, encode the value of the first syntax identification information, and write the obtained coded bits into the bit stream.

62. The method of claim 33, wherein: The transformation core group includes at least one candidate transformation core; The step of determining the transformation core of the current block according to the transformation core group includes: Calculating cost values ​​for the at least one candidate transformation core respectively to determine a cost value for each of the at least one candidate transformation core; A minimum cost value is determined from the cost values ​​of the at least one candidate transform core, and the candidate transform core corresponding to the minimum cost value is determined as the transform core of the current block.

63. The method of claim 62, wherein: The calculating cost values ​​of the at least one candidate transformation core respectively to determine the cost value of each of the at least one candidate transformation core comprises: transforming and quantizing the residual block of the current block based on the first candidate transform kernel, determining a first candidate quantization coefficient of the current block, and performing entropy coding processing on the first candidate quantization coefficient to determine a first generation value of the first candidate transform kernel; Dequantizing and inversely transforming the first candidate quantization coefficients to determine a first candidate residual block of the current block, and determining a first candidate prediction block of the current block according to the first candidate residual block; performing cost calculation according to the first candidate prediction block and the original image of the current block to determine a second generation value of the first candidate transformation kernel; The cost value of the first candidate transformation core is determined according to the first generation value and the second generation value of the first candidate transformation core; wherein the first candidate transformation core is any one of the at least one candidate transformation core.

64. The method of claim 33, wherein: The transforming the residual block of the current block according to the transform kernel to determine the transform coefficient of the current block includes: If the size parameter of the current block satisfies the first condition, performing an inseparable basic transform on the residual block of the current block according to the transform kernel to determine a transform coefficient of the current block; If the size parameter of the current block satisfies the second condition, a discrete cosine transform is performed on the residual block of the current block to determine the transform block of the current block; and a low-frequency inseparable transform is performed on the transform block of the current block according to the transform kernel to determine the transform coefficient of the current block.

65. The method according to any one of claims 33 to 64, wherein: The method further comprises: Determine a value of second grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transformation mode; The value of the second syntax identification information is encoded, and the obtained encoded bits are written into a bit stream.

66. The method of claim 65, wherein: The method further comprises: When the current sequence allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes the current block.

67. The method of any one of claims 33 to 64, wherein: The method further comprises: Determine a value of second grammar identification information and a value of third grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transform mode, and the third grammar identification information is used to indicate whether the current image allows the use of the first transform mode; The value of the second syntax identification information and the value of the third syntax identification information are encoded, and the obtained encoded bits are written into a bit stream.

68. The method of claim 67, wherein: The method further comprises: When the current sequence allows the use of the first transformation mode, determining whether the current image allows the use of the first transformation mode; When the current image allows the use of a first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes a current image, and the current image includes the current block.

69. The method according to any one of claims 33 to 64, wherein: The method further comprises: Determine a value of second grammar identification information and a value of fourth grammar identification information; wherein the second grammar identification information is used to indicate whether the current sequence allows the use of the first transform mode, and the fourth grammar identification information is used to indicate whether the current slice allows the use of the first transform mode; The value of the second syntax identification information and the value of the fourth syntax identification information are encoded, and the obtained encoded bits are written into a bit stream.

70. The method of claim 69, wherein: The method further comprises: When the current sequence allows the use of the first transform mode, determining whether the current slice allows the use of the first transform mode; When the current slice allows the use of the first transform mode, the step of determining the texture feature index of the current block is performed; wherein the current sequence includes the current slice, and the current slice includes the current block.

71. A code stream, wherein The code stream is generated by bit encoding according to 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 feature index number of the current block, the value of the first syntax identification information, the value of the second syntax identification information value, the value of the third grammar identification information and the value of the fourth grammar identification information; Among them, the first syntax identification information is used to indicate whether the current block uses the first transform mode and the corresponding transform kernel index used, the second syntax identification information is used to indicate whether the current sequence allows the use of the first transform mode, the third syntax identification information is used to indicate whether the current image allows the use of the first transform mode; the fourth syntax identification information is used to indicate whether the current slice allows the use of the first transform mode.

72. An encoder, comprising a first determining unit, a transforming unit, and an encoding unit, wherein: The first determining unit is configured to determine a texture feature index of a current block; determine a transform core group of the current block according to the texture feature index; and determine a transform core of the current block according to the transform core group; The transform unit is configured to determine a residual block of the current block, and transform the residual block of the current block according to the transform kernel to determine a transform coefficient of the current block; The encoding unit is configured to perform encoding processing on the transformation coefficients of the current block and write the obtained encoding bits into a bit stream.

73. An encoder, comprising a first memory and a first processor, wherein: The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 33 to 70 when running the computer program.

74. A decoder, comprising a second determination unit and an inverse transformation unit, wherein: The second determining unit is configured to determine a texture feature index of the current block; and determine a transform core group of the current block according to the texture feature index; The second determining unit is further configured to determine a transform core of the current block according to the transform core group; The inverse transform unit is configured to determine the transform coefficients of the current block, and perform inverse transform on the transform coefficients of the current block according to the transform kernel to determine the residual block of the current block.

75. A decoder, comprising a second memory and a second processor, wherein: The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 32 when running the computer program.

76. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, which implements the method according to any one of claims 1 to 32 when executed by a first processor, or implements the method according to any one of claims 33 to 70 when executed by a second processor.