Video codec method, apparatus, device, system, and storage medium

By determining candidate weight derivation modes and prediction modes based on block attributes, the prediction accuracy of current blocks is improved, enhancing video codec performance.

JP2025539839APending Publication Date: 2025-12-09GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2025529885
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Current video codec technologies suffer from inaccurate construction of candidate prediction mode lists, leading to reduced prediction accuracy of current blocks, which affects overall codec performance.

Method used

The proposed solution involves determining N candidate weight derivation modes and at least one candidate prediction mode based on attribute information of a current block, followed by selecting a first weight derivation mode and K first prediction modes to improve prediction accuracy.

Benefits of technology

This approach enhances the accuracy of predicting current blocks, thereby improving codec performance by accurately constructing candidate prediction mode lists.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025539839000001_ABST
    Figure 2025539839000001_ABST
Patent Text Reader

Abstract

The video coding method, apparatus, device, system, and storage medium provided herein determine N candidate weight derivation modes when coding a current block, determine at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block, determine a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, and predict the current block using the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. That is, in embodiments of the present application, the decoding side improves the accuracy of determining the candidate prediction mode by taking the weight derivation mode and attribute information of the current block into consideration when determining the candidate prediction mode, and predicts the current block based on the accurately determined candidate prediction mode, thereby improving the prediction accuracy of the current block and improving codec performance.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present application relates to the field of video codec technology, and in particular to video codec methods, apparatus, devices, systems, and storage media. [Background technology]

[0002] Digital video technology can be incorporated into various video devices, such as digital televisions, smartphones, computers, e-book readers, or video players. With the development of video technology, the amount of data contained in video data becomes relatively large. In order to facilitate the transmission of video data, video devices implement video compression technology to make the video data more efficiently transmitted or stored.

[0003] Since video has temporal or spatial redundancy, prediction can eliminate or reduce the redundancy in the video and improve compression efficiency. Currently, to improve prediction efficiency, a current block can be predicted using multiple prediction modes, for example, by constructing a candidate prediction mode list and selecting multiple prediction modes from the candidate prediction mode list to predict the current block. However, the currently constructed candidate prediction mode list is not accurate enough, resulting in reduced prediction accuracy of the current block. Summary of the Invention

[0004] The embodiments of the present application provide a video codec method, apparatus, device, system, and storage medium that can improve the accuracy of constructing a candidate prediction mode list, improve the prediction accuracy of a current block, and further improve codec performance.

[0005] In a first aspect, the present application provides a video decoding method applied to a decoder, comprising: determining N candidate weight derivation modes, where N is a positive integer; determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block; determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; predicting a current block based on the first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

[0006] In a second aspect, the present embodiment comprises: determining N candidate weight derivation modes, where N is a positive integer; determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block; determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; predicting a current block based on the first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

[0007] In a third aspect, the present application provides a video decoding device for performing the method of the first aspect or any of its embodiments, specifically the device comprising functional units for performing the method of the first aspect or any of its embodiments.

[0008] In a fourth aspect, the present application provides a video encoding apparatus for performing the method of the second aspect or any of its embodiments, specifically the apparatus comprising functional units for performing the method of the second aspect or any of its embodiments.

[0009] In a fifth aspect, there is provided a video decoder comprising a processor and a memory, the memory being adapted to store a computer program, and the processor being adapted to access and execute the computer program stored in the memory in order to perform the method of the first aspect or any embodiment thereof.

[0010] In a sixth aspect, there is provided a video encoder comprising a processor and a memory, the memory being adapted to store a computer program, the processor being adapted to call and execute the computer program stored in the memory in order to perform the method of the second aspect or any embodiment thereof.

[0011] In a seventh aspect, there is provided a video codec system including a video encoder and a video decoder, wherein the video decoder is adapted to perform the method of the first aspect or any of its embodiments, and the video encoder is adapted to perform the method of the second aspect or any of its embodiments.

[0012] In an eighth aspect, there is provided a chip for implementing the method of any one of the first to second aspects or their respective embodiments, the chip including a processor for retrieving and executing a computer program from a memory, causing a device to which the chip is attached to perform the method of any one of the first to second aspects or their respective embodiments.

[0013] In a ninth aspect, there is provided a computer-readable storage medium used to store a computer program that causes a computer to execute the method according to any one of the first to second aspects or each embodiment thereof.

[0014] In a tenth aspect, there is provided a computer program product comprising computer program instructions to cause a computer to carry out the method of any of the first to second aspects above or each embodiment thereof.

[0015] In an eleventh aspect, there is provided a computer program which, when executed on a computer, causes the computer to carry out the method of any one of the first to second aspects or respective embodiments thereof.

[0016] In a twelfth aspect, there is provided a codestream generated based on the method of the second aspect, and optionally the codestream includes a first index used to indicate a first combination of one weight derivation mode and K prediction modes, where K is a positive integer greater than 1.

[0017] Based on the above technical solution, when coding a current block, N candidate weight derivation modes are determined, and at least one candidate prediction mode is determined based on the N candidate weight derivation modes and attribute information of the current block, and a first weight derivation mode and K first prediction modes corresponding to the current block are determined based on the N candidate weight derivation modes and at least one candidate prediction mode, and the first weight derivation mode and K first prediction modes are used to predict the current block and obtain a predicted value of the current block. That is, in this embodiment of the present application, when determining at least one candidate prediction mode, the codec side takes into account the weight derivation mode and attribute information of the current block to improve the accuracy of determining the candidate prediction mode, and the accurately determined candidate prediction mode is used. Do When the current block is predicted based on the quantized eigenvalue, the prediction accuracy of the current block can be improved, and the codec performance can be improved. [Brief explanation of the drawings]

[0018] [Figure 1] 1 is a schematic block diagram of a video codec system according to an embodiment of the present application; [Figure 2] 1 is a schematic block diagram of a video encoder according to an embodiment of the present application; [Figure 3] 1 is a schematic block diagram of a video decoder according to an embodiment of the present application; [Figure 4] FIG. 1 is a schematic diagram of weight assignment. [Figure 5]FIG. 1 is a schematic diagram of weight assignment. [Figure 6A] FIG. 1 is a schematic diagram of inter prediction. [Figure 6B] FIG. 1 is a schematic diagram of weighted inter prediction. [Figure 7A] FIG. 1 is a schematic diagram of intra prediction. [Figure 7B] FIG. 1 is a schematic diagram of intra prediction. [Figure 8A] FIG. 1 is a schematic diagram of intra prediction. [Figure 8B] FIG. 1 is a schematic diagram of intra prediction. [Figure 8C] FIG. 1 is a schematic diagram of intra prediction. [Figure 8D] FIG. 1 is a schematic diagram of intra prediction. [Figure 8E] FIG. 1 is a schematic diagram of intra prediction. [Figure 8F] FIG. 1 is a schematic diagram of intra prediction. [Figure 8G] FIG. 1 is a schematic diagram of intra prediction. [Figure 8H] FIG. 1 is a schematic diagram of intra prediction. [Figure 8I] FIG. 1 is a schematic diagram of intra prediction. [Figure 9] FIG. 1 is a schematic diagram of intra-prediction modes. [Figure 10] FIG. 1 is a schematic diagram of intra-prediction modes. [Figure 11] FIG. 1 is a schematic diagram of intra-prediction modes. [Figure 12] FIG. 1 is a schematic diagram of an MIP. [Figure 13] FIG. 1 is a schematic diagram of TIMD prediction. [Figure 14A] 1 is a bar graph corresponding to DIMD. [Figure 14B] FIG. 1 is a schematic diagram of DIMD prediction. [Figure 15] FIG. 1 is a schematic diagram of combinatorial prediction. [Figure 16] FIG. 1 is a schematic diagram of a template. [Figure 17A] FIG. 1 is a schematic diagram of inter / intra prediction. [Figure 17B] FIG. 10 is a schematic diagram of another inter / intra prediction. [Figure 18] FIG. 2 is a schematic diagram of adjacent blocks. [Figure 19] FIG. 2 is a flow diagram of a video decoding method according to an embodiment of the present application; [Figure 20A] FIG. 1 is a schematic diagram of weight assignment. [Figure 20B] FIG. 1 is a schematic diagram of weight assignment. [Figure 21A] FIG. 1 is a schematic diagram of a template. [Figure 21B] FIG. 10 is a schematic diagram of template weight derivation. [Figure 22A] FIG. 2 is a schematic diagram of a transition region. [Figure 22B] FIG. 10 is a schematic diagram of another transition region. [Figure 23] FIG. 1 illustrates a flow diagram of a video encoding method according to an embodiment of the present application. [Figure 24] 1 is a schematic block diagram of a video decoding device according to an embodiment of the present application; [Figure 25] 1 is a schematic block diagram of a video encoding device according to an embodiment of the present application; [Figure 26] 1 is a schematic block diagram of an electronic device according to an embodiment of the present application; [Figure 27] 1 is a schematic block diagram of a video codec system according to an embodiment of the present application; DETAILED DESCRIPTION OF THE INVENTION

[0019] The present application can be applied to image codec fields, video codec fields, hardware video codec fields, dedicated circuit video codec fields, real-time video codec fields, etc. For example, the scheme of the present application can be combined with audio video coding standards (AVS), such as the H.264 / audio video coding (AVC) standard, the H.265 / high efficiency video coding (HEVC) standard, and the H.266 / versatile video coding (VVC) standard. Alternatively, the schemes of the present application can operate in combination with other proprietary or industry standards, including ITU-TH.261, ISO / IEC MPEG-1 Visual, ITU-TH.262, or ISO / IEC MPEG-2 Visual, ITU-TH.263, ISO / IEC MPEG-4 Visual, and ITU-TH.264 (also known as ISO / IEC MPEG-4 AVC), including Scalable Video Codec (SVC) and Multiview Video Codec (MVC) extensions. It should be understood that the technology of the present application is not limited to any particular codec standard or technology.

[0020] For ease of understanding, a video codec system according to an embodiment of the present invention will be described first in conjunction with FIG.

[0021] FIG. 1 is a schematic block diagram of a video codec system according to an embodiment of the present application. Note that FIG. 1 is merely an example, and video codec systems according to the embodiment of the present application include, but are not limited to, those shown in FIG. 1. As shown in FIG. 1, the video codec system 100 includes an encoding device 110 and a decoding device 120. Here, the encoding device encodes (which can also be understood as compressing) video data to generate a codestream and transmits the codestream to the decoding device. The decoding device decodes the codestream generated by the encoding device to obtain decoded video data.

[0022] In the embodiments of the present application, encoding device 110 can be understood as a device having video encoding functionality, and decoding device 120 can be understood as a device having video decoding functionality, i.e., in the embodiments of the present application, encoding device 110 and decoding device 120 include a wider range of devices, such as smartphones, desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, etc.

[0023] In some embodiments, encoding device 110 may transmit encoded video data (e.g., a codestream) to decoding device 120 over channel 130. Channel 130 may include one or more media and / or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120.

[0024] In one example, channel 130 includes one or more communication media that enable encoding device 110 to transmit encoded video data directly in real time to decoding device 120. In this example, encoding device 110 can modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding device 120. Here, the communication media includes a wireless communication medium, e.g., a radio frequency spectrum, and optionally, the communication medium may further include a wired communication medium, e.g., one or more physical transmission lines.

[0025] In another example, channel 130 includes a storage medium that can store the video data encoded by encoding device 110. The storage medium can include multiple types of locally accessible data storage media, such as optical disks, DVDs, flash memory, etc. In this example, decoding device 120 can obtain the encoded video data from the storage medium.

[0026] In another example, channel 130 may include a storage server that can store video data encoded by encoding device 110. In this example, decoding device 120 may download the stored encoded video data from the storage server. Optionally, the storage server may store the encoded video data and transmit the encoded video data to decoding device 120, such as a web server (e.g., for a website), a File Transfer Protocol (FTP) server, etc.

[0027] In some embodiments, encoding device 110 includes a video encoder 112 and output The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter.

[0028] In some embodiments, encoding device 110 may include a video source 111 in addition to a video encoder 112 and an input interface 113 .

[0029] The video source 111 may include at least one of a video capture device (e.g., a video camera), a video archive, a video input interface, and a computer graphics system, where the video input interface is used to receive video data from a video content provider and the computer graphics system is used to generate the video data.

[0030] The video encoder 112 encodes video data from the video source 111 to generate a codestream. The video data may include one or more pictures or a sequence of pictures. The codestream contains coding information for the pictures or sequence of pictures in the form of a bitstream. The coding information may include coding image data and associated data. The associated data may include sequence parameter sets (SPSs), picture parameter sets (PPSs), and other syntax structures. An SPS may contain parameters that apply to one or more sequences. A PPS may contain parameters that apply to one or more pictures. A syntax structure is a set of parameters arranged in a specified order in the codestream. 1 Refers to a set of one or more syntax elements.

[0031] Video encoder 112 transmits the encoded video data directly to decoding device 120 via output interface 113. The encoded video data may also be stored on a storage medium or storage server for subsequent reading by decoding device 120.

[0032] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122 .

[0033] In some embodiments, decoding device 120 may further include a display device 123 in addition to input interface 121 and video decoder 122 .

[0034] Here, the input interface 121 includes a receiver and / or a modem, and can receive encoded video data via a channel 130.

[0035] The video decoder 122 is used to decode the encoded video data to obtain decoded video data, and send the decoded video data to the display device 123 .

[0036] Display device 123 displays the decoded video data. Display device 123 may be integrated with decoding device 120 or may be external to decoding device 120. Display device 123 may include various display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.

[0037] Furthermore, FIG. 1 is merely an example, and the technical solutions of the embodiments of the present application are not limited to FIG. 1. For example, the technology of the present application can also be applied to one-sided video encoding or one-sided video decoding.

[0038] The following describes a video encoding framework according to an embodiment of the present application.

[0039] 2 is a schematic block diagram of a video encoder according to an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression on images, or lossless compression on images. The lossless compression can be visually lossless compression or mathematically lossless compression.

[0040] The video encoder 200 is applicable to image data in a luminance / chrominance (YCbCr, YUV) format. For example, the YUV ratio may be 4:2:0, 4:2:2, or 4:4:4, where Y represents luminance (Luma), Cb (U) represents blue chrominance, and Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) to represent color and saturation. For example, in color format, 4:2:0 represents four luminance components and two chrominance components (YYYYCbCr) for every four pixels, 4:2:2 represents four luminance components and four chrominance components (YYYYCbCrCbCr) for every four pixels, and 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCr).

[0041] For example, the video encoder 200 reads video data and divides each frame into several coding tree units (CTUs), which may be referred to as "tree blocks," "largest coding units" (LCUs), or "coding tree blocks." Each CTU is associated with a block of pixels having an equal size in the image. Each pixel may correspond to one luminance (luma) sample and two chrominance (chroma) samples. Thus, each CTU is associated with one luminance sampling block and two chrominance sampling blocks. The size of a CTU may be, for example, 128×128, 64×64, 32×32, etc. A CTU may be further divided into several coding units (CUs) for encoding, which may be rectangular or square blocks. A CU may be further divided into a prediction unit (PU) and a transform unit (TU), which allows for more flexibility in processing by separating encoding, prediction, and transformation. In one example, a CTU is divided into CUs in a quadtree manner, and a CU is divided into TUs and PUs in a quadtree manner.

[0042] Video encoders and video decoders can support various PU sizes. Assuming that a specific CU size is 2Nx2N, the video encoder and video decoder can support PU sizes of 2Nx2N or NxN for intra prediction, and can support symmetric PUs of 2Nx2N, 2NxN, Nx2N, NxN, or similar sizes for inter prediction. The video encoder and video decoder can further support asymmetric PUs of 2NxnU, 2NxnD, nLx2N, and nRx2N for inter prediction.

[0043] 2, the video encoder 200 may include a prediction unit 210, a residual unit 220, a transform / quantization unit 230, an inverse transform / quantization unit 240, a reconstruction unit 250, a loop filter unit 260, a decoded image cache 270, and an entropy encoding unit 280. Note that the video encoder 200 may include more, fewer, or different functional components.

[0044] Optionally, in this application, the current block may be referred to as a current encoding unit (CU) or a current prediction unit (PU), etc. The prediction block may also be referred to as a predicted image block or an image prediction block, and the reconstructed image block may also be referred to as a reconstruction block or an image reconstruction image block.

[0045] In some embodiments, the prediction unit 210 includes an inter prediction unit 211 and an intra prediction unit 212. Because there is a strong correlation between adjacent pixels within a frame of video, the intra prediction method is used in video coding techniques to remove spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent frames within a video, the inter prediction method is used in video coding techniques to remove temporal redundancy between adjacent frames, thereby improving coding efficiency.

[0046] The inter prediction unit 211 is used for inter prediction, which may include motion estimation and motion compensation and may refer to image information from different frames. Inter prediction is used to find a reference block from a reference frame using motion information, generate a predicted block based on the reference block, and remove temporal redundancy. The frames used for inter prediction may be P frames and / or B frames, where P frames refer to forward-predicted frames and B frames refer to bidirectionally predicted frames. Inter prediction uses motion information to find a reference block from a reference frame and generate a predicted block based on the reference block. The motion information includes a reference frame list in which the reference frame exists, a reference frame index, and a motion vector. The motion vector may be integer or fractional pixels. If the motion vector is fractional pixels, an interpolation filter must be used in the reference frame to create the required fractional pixel block. Here, the integer or fractional pixel block in the reference frame found based on the motion vector is referred to as the reference block. Some techniques use the reference block directly as the predicted block, while other techniques generate a predicted block by reprocessing based on the reference block. Generating a predicted block by reprocessing based on a reference block may be understood as using the reference block as a predicted block, and then processing based on the predicted block to generate a new predicted block.

[0047] The intra prediction unit 212 only refers to information of the same frame image and predicts pixel information within the current coded image block to eliminate spatial redundancy. The frame used for intra prediction may be an I-frame.

[0048] Intra prediction has multiple prediction modes. Taking the international digital video encoding standard H series as an example, the H.264 / AVC standard has eight angular prediction modes and one non-angular prediction mode, while H.265 / HEVC has been expanded to 33 angular prediction modes and two non-angular prediction modes. The intra prediction modes used in HEVC include planar mode, DC, and 33 angular modes, for a total of 35 prediction modes. The intra modes used in VVC include planar mode, DC, and 65 angular modes, for a total of 67 prediction modes.

[0049] Furthermore, with the increase in angle modes, intra prediction becomes more accurate, which further meets the demands of the development of high-definition and super high-definition digital video.

[0050] Residual unit 220 may generate a residual block of a CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, residual unit 220 may generate the residual block of the CU such that each sample in the residual block has a value equal to the difference between a sample in the pixel block of the CU and a corresponding sample in the prediction block of the PU of the CU.

[0051] The transform / quantization unit 230 may quantize the transform coefficients. The transform / quantization unit 230 may quantize the transform coefficients associated with the TUs of a CU based on a quantization parameter (QP) value associated with the CU. The video encoder 200 may adjust the degree of quantization applied to the transform coefficients associated with a CU by adjusting the QP value associated with the CU.

[0052] The inverse transform / quantization unit 240 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct residual blocks from the quantized transform coefficients.

[0053] Reconstruction unit 250 may add the sampling of the reconstructed residual block to corresponding sampling of one or more prediction blocks generated by prediction unit 210 to generate a reconstructed image block associated with the TU. By reconstructing the sampling blocks of each TU of the CU in this manner, video encoder 200 may reconstruct the pixel blocks of the CU.

[0054] The loop filter unit 260 is used to process the inverse transformed and dequantized pixels, complement the distortion information, and provide a better reference for subsequent pixel encoding, and can, for example, perform deblocking filter operations to reduce the blocking effect of pixel blocks associated with a CU.

[0055] In some embodiments, loop filter unit 260 includes a deblocking filter unit and a sampling adaptive compensation / adaptive loop filter (SAO / ALF) unit, where the deblocking filter unit is used to remove blocking effects and the SAO / ALF unit is used to remove ringing effects.

[0056] The decoded image cache 270 can store the reconstructed pixel blocks. The inter prediction unit 211 can perform inter prediction on PUs of other images using a reference image including the reconstructed pixel blocks. Furthermore, the intra prediction unit 212 can perform intra prediction on other PUs in the same image as the CU using the reconstructed pixel blocks in the decoded image cache 270.

[0057] The entropy encoding unit 280 may receive the quantized transform coefficients from the transform / quantization unit 230. The entropy encoding unit 280 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.

[0058] FIG. 3 is a schematic block diagram of a video decoder according to an embodiment of the present application.

[0059] 3, the video decoder 300 may include an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transform unit 330, a reconstruction unit 340, a loop filter unit 350, and a decoded image cache 360. It should be noted that the video decoder 300 may include more, fewer, or different functional components.

[0060] The video decoder 300 may receive a codestream. The entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the codestream, the entropy decoding unit 310 may parse the entropy-decoded syntax elements in the codestream. The prediction unit 320, the inverse quantization / transform unit 330, the reconstruction unit 340, and the loop filter unit 350 may decode the video data according to the syntax elements extracted from the codestream, i.e., generate decoded video data.

[0061] In some embodiments, the prediction unit 320 includes an intra prediction unit 322 and an inter prediction unit 321 .

[0062] The intra prediction unit 322 may perform intra prediction to generate a predictive block of the PU. The intra prediction unit 322 may use an intra prediction mode to generate a predictive block of the PU based on pixel blocks of spatially neighboring PUs. The intra prediction unit 322 may further determine the intra prediction mode of the PU according to one or more syntax elements parsed from the codestream.

[0063] The inter prediction unit 321 may construct a first reference image list (List 0) and a second reference image list (List 1) based on syntax elements parsed from the codestream. Furthermore, if the PU uses inter-prediction encoding, the entropy decoding unit 310 may analyze motion information of the PU. The inter prediction unit 321 may determine one or more reference blocks for the PU based on the motion information of the PU. The inter prediction unit 321 may generate a prediction block for the PU based on the one or more reference blocks for the PU.

[0064] The inverse quantization / transform unit 330 may inverse quantize (i.e., de-quantize) the transform coefficients associated with the TU. The inverse quantization / transform unit 330 may determine the degree of quantization using a QP value associated with the CU of the TU.

[0065] After dequantizing the transform coefficients, the inverse quantization / transform unit 330 may apply one or more inverse transforms to the dequantized transform coefficients to generate a residual block associated with the TU.

[0066] The reconstruction unit 340 reconstructs the pixel block of the CU using the residual block associated with the TU of the CU and the prediction block of the PU of the CU. For example, the reconstruction unit 340 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU and obtain a reconstructed image block.

[0067] The loop filter unit 350 may perform a deblocking filter operation to reduce the blocking effect of pixel blocks associated with a CU.

[0068] Video decoder 300 can store the reconstructed image of the CU in decoded image cache 360. Video decoder 300 may use the reconstructed image in decoded image cache 360 ​​as a reference image for subsequent prediction, or may send the reconstructed image to a display device for display.

[0069] The basic process of a video codec is as follows: On the encoding side, a frame image is divided into blocks, and for a current block, the prediction unit 210 generates a prediction block for the current block using intra prediction or inter prediction. The residual unit 220 calculates a residual block, i.e., the difference between the prediction block and the original block of the current block, based on the prediction block and the original block of the current block. The residual block is also called residual information. The transform / quantization unit 230 performs processes such as transform and quantization on the residual block to remove information that is insensitive to the human eye and thereby remove visual redundancy. Optionally, the residual block before transform and quantization by the transform / quantization unit 230 may be called a time-domain residual block, and the time-domain residual block after transform and quantization by the transform / quantization unit 230 may be called a frequency residual block or a frequency-domain residual block. The entropy encoding unit 280 receives the quantized transform coefficients output from the transformation / quantization unit 230, entropy encodes the quantized transform coefficients, and outputs a codestream. For example, the entropy encoding unit 280 can remove character redundancies based on the target context model and probability information in the binary code stream.

[0070] On the decoding side, the entropy decoding unit 310 analyzes the codestream to obtain prediction information, a quantization coefficient matrix, etc. for the current block. The prediction unit 320 generates a prediction block for the current block using intra- or inter-prediction based on the prediction information. The inverse quantization / transform unit 330 uses the quantization coefficient matrix obtained from the codestream to inversely quantize and inversely transform the quantization coefficient matrix to obtain a residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed block forms a reconstructed image, and the loop filter unit 350 performs loop filtering on the reconstructed image based on the image or block to obtain a decoded image. The encoding side also requires the same operations as the decoding side to obtain a decoded image. The decoded image may also be called a reconstructed image, and the reconstructed image can be used as a reference frame for inter-prediction of a subsequent frame.

[0071] The block division information determined on the encoding side, and mode or parameter information such as prediction, transformation, quantization, entropy encoding, and loop filter information are included in the codestream as needed. The decoding side analyzes the codestream and determines the same block division information, mode or parameter information such as prediction, transformation, quantization, entropy encoding, and loop filter information as the encoding side by analyzing it based on existing information, thereby ensuring that the decoded image obtained on the encoding side is the same as the decoded image obtained on the decoding side.

[0072] The above is the basic process of a video codec in a block-based hybrid coding framework, and as technology develops, some modules or steps of this framework or process may be optimized, and the present application applies to, but is not limited to, this basic process of a video codec in a block-based hybrid coding framework.

[0073] In the present application, the current block may be a current encoding unit (CU) or a current prediction unit (PU). For parallel processing, an image may be divided into slices, and slices within the same image may be processed in parallel, i.e., there is no data dependency between them. Meanwhile, the term "frame" is a commonly used term, and one frame can generally be understood to be one image. In the present application, the term "frame" may be replaced with "image" or "slice."

[0074] The Versatile Video Coding (VVC) currently under development has an inter-prediction mode called Geometric Partitioning Mode (GPM). The Audio Video Coding Standard (AVS) currently under development has an inter-prediction mode called Angular Weighted Prediction (AWP). Although these two modes have different names and specific implementations, they share a common principle.

[0075] Note that traditional unidirectional prediction finds only one reference block of the same size as the current block, while traditional bidirectional prediction uses two reference blocks of the same size as the current block, and the pixel value of each point in the predicted block is the average of the corresponding positions in the two reference blocks, i.e., all points in each reference block account for 50%. Bidirectional weighted prediction allows the two reference blocks to have different proportions, for example, all points in the first reference block account for 75% and all points in the second reference block account for 25%. However, all points in the same reference block have the same proportion. However, all points in the same reference block have the same proportion. Some other optimization techniques, such as decoder-side motion vector refinement (DMVR) and bidirectional optical flow (BIO), may introduce some changes to the reference pixels and predicted pixels, but are unrelated to the principles described above. BIO can also be abbreviated as BDOF. On the other hand, GPM or AWP uses two reference blocks of the same size as the current block, but some pixel positions use 100% of the pixel values ​​corresponding to the first reference block, and some pixel positions use 100% of the pixel values ​​corresponding to the second reference block. However, in the boundary region (also called the transition region), the pixel values ​​corresponding to these two reference blocks are used at a constant rate. The weights in the boundary region also gradually transition. Specifically, how these weights are assigned is determined by the GPM or AWP model. The weight of each pixel position is determined according to the GPM or AWP model. Of course, in some cases, for example, when the block size is very small, some GPM or AWP modes may not be able to guarantee that some pixel positions use 100% of the pixel values ​​corresponding to the first reference block, and some pixel positions use 100% of the pixel values ​​corresponding to the second reference block. GPM or AWP may also use two reference blocks of a different size from the current block, i.e., take the necessary parts of each as the reference block.That is, the part with a weight other than 0 is used as the reference block, and the part with a weight of 0 is excluded. This is an implementation issue and is not the focus of the discussion in this application.

[0076] Illustratively, FIG. 4 is a schematic diagram of weight assignment, showing weight assignment for multiple partition modes of a GPM in a 64×64 current block according to an embodiment of the present application, where the GPM has 64 partition modes. FIG. 5 is a schematic diagram of weight assignment, showing weight assignment for multiple partition modes of an AWP in a 64×64 current block according to an embodiment of the present application, where the AWP has 56 partition modes. In both FIG. 4 and FIG. 5, for each partition mode, a black area indicates that the weight value of the position corresponding to the first reference block is 0%, a white area indicates that the weight value of the position corresponding to the first reference block is 100%, and a gray area indicates that the weight value of the position corresponding to the first reference block is greater than 0% and less than 100% depending on the shade of color, and the weight value of the position corresponding to the second reference block is 100% minus the weight value of the position corresponding to the first reference block.

[0077] GPM and AWP use different weight derivation methods. GPM determines the angle and offset for each mode, then calculates the weight matrix for each mode. AWP first creates a one-dimensional weight line, then spreads it across the matrix using a method similar to intra-angle prediction.

[0078] It should be noted that in earlier codec technologies, only rectangular partitioning methods existed, regardless of whether the partitioning was for CUs, PUs, or transform units (TUs). In contrast, GPM and AWP both achieve a predicted non-rectangular partitioning effect without partitioning. GPM and AWP use a weight mask of two reference blocks, i.e., the weight graph described above. This mask determines the weights used to generate a predicted block from the two reference blocks. This can be easily understood as some positions of the predicted block coming from the first reference block and some positions coming from the second reference block. The transition area (blending area) is obtained by weighting the corresponding positions of the two reference blocks, thereby achieving a smoother transition. Because GPM and AWP do not divide the current block into two CUs or PUs by a partition line, the current block is processed as a whole, even during the transformation, quantization, inverse transformation, and inverse quantization of the predicted residual.

[0079] GPM uses a weight matrix to simulate a geometric partition, or more precisely, a prediction partition. To implement GPM, two predictors are required in addition to the weight matrix, and each predictor is determined by one unidirectional motion information. These two unidirectional motion information come from a motion information candidate list, e.g., a merge motion information candidate list (mergeCandList). GPM determines the two unidirectional motion information from mergeCandList using two indices in the codestream.

[0080] Inter-prediction uses motion information to represent "motion." Basic motion information includes information on a reference frame (or reference picture) and a motion vector (MV). Commonly used bidirectional prediction uses two reference blocks to predict a current block. The two reference blocks may be one forward reference block and one backward reference block. Optionally, both can be forward or backward. Forward refers to a time corresponding to a reference frame occurring before the current frame, while backward refers to a time corresponding to a reference frame occurring after the current frame. Alternatively, forward refers to a reference frame located before the current frame, while backward refers to a reference frame located after the current frame. Alternatively, forward refers to a reference frame whose picture order count (POC) is smaller than that of the current frame, while backward refers to a reference frame whose POC is larger than that of the current frame. To use bidirectional prediction, two reference blocks must be found, which requires information on two groups of reference frames and motion vectors. Each of these groups can be understood as one unidirectional motion information, and two of these groups combine to form bidirectional motion information. In specific implementation, the unidirectional motion information and the bidirectional motion information may use the same data structure, except that the reference frame information and motion vector information of the two groups of bidirectional motion information are all valid, and the reference frame information and motion vector information of one group of unidirectional motion information is invalid.

[0081] In some embodiments, two reference frame lists, denoted as RPL0 and RPL1, are supported, where RPL is an abbreviation for Reference Picture List. In some embodiments, a P slice can use only RPL0, and a B slice can use RPL0 and RPL1. For one slice, there are several reference frames in each reference frame list, and the codec finds a specific reference frame by the reference frame index. In some embodiments, motion information is represented by a reference frame index and a motion vector. For the above bidirectional motion information, a reference frame index refIdxL0 corresponding to reference frame list 0 and a motion vector mvL0 corresponding to reference frame list 0, a reference frame index refIdxL1 corresponding to reference frame list 1 and a motion vector mvL0 corresponding to reference frame list 1 are used. Here, the reference frame index corresponding to reference frame list 0 and the reference frame index corresponding to reference frame list 1 can be understood as the above-mentioned reference frame information. In some embodiments, two flag bits are used to indicate whether to use motion information corresponding to reference frame list 0 and the reference frame list 1 The predFlagL0 and predFlagL1 flags indicate whether the corresponding motion information is used, respectively. predFlagL0 and predFlagL1 can also be understood to indicate whether the unidirectional motion information is "valid or not." Although the data structure of motion information is not explicitly mentioned, the motion information is indicated by a reference frame index, a motion vector, and a "valid or not" flag bit corresponding to each reference frame list. In some standard texts, the motion information does not appear, but a motion vector is used, and the reference frame index and a flag indicating whether the corresponding motion information is used are considered to be attached to the motion vector. For convenience of explanation, the term "motion information" is still used in this application, but it should be understood that the term "motion vector" can also be used.

[0082] The motion information used for the current block may be preserved. Subsequent coded blocks of the current frame may use motion information of previous coded blocks, for example, neighboring blocks, depending on their adjacent positional relationships. Because this utilizes spatial correlation, such encoded motion information is called spatial domain motion information. The motion information used for each block of the current frame may be preserved. Subsequent coded frames may use motion information of previous coded frames according to reference relationships. Because this utilizes temporal correlation, such coded frame motion information is called temporal domain motion information. The motion information used for each block of the current frame is usually stored in a fixed-size matrix, for example, a 4x4 matrix, as the smallest unit, with one group of motion information stored individually in each smallest unit. In this way, each time a block is coded, the smallest units corresponding to that position can store the motion information for that block. In this way, when spatial domain motion information or temporal domain motion information is used, the motion information corresponding to that position can be directly found according to the position. When a 16x16 block uses conventional unidirectional prediction, all 4x4 minimum units corresponding to this block store the motion information of this unidirectional prediction.When a block uses GPM or AWP, all minimum units corresponding to this block determine the motion information to store based on the GPM or AWP mode, the first motion information, the second motion information, and the position of each minimum unit.One method is that when all 4x4 pixels corresponding to a minimum unit are derived from the first motion information, this minimum unit stores the first motion information, and when all 4x4 pixels corresponding to a minimum unit are derived from the second motion information, this minimum unit stores the second motion information.When a 4x4 pixel corresponding to one minimum unit comes from both the first motion information and the second motion information, the AWP selects and stores one of the motion information, and the GPM method combines and stores the two motion information as bidirectional motion information if the two motion information point to different reference frame lists, otherwise it stores only the second motion information.

[0083] Optionally, the mergeCandList is constructed based on spatial domain motion information, temporal domain motion information, history-based motion information, and several other motion information. Illustratively, mergeCandList derives spatial domain motion information using positions such as 1 to 5 in FIG. 6A , and derives temporal domain motion information using positions such as 6 or 7 in FIG. 6A . The history-based motion information adds the motion information of a block to a first-in-first-out list each time the block is coded. The adding process may require several checks, such as whether the motion information overlaps with existing motion information in the list. In this way, the motion information in the history-based list can be referenced when coding the current block.

[0084] In some embodiments, a syntax description for a GPM is shown in Table 1. [Table 1] [Table 1-2]

[0085] As shown in Table 1, in merge mode, the current block can use CIIP or GPM if regular_merge_flag is not 1. If the current block does not use CIIP, it uses GPM, that is, as shown in the syntax "if(!ciip_flag[x0][y0])" in Table 1.

[0086] As can be seen from Table 1 above, the GPM needs to transmit three pieces of information in the codestream: merge_gpm_partition_idx, merge_gpm_idx0, and merge_gpm_idx1. x0, y0 are used to determine the coordinates (x0, y0) of the upper left luminance pixel of the current block relative to the upper left luminance pixel of the image. merge_gpm_partition_idx determines the partition shape of the GPM, which is the "simulation partition" as described above, and merge_gpm_partition_idx is the weight matrix derivation mode or weight derivation mode index described in this specification. merge_gpm_idx0 is the first merge candidate index, which is used to determine the first motion information or the first merge candidate based on the mergeCandList. merge_gpm_idx1 is the second merge candidate index, which is used to determine the second motion information or the second merge candidate based on mergeCandList. Only if MaxNumGpmMergeCand>2, i.e., the length of the candidate list is greater than 2, merge_gpm_idx1 needs to be decoded; otherwise, it can be determined directly.

[0087] In some embodiments, the decoding process of the GPM comprises: The information input in the decoding process includes the coordinates (xCb, yCb) of the luminance location of the top left corner of the current block relative to the top left corner of the image, the width of the luminance component of the current block cbWidth, the height of the luminance component of the current block cbHeight, 1 / 16 pixel precision luminance motion vectors mvA and mvB, chrominance motion vectors mvCA and mvCB, reference frame indices refIdxA and refIdxB, and prediction list flags predListFlagA and predListFlagB.

[0088] Illustratively, motion information may be represented by a combination of a motion vector, a reference frame index, and a prediction list flag. VVC supports two reference frame lists, each of which can contain multiple reference frames. Unidirectional prediction uses only one reference block of one reference frame in one of the reference frame lists as a reference, while bidirectional prediction uses one reference block of each reference frame in each of the two reference frame lists as a reference. Meanwhile, GPM in VVC uses two unidirectional predictions. Among the above mvA and mvB, mvCA and mvCB, refIdxA and refIdxB, and predListFlagA and predListFlagB, A can be understood as a first prediction mode, and B can be understood as a second prediction mode. X represents A or B, predListFlagX represents whether X uses the first or second reference frame list, refIdxX represents the reference frame index in the reference frame list used by X, mvX represents the luma motion vector used by X, and mvCX represents the chroma motion vector used by X. Again, in VVC, it is contemplated that the motion vector, reference frame index, and prediction list flag may be combined to represent the motion information described herein.

[0089] The input information for the decoding process includes a luma prediction sample matrix predSamplesL of (cbWidth) x (cbHeight), an optional Cb chroma prediction sample matrix of (cbWidth / SubWidthC) x (cbHeight / SubHeightC), and an optional Cr chroma prediction sample matrix of (cbWidth / SubWidthC) x (cbHeight / SubHeightC).

[0090] For illustrative purposes, the luminance component is taken as an example below, but the processing of the chrominance component is similar to that of the luminance component.

[0091] Assume that predSamplesLAL and predSamplesLBL have a size of (cbWidth) × (cbHeight) and are prediction sample matrices for two prediction modes. predSamplesL is derived by determining predSamplesLAL and predSamplesLBL based on luma motion vectors mvA and mvB, chroma motion vectors mvCA and mvCB, reference frame indices refIdxA and refIdxB, and prediction list flags predListFlagA and predListFlagB, respectively. That is, prediction is performed based on the motion information of each of the two prediction modes, and the detailed process is omitted. Usually, GPM is a merge mode, and both of the two prediction modes of GPM are considered to be merge modes.

[0092] Based on merge_gpm_partition_idx[xCb][yCb], the GPM partition angle index variable angleIdx and distance index variable distanceIdx are determined using Table 2. [Table 2]

[0093] Because all three components (e.g., Y, Cb, and Cr) can use GPM, some standard texts separate the process of generating the GPM predicted sample matrix for one component into a single subprocess, called the GPM weighted sample prediction process (GPM weighted sample prediction process for geometric partitioning mode). All three components call this process, but the parameters are different. Here, we will use only the luma component as an example. The prediction matrix predSamplesL[xL][yL] (where xL = 0..cbWidth-1, yL = 0..cbHeight-1) for the current luma block is derived by the GPM weighted prediction process. nCbW is set to cbWidth, and nCbH is set to cbHeight. The inputs are the predicted sample matrices predSamplesLAL and predSamplesLBL created in the two prediction modes, as well as angleIdx and distanceIdx.

[0094] In some embodiments, the weighted prediction derivation process of the GPM comprises: This process includes inputs of the width nCbW and height nCbH of the current block, two (nCbW) × (nCbH) predicted sample matrices predSamplesLA and predSamplesLB, a GPM division angle index variable angleIdx, a GPM distance index variable distanceIdx, and a component index variable cIdx. Since this example takes luminance as an example, cIdx is set to 0, representing the luminance component.

[0095] The output of this process comprises a (nCbW) x (nCbH) GPM predicted sample matrix pbSamples.

[0096] Illustratively, the variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived in the following manner. nW=(cIdx==0)?nCbW:nCbW*SubWidthC; nH=(cIdx==0)?nCbH:nCbH*SubHeightC; shift1=Max(5,17-BitDepth), where BitDepth is the bit depth of the codec; offset1=1<<(shift1-1), where "<<" indicates left shift; displacementX=angleIdx; displacementY=(angleIdx+8)%32; partFlip=(angleIdx>=13&&angleIdx<=27)?0:1; shiftHor=( angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))?0:1

[0097] The variables offsetX and offsetY are derived in the following way. If the value of shiftHor is 0, offsetX=(-nW)>>1, offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)); If the value of shiftHor is 1, offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3), offsetY=(-nH)>>1

[0098] The variables xL and yL are derived in the following way. xL=(cIdx==0)?x:x*SubWidthC, yL=(cIdx==0)?y:y*SubHeightC

[0099] The variable wValue, which represents the prediction sample weight at the current position, is derived by: 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 second prediction mode at point (x,y).

[0100] Here, the distance matrix disLut is determined according to Table 3. [Table 3] weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+(((yL+offsetY)<<1)+1)*disLut[displacementY], weightIdxL=partFlip?32+weightIdx:32-weightIdx, wValue=Clip3( 0, 8, ( weightIdxL + 4 ) >> 3 ), The predicted sample values ​​pbSamples[x][y] are derived in the following way. pbSamples[x][y]=Clip3(0,(1<<BitDepth)-1,(predSamplesLA[x][y]*wValue+predSamplesLB[x][y]*(8-wValue)+offset1)> >shift1)

[0101] Note that one weight value is derived for each position of the current block, and then one predicted value pbSamples[x][y] of the GPM is calculated. In this embodiment, the weights wValue do not need to be written in matrix form; however, it can be understood that if the wValues ​​for each position are stored in a single matrix, this becomes a single weight matrix. The principle of calculating and weighting each weight for each point to obtain a predicted value of the GPM, or calculating all weights and weighting them all at once to obtain a predicted sample matrix of the GPM, is the same. Furthermore, the term "weight matrix" is used in many explanations in this application to make the expression easier to understand. Drawing diagrams using a weight matrix is ​​more intuitive, and in practice, explanations can also be made using the weights for each position. For example, the weight matrix derivation mode may also be called a weight derivation mode.

[0102] In some embodiments, as shown in FIG. 6B , the GPM decoding process can be expressed as analyzing the codestream, determining whether the current block uses GPM technology, and if the current block uses GPM technology, determining a weight derivation mode (or partition mode or weight matrix derivation mode), and first and second motion information; respectively determining a first prediction block based on the first motion information, determining a second prediction block based on the second motion information, determining a weight matrix based on the weight matrix derivation mode, and determining a prediction block for the current block based on the first prediction block, the second prediction block, and the weight matrix.

[0103] The intra prediction method predicts a current block using coded reconstructed pixels surrounding the current block as reference pixels. FIG. 7A is a schematic diagram of intra prediction. As shown in FIG. 7A, the size of the current block is 4x4, and the pixels in one column to the left and one row above the current block are reference pixels for the current block. Intra prediction predicts the current block using these reference pixels. All of these reference pixels may already be available, i.e., they may all be coded. Some may not be available. For example, if the current block is the leftmost block in the entire frame, the reference pixels to the left of the current block may not be available. Alternatively, if the lower left portion of the current block has not yet been coded when coding the current block, the reference pixels to the lower left may also not be available. If reference pixels are unavailable, they may be filled using available reference pixels, a specific value, or a specific method, or they may not be filled.

[0104] FIG. 7B is a schematic diagram of intra prediction. As shown in FIG. 7B, the multi-reference line (MRL) intra prediction method can improve codec efficiency by using more reference pixels, for example, four reference rows / columns can be used as reference pixels for the current block.

[0105] Furthermore, there are multiple prediction modes for intra prediction, as shown in Figure 8A- 8 I is a schematic diagram of intra prediction, and Fig. 8A- 8 As shown in I, the intra prediction for a 4x4 block in H.264 can mainly include nine modes. Here, mode 0 shown in Fig. 8A copies the upper pixel of the current block to the current block as a predicted value in the vertical direction, mode 1 shown in Fig. 8B copies the reference pixel on the left side to the current block as a predicted value in the horizontal direction, and mode 2 shown in Fig. 8C uses the average value of eight points A to D and I to L by direct current DC as the predicted value of all points, and 8Modes 3 to 8 shown in I each copy the reference pixels to the corresponding positions of the current block at a certain angle. Since some positions of the current block cannot be exactly matched with the reference pixels, it may be necessary to use the weighted average of the reference pixels or the fractional pixels of the interpolated reference pixels.

[0106] Other modes include Planar and Planar, and the number of angular prediction modes is also increasing with technological advances and block expansion. Figure 9 is a schematic diagram of intra prediction modes. As shown in Figure 9, the intra prediction modes used in HEVC include Planar, DC, and 33 angular modes, for a total of 35 prediction modes. Figure 10 is a schematic diagram of intra prediction modes. As shown in Figure 10, the intra modes used in VVC include Planar, DC, and 65 angular modes, for a total of 67 prediction modes. Figure 11 is a schematic diagram of intra prediction modes. As shown in Figure 11, VS3 uses 66 prediction modes, including DC, Planar, Bilinear, PCM, and 62 angular modes, for a total of 66 prediction modes.

[0107] Furthermore, there are several techniques for improving prediction, such as improving fractional pixel interpolation of reference pixels and filtering of predicted pixels. For example, the multiple intraprediction filter (MIPF) in AVS3 generates predicted values ​​using different filters for different block sizes. For pixels at different positions within the same block, pixels relatively close to the reference pixels generate predicted values ​​using one filter, and pixels relatively far from the reference pixels generate predicted values ​​using another filter. A technique for filtering predicted pixels is, for example, the intraprediction filter (IPF) in AVS3, which can filter predicted values ​​using reference pixels.

[0108] In intra prediction, coding efficiency can be improved by using an intra mode encoding technique of a most probable mode list (MPM). The mode list is configured using intra prediction modes of neighboring coded blocks, intra prediction modes derived from the intra prediction modes of neighboring coded blocks (e.g., neighboring modes), and several intra prediction modes that are commonly used or have a relatively high usage probability (e.g., DC, planar, bilinear modes, etc.). Intra prediction modes that reference the intra prediction modes of neighboring coded blocks utilize spatial correlation, since textures have a certain degree of spatial continuity. MPM may be used as a prediction for the intra prediction mode. That is, it is considered that the current block is more likely to use MPM than not to use MPM. Therefore, by using fewer codewords for MPM during binarization, overhead is saved and codec efficiency is improved.

[0109] In some embodiments, matrix-based intra prediction (MIP), sometimes referred to as matrix-weighted intra prediction, may be used to perform intra prediction. As shown in FIG. 12, to predict a block with width W and height H, MIP requires H reconstructed pixels in a column to the left of the current block and W reconstructed pixels in a row above the current block as input. MIP generates a predicted block through three steps: reference pixel averaging, matrix vector multiplication, and interpolation. Here, matrix multiplication is the core of MIP. MIP can be considered a process of generating a predicted block using input pixels (reference pixels) through matrix multiplication. MIP provides multiple matrices, and different prediction methods are reflected in different matrices. Using different matrices for the same input pixels will produce different results. The reference pixel averaging and interpolation processes are a design trade-off between performance and complexity. For relatively large blocks, averaging reference pixels can achieve an effect similar to downsampling, fitting the input into a relatively small matrix, while interpolation can achieve an upsampling effect. This eliminates the need to provide a MIP matrix for blocks of each size, and only one or a few matrices of a specific size are required. As the need for compression performance increases and hardware capabilities improve, more complex MIPs may appear in future standards.

[0110] MIPs are somewhat similar to planar, but are clearly more complex and flexible than planar.

[0111] In some embodiments, a template-based intra mode derivation (TIMD) intra prediction technique can be used. For example, as shown in FIG. 13, the regions to the left and above the current block are used as templates. Except for boundary cases, when coding the current block, theoretically, reconstructed values ​​are available on the left and above the current block. This is also the basis for many template adaptation methods. TIMD uses the regions to the left and above the current block shown in FIG. 13 as templates, and the pixels to the left and above the template are used as reference pixels for the template. A decoder can perform prediction on a template using a specific intra prediction mode and compare the predicted values ​​with the reconstructed values ​​to obtain the cost of that intra prediction mode on the template. For example, SAD, SATD, SSE, etc. Because the template and the current block are adjacent and related, the performance of a prediction mode on the template can be used to estimate the performance on the current block. TIMD predicts several candidate intra-prediction modes on a template, obtains their costs on the template, and selects one or two intra-prediction modes with the lowest costs as the intra-predicted values ​​for the current block.

[0112] Research has shown that weighted averaging of the predicted values ​​of two intra-prediction modes can improve compression performance, provided that the cost difference between the two intra-prediction modes on the template is not large. The weights of the predicted values ​​of the two prediction modes are related to the aforementioned costs, and in some embodiments, the weights are inversely proportional to the costs.

[0113] Generally, TIMD utilizes the prediction effect of the intra prediction mode on the template to filter the intra prediction mode, and can weight two intra prediction modes according to the cost on the template. The advantage of TIMD is that when the current block selects the TIMD mode, it is not necessary to specifically indicate which intra prediction mode is used, and the decoder itself can derive it through the above process, thereby saving some overhead.

[0114] In some embodiments, an intra prediction technique called decoder-side intra mode derivation (DIMD) can be used. DIMD also derives a prediction mode using reconstructed pixels to the left and top of the current block, but instead of predicting on a template, it analyzes the gradient of the reconstructed pixels. As shown in FIG. 14A, DIMD analyzes the gradient of the center point of the window, adapts the intra prediction mode according to the gradient, and analyzes all points that require checking, resulting in a result similar to the bar graph of FIG. 14A. Of course, the bar graph is merely for ease of understanding, and various simple forms can be used for specific implementations. In some embodiments, DIMD selects the two highest intra prediction modes in the bar graph, adds the planar mode, and weights the predicted values ​​of the three intra prediction modes, with the weights corresponding to the analysis results.

[0115] In one example, as shown in Figure 14B, the DIMD prediction process selects the intra-prediction modes corresponding to the two highest values ​​in the bar graph, i.e., M1 and M2, and then adds the planar mode to select three intra-prediction modes. Then, weights ω1, ω2, and ω3 corresponding to the three intra-prediction modes are determined, and predicted values ​​Pred1, Pred2, and Pred3 corresponding to the three intra-prediction modes are determined. The predicted values ​​corresponding to the three intra-prediction modes are weighted based on the weights corresponding to the three intra-prediction modes to obtain the final predicted block.

[0116] As can be seen from the above, DIMD filters the intra prediction mode using gradient analysis of the reconstructed pixels, and also adds planar to the two intra prediction modes and weights them based on the analysis results. The advantage of DIMD is that if the current block selects DIMD mode, it is not necessary to specify which intra prediction mode is being used, and the decoder itself derives it through the above process, thereby saving some overhead.

[0117] TIMD and DIMD have many similarities, and in some embodiments, their names are reversed. They all support weighting of the predictors of two or more intra-prediction modes.

[0118] GPM combines two inter-predicted blocks using a weight matrix. In practice, it can be extended to combine any two predicted blocks. For example, two inter-predicted blocks, two intra-predicted blocks, or one inter-predicted block and one intra-predicted block. Furthermore, in screen content coding, IBC (intra block copy) or palette predicted blocks may be used as one or two of the predicted blocks.

[0119] In this application, intra, inter, IBC, and palette are referred to as different prediction methods. For convenience of explanation, the term prediction mode is used herein. A prediction mode can be understood as information on which a codec can generate a prediction block for a current block. For example, in intra prediction, the prediction mode may be a specific intra prediction mode, such as DC, planar, or various intra angle prediction modes. Of course, some or all of the auxiliary information, such as an optimization method for intra reference pixels or an optimization method (e.g., filtering) after generating a basic prediction block, can be added. For example, in inter prediction, the prediction mode may be skip mode, merge mode, MMVD (merge with motion vector difference) mode, or AMVP (advanced motion vector prediction), and may be unidirectional prediction, bidirectional prediction, or multi-hypothesis prediction. When an inter prediction mode uses unidirectional prediction, a prediction mode must also be able to determine one motion information, and a prediction block can be determined based on the motion information. When the inter prediction mode uses bidirectional prediction, one prediction mode needs to be able to determine two more pieces of motion information, and can determine a prediction block based on the two pieces of motion information.

[0120] The information required to determine the GPM can be expressed as one weight derivation mode and two prediction modes. The weight derivation mode is used to determine a weight matrix or weights, and the two prediction modes each determine one predicted block or predicted value. The weight derivation mode is sometimes also called a partitioning mode. However, because it is a simulation partitioning, it is referred to as the weight derivation mode in this application.

[0121] Optionally, the two prediction modes can be derived from the same or different prediction methods, where the prediction modes include, but are not limited to, intra prediction, inter prediction, IBC, and palette.

[0122] One specific example is as follows: if the current block uses GPM, this example is used for inter-encoded blocks and allows the use of merge mode in intra and inter prediction. As shown in Table 4, the syntax element intra_mode_idx is added to indicate which prediction modes are intra prediction modes. For example, when intra_mode_idx is 0, it indicates that both prediction modes are inter prediction modes, i.e., mode0IsInter is 1 and mode0IsInter is 1; when intra_mode_idx is 1, it indicates that the first prediction mode is an intra prediction mode and the second prediction mode is an inter prediction mode, i.e., mode0IsInter is 0 and mode0IsInter is 1; when intra_mode_idx is 2, it indicates that the first prediction mode is an inter prediction mode and the second prediction mode is an intra prediction mode, i.e., mode0IsInter is 1 and mode0IsInter is 0; when intra_mode_idx is 3, it indicates that both prediction modes are intra prediction modes, i.e., mode0IsInter is 0 and mode0IsInter is 0. [Table 4]

[0123] In some embodiments, as shown in FIG. 15 , the GPM decoding process may be expressed as analyzing the codestream, determining whether the current block uses GPM technology, and if the current block uses GPM technology, determining a weight derivation mode (or partition mode or weight matrix derivation mode), and a first prediction mode and a second prediction mode; respectively determining a first prediction block based on the first prediction mode, determining a second prediction block based on the second prediction mode, determining a weight matrix based on the weight matrix derivation mode, and determining a prediction block for the current block based on the first prediction block, the second prediction block, and the weight matrix.

[0124] Template matching is the first method used for inter prediction, using the correlation between neighboring pixels to select a region surrounding the current block as a template. When the current block is coded, its left and upper sides are already coded according to the encoding order. Of course, existing hardware decoders do not guarantee that the left and upper sides of the current block are already decoded when decoding begins. However, this refers to inter blocks. For example, in HEVC, an inter-encoded block does not require surrounding reconstructed pixels to generate a predicted block, so the prediction process for inter blocks can be performed in parallel. However, intra-encoded blocks always require reconstructed pixels on the left and upper sides as reference pixels. Theoretically, the left and upper sides are available, meaning that adjustments can be made depending on the hardware design. Relatively, the right and lower sides are unavailable in the encoding order of current standards such as VVC.

[0125] As shown in FIG. 16, rectangular regions on the left and top of the current block are used as templates. The height of the left template portion is typically the same as the height of the current block, and the width of the top template portion is typically the same as the width of the current block, although they may differ. The optimal matching position of the template in a reference frame is found to determine the motion information or motion vector of the current block. This process can be roughly described as searching within a certain range from a starting position in a certain reference frame. Search rules, such as the search range and search steps, can be preset. Each time a position is moved, the degree of matching between the template corresponding to that position and templates surrounding the current block is calculated. The so-called matching degree can be measured by several distortion costs, such as SAD (sum of absolute difference) and SATD (sum of absolute transformed difference). Transforms commonly used in SATD include the Hadamard transform and MSE (mean-square error). A smaller value of SAD, SATD, or MSE indicates a higher matching degree. The cost is calculated using the predicted block of the template corresponding to that position and the reconstructed blocks of the template surrounding the current block. In addition to searching for integer pixel positions, sub-pel positions may also be searched, and the motion information for the current block may be determined based on the position with the highest degree of matching. By utilizing the correlation between adjacent pixels, the motion information suitable for the template may also be the motion information suitable for the current block. Of course, the template matching method may not necessarily be applicable to all blocks, so several methods can be used to determine whether the current block uses the template matching method. For example, a control switch can be used to indicate whether the current block uses the template matching method. One name for such a template matching method is DMVD (decoder side motion vector derivation).Both the encoder and decoder can search using templates to derive motion information or find better motion information based on the original motion information. There is no need to transmit specific motion vectors or motion vector differences, and both the encoder and decoder use the same search rules to ensure consistency between encoding and decoding. Template matching can improve compression performance, but it also requires searching within the decoder, which increases the decoder's complexity to a certain extent.

[0126] While the above applies the template matching method to intra-frame coding, it can also be applied to intra-frame coding. For example, an intra-frame prediction mode is determined using a template. For the current block, a certain range of regions above and to the left of the current block, such as the rectangular region on the left and the rectangular region above as shown in the figure above, can be used as the template. The reconstructed pixels in the template are available for coding the current block. This process can be roughly described as determining a set of candidate intra-frame prediction modes for the current block, where the candidate intra-frame prediction modes constitute a subset of all available intra-frame prediction modes. Of course, the candidate intra-frame prediction modes may also be the entire set of all available intra-frame prediction modes. This can be determined based on a trade-off between performance and complexity. The set of candidate intra-frame prediction modes can be determined according to MPM or some other rule, such as equal-interval filtering. The cost of each candidate intra-frame prediction mode on the template, such as SAD, SATD, or MSE, is calculated. Prediction is performed on the template using this mode to generate a predicted block, and the cost is calculated using the predicted block and the reconstructed block from the template. A mode with a lower cost may be a better match to the template, and by utilizing the similarity between neighboring pixels, an intra prediction mode that performs well on the template may also be an intra prediction mode that performs well on the current block. One or more low-cost modes are selected. Of course, the above two steps can be repeated. For example, after selecting one or more low-cost modes, a set of candidate intra prediction modes is determined again, the costs for the newly determined set of candidate intra prediction modes are recalculated, and one or more low-cost modes are selected. This can also be understood as rough selection or fine selection. The finally selected intra prediction mode is determined as the intra prediction mode for the current block, or the finally selected multiple intra prediction modes are used as candidate intra prediction modes for the current block.Of course, the candidate intra-prediction mode set can also be sorted solely by template matching, for example, by sorting the MPM list, i.e., each mode in the MPM list is calculated by creating a prediction block on a template, and the cost is then determined, and the mode is sorted from lowest cost to highest cost. Generally, the higher a mode is in the MPM list, the less overhead it will incur in the codestream, thereby achieving the goal of improving compression efficiency.

[0127] The template matching method is used to determine the two prediction modes of the GPM. When the template matching method is used for the GPM, one control switch for the current block may control whether the two prediction modes of the current block use template matching, or two control switches may each control whether the two prediction modes use template matching.

[0128] The other is how to use template matching. For example, when a GPM is used in merge mode, such as a GPM in VVC, merge_gpm_idxX is used to determine motion information from mergeCandList, where capital X is 0 or 1. For the Xth motion information, one method is to optimize it using a template matching method based on the motion information. That is, by determining one piece of motion information from mergeCandList based on merge_gpm_idxX and using template matching on that motion information, the optimization is performed using a template matching method based on the motion information. Another method is to determine the motion information by directly searching based on one default motion information, rather than determining the motion information from mergeCandList using merge_gpm_idxX.

[0129] If the Xth prediction mode is an intra prediction mode and the Xth prediction mode of the current block uses a template matching method, an intra prediction mode can be determined using the template matching method, and the index of the intra prediction mode does not need to be indicated in the code stream. Alternatively, to determine a candidate set or MPM list using the template matching method, the index of the intra prediction mode needs to be indicated in the code stream.

[0130] In one GPM intra and inter prediction method, a GPM prediction value is obtained by weighting one intra prediction value and one inter prediction value using the weight of the GPM mode. Here, the prediction mode information (motion information) for inter prediction is derived in the same way as in the VVC standard. For the prediction mode for intra prediction, a candidate intra prediction mode list for the corresponding part of the GPM mode must be constructed, which may also be referred to as an MPM list. The encoder writes the index of the intra prediction mode selected by the current block to the codestream, and the decoder constructs the MPM list for the corresponding GPM mode in the same way during decoding and determines the intra prediction mode based on the index of the intra prediction mode obtained by decoding. For example, the corresponding parts of the GPM mode can be understood as white or black parts in the division diagrams of FIG. 4 or FIG. 5, and may be referred to as the first part and the second part below for convenience of explanation. For example, the first part is the white part, and the second part is the black part. The first part corresponds to the first prediction mode, and the second part corresponds to the second prediction mode. The first and second parts are more intuitive and easier to understand, but may not actually appear in concrete algorithms.

[0131] When constructing the MPM list of intra prediction modes corresponding to the above GPM modes, the list length is 3. 1. Intra prediction mode parallel to the GPM dividing line; 2. Intra prediction modes derived by DIMD, 3. Intra prediction modes derived by TIMD; 4. Intra prediction mode of neighboring blocks; 5, intra prediction modes perpendicular to the GPM division line, and 6. Planar mode The intra prediction modes such as the above are sequentially added to the MPM list.

[0132] Here, the intra prediction mode parallel to the GPM division line is shown in Figure 17A, and the intra prediction mode perpendicular to the GPM division line is shown in Figure 17B. In a current specific implementation, the GPM division angle index angleIdx is determined based on the GPM mode, a lookup table corresponding to the intra prediction mode of angleIdx is constructed, and the intra prediction mode parallel to the GPM division line is determined from the lookup table based on angleIdx. The perpendicular intra prediction mode is calculated using the parallel intra prediction mode.

[0133] In some embodiments, when using the intra prediction mode of a neighboring block, the intra prediction modes of up to five neighboring blocks are used, and the positions of the five neighboring blocks are as shown in Figure 18. The coordinates of the upper left corner of the current block are (x0, y0), the width of the current block is width, and the height of the current block is height. The five neighboring blocks are neighboring block AL determined by coordinates (x0-1, y0-1), neighboring block A determined by coordinates (x0+width-1, y0-1), neighboring block AR determined by coordinates (x0+width, y0-1), neighboring block L determined by coordinates (x0-1, y0+height-1), and neighboring block BL determined by coordinates (x0-1, y0+height).

[0134] Depending on whether the intra prediction mode corresponds to the first part or the second part and the angle index angleIdx corresponding to the GPM mode, the range of available neighboring blocks is determined by referring to Table 5 below. [Table 5] In Table 5, A can be understood to be the neighboring block above the current block, and L can be understood to be the neighboring block to the left of the current block. If the result obtained by referring to Table 5 is A, the intra prediction mode of neighboring block A and the intra prediction mode of neighboring block AR can be used. If the result obtained by referring to the table is L, the intra prediction mode of neighboring block L and the intra prediction mode of neighboring block BL can be used. If the result obtained by referring to the table is L+A, the intra prediction modes of neighboring blocks A, AR, L, and BL can be used. The prediction mode of neighboring block AL is always available. The checking order of neighboring blocks is L->A->BL->AR->AL.

[0135] As can be seen from the above, a GPM has three elements: a weight matrix and two prediction modes. The advantage of a GPM is that the weight matrix allows for more autonomous combinations. However, a GPM requires more information to be determined, resulting in greater overhead in the codestream. Taking a GPM as an example, a GPM can optionally be used in merge mode. The weight matrix, first prediction mode, and second prediction mode are determined by merge_gpm_partition_idx, merge_gpm_idx0, and merge_gpm_idx1 in the codestream, respectively. The weight matrix and the two prediction modes each have multiple possible options. For example, VVC has 64 possible options for the weight matrix. Meanwhile, VVC allows up to six possible options for merge_gpm_idx0 and merge_gpm_idx1, but of course, VVC specifies that merge_gpm_idx0 and merge_gpm_idx1 do not overlap. Therefore, such a GPM has 65 x 6 x 5 possible options. On the other hand, when MMVD is used to optimize two pieces of motion information (prediction modes), it is possible to provide even more possible options for each prediction mode. This number is quite large. On the other hand, it has been discovered that a template matching method can also be used to optimize two pieces of motion information (prediction modes), providing even more possible options. Even in such a method that uses template matching to optimize two pieces of motion information (prediction modes), in light of the current state of technological evolution, it is necessary to use a block-level switch to indicate whether or not to use it for the current block.

[0136] On the other hand, if GPM uses two intra prediction modes, where each prediction mode can use the 67 normal intra prediction modes in VVC, then if the two intra prediction modes are different, there are also 64 x 67 x 66 possible choices. Of course, to save overhead, each prediction mode can be limited to use only a subset of all normal intra prediction modes, but there are still many possible choices.

[0137] If the GPM uses one intra prediction mode and one inter prediction mode, the situation can be inferred based on the above intra prediction mode and inter prediction mode situations.

[0138] In some embodiments, a codestream is written and parsed using syntax elements for one weight derivation mode and two prediction modes of the GPM. That is, one weight derivation mode has its own syntax element or elements, a first prediction mode has its own syntax element or elements, and a second prediction mode has its own syntax element or elements. Of course, the standard may impose restrictions such as requiring the second prediction mode not to be the same as the first prediction mode, or allowing a specific optimization method to be used for two prediction modes simultaneously (which may also be understood as being used for the current block), but the three are relatively independent in the writing and parsing of syntax elements. While this so-called relative independence can be understood to have a certain degree of relevance, other possible options after removing the restrictions remain independent.

[0139] For events with equal probability, fixed-length coding is appropriate. When the probability is clearly defined, using short codes for high-probability events and long codes for low-probability events can improve coding efficiency. On the other hand, for two modes with different dimensions, the weight derivation mode and the prediction mode, the probability estimates for them are separated from each other.

[0140] One weight derivation mode and two prediction modes jointly generate a single predicted block, which then acts on the current block. There is a relationship between them. For example, the current block contains the edges of two objects that move relatively, which is an ideal scenario for inter-GPM. Theoretically, this "split" should occur at the edge of the objects. However, in practice, the number of possible "splits" is limited, making it impossible to cover any edge. A close "split" may be selected. There may be multiple such close "splits," and the selection depends on which "split" produces the best combination with the two prediction modes. Similarly, the selection of a prediction mode may depend on which combination produces the best result. This is because, for natural video, even a portion using that prediction mode may have difficulty perfectly matching this portion with the current block, and the one ultimately selected may have the highest coding efficiency. Another GPM is often used when the current block contains a portion of an object with a relatively moving portion. For example, in areas where twisting or deformation occurs due to arm swinging, this "splitting" becomes even more ambiguous, and ultimately, the choice of which combination results in the best possible outcome. Another scenario is intra-prediction: some textures in natural images are very complex, some have gradations from one texture to another, and some may not be represented in a simple single direction. Therefore, intra-GPM can provide more complex prediction blocks, and intra-encoded blocks usually have larger residuals than inter-encoded blocks under the same quantization, and the choice of which prediction mode ultimately depends on which combination results in the best possible outcome.

[0141] The "combination" mentioned above means that a combination of a weight derivation mode and a prediction mode can be selected by combining them, rather than selecting the weight derivation mode and the prediction mode separately for two or three dimensions. This is reflected in the syntax element, i.e., the syntax element uses "combination," and the weight derivation mode and two prediction modes can be determined by this combination.

[0142] That is, the encoder and decoder can each generate the same N candidate combinations. For example, both the encoder and the decoder build a list of N candidate combinations, and each candidate combination can derive a combination of one weight derivation mode and two prediction modes. Meanwhile, in the codestream, the encoder only needs to write which candidate combination is finally selected, and the decoder analyzes which candidate combination is finally selected by the encoder. In this application, this list is called a GPM combination candidate list or a candidate combination list.

[0143] For example, if the GPM combination candidate list is roughly sorted in order of the probability of the combination being selected, shorter codewords can be used for some candidate combinations that are lower in the ranking than in existing methods. Meanwhile, longer codewords are used for some combinations with lower selection probabilities. This improves overall coding efficiency. Because existing methods are divided into three parts, the proposed method theoretically achieves greater flexibility and can more easily approximate the most efficient correspondence between probabilities and codewords.

[0144] Of course, as mentioned above, the number of possible combinations of a GPM can be quite large in some cases. To represent the large number of candidates, longer codewords are required. However, if certain combinations with too low a probability can be eliminated in advance, the cost of combinations with high probabilities can be reduced. While existing methods can partially eliminate situations with too low a probability, combinatorial approaches offer more flexibility. For example, when trying to eliminate one "split," existing methods eliminate all possibilities for that "split."

[0145] Another advantage is that doing it this way makes the syntax simpler, as it doesn't require any sort of context-based analysis at parse time.

[0146] As mentioned above, how to encode gpm_cand_idx is related to their probability. One example is to use Exponential-Golomb coding. If the number of candidates is relatively small, only the few most probable modes can be selected, or a fixed-length code can be used. For example, if there are only 16 candidates, it can be understood that the 16 candidates are encoded using a uniform bit length.

[0147] A different number of candidate combinations may be set for blocks of different sizes. For example, for smaller blocks, similar weight derivation modes or prediction modes have little difference in their influence on the prediction result, while for larger blocks, similar weight derivation modes or prediction modes have more significant difference in their influence on the prediction result. Therefore, one method is to set a relatively small number of candidate combinations for relatively small blocks and a relatively large number of candidate combinations for relatively large blocks. The size of the block can be determined based on the width or height of the block or the number of pixels of the block. In one example, the number of candidates is set to 8 for blocks with a pixel count of less than (or equal to or less than) 256, and the number of candidates is set to 16 for blocks with a pixel count of 256 or more.

[0148] The following describes the process of constructing the GPM combination candidate list.

[0149] In some embodiments, more relevant information can be used to analyze the magnitude of the probability of various combinations occurring, for example, using mode information of surrounding blocks to reconstruct pixels.

[0150] One method is to use templates to build a list of potential GPM combinations.

[0151] Typically, the height of the upper template and the width of the left template are the same, and this value may be 1, 2, 4, etc. As an example, when constructing a GPM combination candidate list using templates, the calculation complexity can be appropriately reduced by using an upper template with a height of 1 and / or a left template with a width of 1. Note that, here, the height of the upper template being 1 can be understood to mean that the upper template of the current block includes pixel points that have already been decoded or encoded in one row above the current block, and the width of the left template being 1 can be understood to mean that the left template of the current block includes pixel points that have already been decoded or encoded in the left list of the current block.

[0152] When using a template, the current block can use more relevant information, i.e., information already reconstructed around the current block, and therefore can better utilize the relationships between the above three elements. It can also be said that some situations of the current block are estimated using already reconstructed information around the current block.

[0153] One method is to predict a template for each combination using the GPM method and obtain a predicted block of the template for this combination. Since the template has already been reconstructed, the predicted block of the template for this combination and the reconstructed block of the template can be used to calculate the cost of prediction distortion, such as SAD, SATD, SSE, etc. Then, various combinations are sorted according to the cost of prediction distortion, or a list is constructed that only keeps the top N combinations with the smallest prediction distortion costs. This allows a GPM combination candidate list to be constructed.

[0154] The method is to, for a particular combination, generate a first predicted value of the template using a first prediction mode, generate a second predicted value of the template using a second prediction mode, derive weights for pixel locations on the template using a weight derivation mode, and determine the predicted value of the template based on the first predicted value, the second predicted value, and the weights.

[0155] Both the encoder and decoder must use the same method for constructing the GPM combination candidate list to ensure consistency between encoding and decoding. As mentioned above, the number of all possible GPM combinations can be quite large, and the above method is exhaustive. In a specific implementation, a fast algorithm can be used to construct the GPM combination candidate list, but the algorithm used by the encoder and decoder must be the same. For example, hierarchical filtering of various combinations, or prioritizing the checking of some combinations that are estimated to be relatively likely based on known information and setting several early termination conditions, etc.

[0156] In some embodiments, this embodiment is used for intra-encoded blocks and is not applied to screen content-encoded blocks. This does not mean that the present technical solution cannot be used for screen content-encoded blocks, but is merely used to explain the present technical solution using the simplest example. This is because, for blocks that are intra-encoded but not screen content-encoded, only the intra prediction mode needs to be considered, and there is no need to consider screen content-encoded modes such as IBC and palette or various inter modes. As described above, the present technical solution can be used in any situation where GPM is available.

[0157] Here, it is assumed that the GPM has 64 possible weight derivation modes and 67 possible intra prediction modes, which can be found in the VVC standard. However, the GPM is not limited to only 64 possible weights or any of the 64 possible weights. It should be noted that the VVC GPM's selection of 64 weights represents a trade-off between improved prediction performance and reduced overhead in the codestream. Because the proposed technique no longer uses fixed logic to encode weight derivation modes, the proposed technique theoretically allows for more diverse weights and more flexible use of them. Similarly, the GPM is not limited to only 67 possible intra prediction modes or any of the 67 possible intra prediction modes. Theoretically, all possible intra prediction modes can be used in the GPM. For example, as intra angle prediction modes become more granular and generate more intra angle prediction modes, the GPM can also use more intra angle prediction modes. For example, the MIP (matrix-based intra prediction) mode of VVC can also be used in this technical solution, but considering that MIP can further select multiple submodes, for ease of understanding, MIP is not included in this embodiment. In addition, there are several other wide-angle modes that can also be used in this technical solution, and their description will be omitted in this embodiment.

[0158] If two intra prediction modes are not allowed to be the same, a total of 64 × 67 × 66 possible combinations are possible in this embodiment. When using an exhaustive method, all of these possible combinations are predicted using a template, and the distortion cost of each combination is calculated. Furthermore, since the MPM list for the current block can be derived based on the prediction modes of surrounding blocks, it is not necessary to try each intra prediction mode. For example, in VVC, the current block can obtain an MPM list of length 6. Furthermore, in some subsequent technological advances, there is a secondary MPM technical proposal that derives an MPM list of length 22, and the combined length of the first MPM list and the second MPM list can also be said to be 22. In this technical proposal, intra prediction modes can be filtered using MPM. Of course, an MPM list applicable to the current block GPM mode can also be constructed. For example, prediction modes used by all blocks neighboring the current block are added to the MPM list. For example, if the MPM list does not include special prediction modes such as DC, horizontal prediction mode, or vertical prediction mode, one or some of these modes are added as candidate intra prediction modes in this technical proposal. For example, an intra prediction mode associated with a weight division line may be added to the candidate intra prediction modes of the proposed technique. One example is one or more intra angle prediction modes parallel or nearly parallel to the division line, and another example is one or more intra angle prediction modes perpendicular or nearly perpendicular to the division line. Alternatively, the candidate intra prediction modes of the proposed technique may be determined based on the weight derivation mode. Alternatively, candidate intra prediction modes of the proposed technique may be determined for each of the two intra prediction modes. In summary, at least one GPM intra prediction mode candidate set / list is obtained. Of course, the total number of available prediction modes may be limited to minimize decoding complexity, for example, to a maximum of six prediction modes. These methods may be used alone or in any combination.

[0159] As can be seen from the above, using intra-prediction modes in GPM requires building an MPM list or filtering a list or set of candidate prediction modes, which helps reduce overhead and complexity. For example, in the GPM combination encoding, screening intra-prediction modes reduces the number of possible combinations that need to be tried, thereby reducing the amount of calculations and complexity.

[0160] The difference between current GPM predictions for an entire block is that the block is divided into two parts, each of which has a strong correlation with neighboring blocks or reference pixels and a weak correlation with non-neighboring reference pixels. For example, in a VVC mode with a GPM index of 0, the current block is divided vertically into two parts, referred to herein as the left and right parts. The left part has a strong correlation with the left neighboring block or reference pixels, while the right part has a weak correlation with the left neighboring block or reference pixels because it is not adjacent to them. However, currently, when determining a list of candidate prediction modes, simply dividing the neighboring blocks into two categories, upper and left, is insufficient in accuracy. Consequently, the accuracy of the determined candidate prediction modes is insufficient, resulting in low prediction accuracy when predicting the current block based on the candidate prediction modes.

[0161] To solve the above technical problem, the present application provides the following: when encoding a current block, first determine N candidate weight derivation modes, then determine at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block, then determine a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, and then predict the current block using the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. That is, in the embodiment of the present application, when determining at least one candidate prediction mode, the weight derivation mode and attribute information of the current block are taken into consideration to improve the accuracy of determining the candidate prediction mode, and when predicting the current block based on the accurately determined candidate prediction mode, the prediction accuracy of the current block is improved, thereby improving codec performance.

[0162] Hereinafter, as shown in FIG. 19, the video decoding method provided in the embodiment of the present application will be described by taking the decoding side as an example.

[0163] Figure 19 is a flow diagram of a video decoding method provided in an embodiment of the present application, which is applied to the video decoder shown in Figures 1 and 3. As shown in Figure 19, the method of the embodiment of the present application includes the following steps:

[0164] S101, N candidate weight derivation modes are determined.

[0165] where N is a positive integer. Optionally, the N is a preset value or a default value. Optionally, the encoding side indicates the N to the decoding side, for example, the encoding side determines N candidate weight derivation modes and writes N into the codestream, so that the encoding side obtains N by decoding the codestream. Optionally, the decoding side may determine N in other ways, and the embodiments of the present application are not limited thereto.

[0166] As can be seen from the above, in the embodiment of the present application, one weight derivation mode and K prediction modes jointly generate one prediction block, and this prediction block acts on the current block, that is, the weight is determined based on the weight derivation mode, the current block is predicted based on the K prediction modes to obtain K prediction values, and the K prediction values ​​are weighted based on the weights to obtain the prediction value of the current block.

[0167] That is, when decoding the current block, the decoding side needs to determine N candidate weight derivation modes and multiple candidate prediction modes, further select one weight derivation mode from the N candidate weight derivation modes, select K prediction modes from the multiple candidate prediction modes, and further predict the current block using the selected one weight derivation mode and the K prediction modes to obtain a predicted value of the current block.

[0168] In the embodiment of the present invention, there is no limitation on the specific method by which the decoding side determines the N candidate weight derivation modes.

[0169] In one possible embodiment, there are 56 weight derivation modes in the AWP and 64 weight derivation modes in the GPM, and the N candidate weight derivation modes include at least one weight derivation mode of the 56 weight derivation modes in the AWP or at least one weight derivation mode of the 64 weight derivation modes in the GPM.

[0170] In one possible embodiment, several weight derivation modes in the AWP or GPM may be filtered as N candidate weight derivation modes. That is, the N candidate weight derivation modes in the embodiment of the present application are a subset of all weight derivation modes of the AWP or GPM. For example, the same "division" angle in a weight derivation mode can correspond to multiple offset amounts. For example, when these "division" angles are the same but the offset amounts are different, such as modes 10, 11, 12, and 13 in FIG. 4 or FIG. 5, modes corresponding to some offset amounts can be removed in the embodiment of the present application. Of course, modes corresponding to some "division" angles can also be removed. This reduces the total number of possible combinations and makes the differences between each possible combination more apparent. Of course, different filtering methods can be set for different block sizes. For example, fewer weight derivation modes can be used for relatively small blocks and more weight derivation modes can be used for larger blocks. Different filtering methods can also be set for different block shapes. One interpretation is that the block shape refers to the ratio of width to height.

[0171] In this embodiment, the encoding side and the decoding side have the same filtering method to obtain the N candidate weight derivation modes. In one example, the filtering method to obtain the N candidate weight derivation modes is the default on both sides of the codec. In another example, the encoding side may instruct the decoding side on the filtering method to obtain the N candidate weight derivation modes, so that the decoding side adopts the same method and filters the same N candidate weight derivation modes as the encoding side.

[0172] In some embodiments, N weight derivation modes are obtained by eliminating weight derivation modes corresponding to preset division angles and / or preset offset amounts from the M preset weight derivation modes. Since the same division angle in a weight derivation mode can correspond to multiple offset amounts, such as weight derivation modes 10, 11, 12, and 13 shown in FIG. 4, these division angles are the same but the offset amounts are different, so that weight derivation modes corresponding to some of the preset offset amounts can be eliminated and / or weight derivation modes corresponding to some of the preset division angles can be eliminated.

[0173] In some embodiments, the filtering conditions corresponding to different blocks may be different, so that when determining the N weight derivation modes corresponding to the current block, the filtering conditions corresponding to the current block are first determined, and then the N weight derivation modes are selected from the M preset weight derivation modes based on the filtering conditions corresponding to the current block.

[0174] In some embodiments, the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block. During prediction, for smaller blocks, similar weight derivation modes have little difference in their influence on the prediction result, while for larger blocks, similar weight derivation modes have more significant difference in their influence on the prediction result. Based on this, in embodiments of the present application, different N values ​​are set for blocks of different sizes, i.e., a larger N value is set for relatively larger blocks, and a smaller N value is set for relatively smaller blocks.

[0175] In one possible embodiment, N candidate weight derivation modes are indicated to the decoding side.

[0176] In some embodiments, the filtering condition comprises an array containing N elements, where the N elements correspond one-to-one to the N weight derivation modes, and an element corresponding to each weight derivation mode is used to indicate whether the weight derivation mode is available.

[0177] The above sequence may be a single-digit number or a two-digit number.

[0178] For example, taking GPM as an example, there are a total of 64 possible weight derivation modes, and a lookup table containing 64 elements is set on the encoding side, and the value of each element indicates whether or not the corresponding weight derivation mode is to be used.

[0179] As an example, taking a single-digit number as an example, a specific example is: g_sgpm_splitDir

[64] ={ 1,1,1,0,1,0,1,0, 1,0,1,0,1,0,1,0, 1,0,1,1,1,0,1,0, 1,0,1,0,1,0,1,0, 0,0,0,0,1,1,0,1, 0,0,1,0,0,1,0,0, 1,0,1,1,0,1,0,0, 1,0,0,1,0,0,1,0 }; and set the g_sgpm_splitDir array, where, if the value of g_sgpm_splitDir[x] is 1, it indicates that the weight derivation mode of index x can be used, otherwise it indicates that the weight derivation mode of index x cannot be used. In this example, the decoding side determines 26 candidate weight derivation modes from this array.

[0180] In another example, one array can be used to indicate N candidate weight derivation modes, and the array contains only the indices of the available weight derivation modes. For example, a length 26 array g_sgpm_splitDir

[26] ={0,1,6,8,10,12,14,16,18,19,20,22,24,26,28,30,36,37,42,45,48,50,51,53,56,59} can be used to indicate 26 candidate weight derivation modes. The decoding side determines the weight derivation mode corresponding to the index as a candidate weight derivation mode based on the weight derivation mode index contained in this array, thereby obtaining 26 candidate weight derivation modes.

[0181] In some embodiments, if the filtering conditions corresponding to the current block include a filtering condition corresponding to the size of the current block and a filtering condition corresponding to the shape of the current block, and for the same weight derivation mode, if the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicate that this weight derivation mode is all available, then determine this weight derivation mode as one of the N weight derivation modes, and if at least one of the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicates that this weight derivation mode is not available, then determine that this weight derivation mode does not constitute the N weight derivation modes.

[0182] In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes may be implemented using multiple arrays, respectively.

[0183] In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes may be realized using a two-bit array, i.e., one two-bit array includes both filtering conditions corresponding to block sizes and filtering conditions corresponding to block shapes.

[0184] For example, the filtering condition for a block of size A and shape B is: g_sgpm_splitDir

[64] ={ (1,1),(1,1),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (1,1),(0,0),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (0,1),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0), (1,1),(0,0),(0,1),(1,0),(1,0),(1,0),(1,0),(0,0), (0,0),(0,0),(1,1),(0,0),(1,1),(1,1),(1,0),(0,1), (0,0),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0), (1,0),(0,0),(1,1),(1,0),(1,0),(1,0),(0,0),(0,0), (1,1),(0,0),(1,1),(0,0),(0,0),(1,0),(1,1),(0,0) }; As shown in the figure, this filtering condition is represented by a 2-bit array, In the formula, if all values ​​of g_sgpm_splitDir[x] are 1, it indicates that the weight derivation mode of index x is available, and if one of the values ​​of g_sgpm_splitDir[x] is 0, it indicates that the weight derivation mode of index x is not available. For example, g_sgpm_splitDir[4]=(1,0) indicates that weight derivation mode 4 is available for blocks of size A but not for blocks of shape B, so when the block size is A and the shape is B, the weight derivation mode is not available.

[0185] In the above, an example was given in which the GPM includes 64 weight derivation modes, but the weight derivation modes in the embodiments of the present application include, but are not limited to, the 64 weight derivation modes included in the GPM and the 56 weight derivation modes included in the AMP.

[0186] In some embodiments, before determining the N candidate weight derivation modes, the decoding side must first determine whether the current block will undergo weighted prediction processing using K different prediction modes. If the decoding side determines that the current block will undergo weighted prediction processing using K different prediction modes, 2 01 to determine N candidate weight derivation modes. If the decoding side determines that the current block is not subjected to weighted prediction processing using K different prediction modes, it executes the above S 2 Skip step 01.

[0187] In one possible embodiment, the decoding side can determine whether the current block undergoes weighted prediction processing using K different prediction modes by determining the prediction mode parameter of the current block.

[0188] Optionally, in an embodiment of the present application, the prediction mode parameter may indicate whether the current block can use GPM mode or AWP mode, i.e., whether the current block can be predicted using K different prediction modes.

[0189] Note that, in this embodiment, the prediction mode parameter can be understood as a flag bit indicating whether the GPM mode or the AWP mode is used. Specifically, the encoder may use one variable as the prediction mode parameter, and the setting of the prediction mode parameter can be achieved by setting the value of the variable. Exemplarily, in this embodiment, if the current block uses the GPM mode or the AWP mode, the encoder may set the value of the prediction mode parameter to indicate that the current block uses the GPM mode or the AWP mode, specifically, the encoder may set the value of the variable to 1. Exemplarily, in this embodiment, if the current block does not use the GPM mode or the AWP mode, the encoder may set the value of the prediction mode parameter to indicate that the current block does not use the GPM mode or the AWP mode, specifically, the encoder may set the value of the variable to 0. Furthermore, in this embodiment, after the encoder completes setting the prediction mode parameter, the encoder may write the prediction mode parameter into a codestream and transmit it to a decoder, so that the decoder can obtain the prediction mode parameter after parsing the codestream.

[0190] Based on this, the decoding side decodes the code stream to obtain a prediction mode parameter, and then determines whether the current block uses GPM mode or AWP mode based on the prediction mode parameter. If the current block uses GPM mode or AWP mode, i.e., if prediction processing is performed using K different prediction modes, determines N candidate weight derivation modes corresponding to the current block.

[0191] In some embodiments, the embodiments of the present application may further conditionally restrict the current block to use the GPM mode or the AWP mode, i.e., if it is determined that the current block satisfies a predetermined condition, it may determine that the current block performs weighted prediction using K prediction modes, and thus determine N candidate weight derivation modes corresponding to the current block.

[0192] Illustratively, when applying the GPM mode or the AWP mode, the size of the current block can be limited.

[0193] In addition, since the prediction method provided in the embodiment of the present application requires generating K predicted values ​​using K different prediction modes respectively and then weighting the K predicted values ​​based on the weights to obtain a predicted value of the current block, in order to reduce complexity while considering the trade-off between compression performance and complexity, the embodiment of the present application may restrict the use of the GPM mode or AWP mode for blocks of a certain size. Therefore, in the present application, the decoder can first determine the size parameter of the current block, and then determine whether the current block uses the GPM mode or the AWP mode based on the size parameter.

[0194] In an embodiment of the present application, the size parameters of the current block may include the height and width of the current block, so that the decoder can determine whether the current block uses GPM mode or AWP mode according to the height and width of the current block.

[0195] Illustratively, in this application, it is determined that the current block can use GPM mode or AWP mode if the width is greater than threshold 1 and the height is greater than threshold 2. Thus, one possible restriction is to use GPM mode or AWP mode only if the width of the block is greater than (or equal to) threshold 1 and the height of the block is greater than (or equal to) threshold 2. Here, the values ​​of threshold 1 and threshold 2 may be 4, 8, 16, 32, 128, 256, etc., and threshold 1 may be equal to threshold 2.

[0196] Illustratively, in the present application, it is determined that the current block can use the GPM mode or the AWP mode if the width is smaller than the threshold 3 and the height is larger than the threshold 4. Thus, one possible restriction is to use the GPM mode or the AWP mode only if the width of the block is smaller than (or smaller than) the threshold 3 and the height of the block is larger than (or larger than) the threshold 4. Here, the values ​​of the threshold 3 and the threshold 4 may be 4, 8, 16, 32, 128, 256, etc., and the threshold 3 may be equal to the threshold 4.

[0197] Furthermore, in the present embodiment, pixel parameter restrictions may be implemented to limit the size of blocks that can use the GPM mode or AWP mode.

[0198] Illustratively, in this application, the decoder can first determine the pixel parameters of the current block, and then further determine whether the current block can use the GPM mode or the AWP mode based on the pixel parameters and the threshold value 5. Thus, one possible restriction is to use the GPM mode or the AWP mode only if the number of pixels of the block is greater than (or equal to) the threshold value 5. Here, the value of the threshold value 5 may be 4, 8, 16, 32, 128, 256, 1024, etc.

[0199] That is, in this application, the current block can use the GPM mode or the AWP mode only under the condition that the size parameter of the current block meets the size requirement.

[0200] For example, in this application, there may be a frame-level flag for determining whether or not a frame currently waiting to be decoded uses this application. For example, intraframes (e.g., I frames) can be configured to use this application, while interframes (e.g., B frames, P frames) do not. Alternatively, intraframes can be configured not to use this application, while interframes can be configured to use this application. Alternatively, some interframes can be configured to use this application, while some interframes do not. Since intraframes can also use intraprediction, there is a possibility that interframes can also use this application.

[0201] In some embodiments, there may also be a flag below the frame level to determine whether the current block uses this application.

[0202] After determining the N candidate weight derivation modes, the decoding side executes the following step S102.

[0203] S102: determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block;

[0204] Currently, for example, in the GPM intra and inter prediction methods, neighboring blocks are divided into two categories, upper and left, according to the dividing line angle, and at least one candidate prediction mode for the current block is determined based on the prediction modes of the upper and left neighboring blocks. However, such division is not accurate enough. For example, in the weight derivation mode of index 0, the current block is divided into two parts, a left part and a right part, in the vertical direction, and it can be determined that the neighboring block corresponding to the second part (i.e., the second prediction mode) is L+A, as shown in Table 5 above. That is, when constructing the candidate prediction mode list corresponding to the second prediction mode, the intra prediction modes of neighboring blocks A, AR, AL, L, and BL can be used. However, as can be seen from Figures 4 and 18, the second part of the current block, i.e., the black part corresponding to the second prediction mode, is not adjacent to the upper neighboring block A and the neighboring block AR in the upper right corner, and has a weak correlation with the neighboring blocks A and AR. Therefore, when directly determining the candidate prediction mode list for the second prediction mode of the current block based on the intra prediction modes of the neighboring blocks A, AR, AL, L, and BL, there may be a problem that the determined candidate prediction mode list is inaccurate.

[0205] 20A and 20B, the same weight derivation matrix for blocks of different shapes may have different effects on two prediction modes. For example, in a VVC mode where the GPM index is 13, the white portion of a block with an aspect ratio of 1:2 does not reach the upper left corner of the current block, whereas the white portion of a block with an aspect ratio of 2:1 does reach the upper left corner of the current block. That is, the attribute information of the current block also responds to the relationship between the adjacent blocks and the first and second portions of the current block.

[0206] Based on the above description, in the embodiment of the present application, when determining at least one candidate prediction mode, not only is the influence of the candidate weight derivation mode on the candidate prediction mode taken into consideration, but also the influence of the attribute information of the current block on the candidate prediction mode taken into consideration, thereby improving the accuracy of determining the candidate prediction mode.

[0207] In the embodiment of the present application, the specific content of the attribute information of the current block is not limited.

[0208] In some embodiments, the attribute information of the current block includes size information of the current block, such as the length and width of the current block, the aspect ratio of the current block, or the number of pixel points included in the current block.

[0209] In some embodiments, the attribute information of the current block further includes shape information of the current block, such as the shape of the current block being a square, the shape of the current block being a rectangle, or the shape of the current block being a predetermined shape such as a polygon or a circle.

[0210] In the embodiment of the present application, determining at least one candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block can be understood as determining which prediction mode of a neighboring block of the current block can be used to determine the candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block. For example, determining weights of the neighboring blocks based on the candidate weight derivation modes and attribute information of the current block, and determining which prediction mode of the neighboring block to select for use in determining the candidate prediction mode based on the weights of the neighboring blocks.

[0211] In the present embodiment, the prediction mode of the neighboring block refers to the prediction mode used when decoding the neighboring block.

[0212] For example, in a certain GPM weight derivation mode, if the weight of a neighboring block for a certain prediction mode (first prediction mode or second prediction mode) is greater than (or equal to) a certain threshold, it indicates that the neighboring block has a strong correlation with the area occupied by the current prediction mode; otherwise, it indicates that the neighboring block has a weak correlation with the area occupied by the current prediction mode.

[0213] In some embodiments, the decoding side determines at least one candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block, and this at least one candidate prediction mode constitutes a candidate prediction mode list. That is, in this embodiment, the N candidate weight derivation modes correspond to one candidate prediction mode list. For example, if the division line angles and offset amounts of the N candidate weight derivation modes are not significantly different from each other, in order to reduce the amount of calculation and improve decoding efficiency, the decoding side determines one candidate weight derivation mode A from among the N candidate weight derivation modes and determines one candidate prediction mode list based on this candidate weight derivation mode and attribute information of the current block. In one example, the candidate weight derivation mode A may be a default candidate weight derivation mode among the N candidate weight derivation modes. In another example, the encoding side instructs the decoding side an index of this candidate weight derivation mode A, so that the decoding side can decode the codestream and obtain the index of the candidate weight derivation mode A.

[0214] In some embodiments, at least one candidate weight derivation mode among the N candidate weight derivation modes corresponds to one candidate prediction mode list, for example, the decoding side determines one candidate prediction mode list for each candidate weight derivation mode among the N candidate weight derivation modes, and in this case, the above S102 includes the following step S102-A:

[0215] In step S102-A, for an ith candidate weight derivation mode among the N candidate weight derivation modes, a candidate prediction mode list corresponding to the ith candidate weight derivation mode is determined based on the ith candidate weight derivation mode and attribute information of the current block.

[0216] In this embodiment, the method for determining the candidate prediction mode list corresponding to each of the N candidate weight derivation modes is the same, so for convenience of explanation, the i-th candidate weight derivation mode of the N candidate weight derivation modes will be taken as an example. Here, the i-th candidate weight derivation mode can be understood as any of the N candidate weight derivation modes.

[0217] In the embodiment of the present application, there is no limitation on the specific form of determining the candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block.

[0218] In some embodiments, the i-th candidate weight derivation mode corresponds to one candidate prediction mode list, i.e., one candidate prediction mode list corresponding to the i-th candidate weight derivation mode is determined based on the i-th candidate weight derivation mode and attribute information of the current block. When predicting the current block in this way, K prediction modes are determined from the candidate prediction mode list corresponding to the i-th candidate weight derivation mode, and the current block is predicted using the i-th candidate weight derivation mode and the K prediction modes to obtain a predicted value of the current block. For example, weights are determined based on the i-th candidate weight derivation mode, the current block is predicted using the K prediction modes to obtain K predicted values, and the K predicted values ​​are weighted using the weights to obtain a predicted value of the current block in the i-th candidate weight derivation mode.

[0219] In one example of this embodiment, a method for determining a candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block may include determining a division line corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode, and dividing the current block by determining the division line based on attribute information of the current block to obtain a first portion and a second portion, where the first portion can be understood as a portion corresponding to the first prediction mode, and the second portion can be understood as a portion corresponding to the second prediction mode. In this way, it can be determined that the ith candidate weight derivation mode corresponds to one candidate prediction mode list based on the prediction modes of the neighboring blocks of the current block that are adjacent to the first portion of the current block.

[0220] In another example of this embodiment, a method for determining a candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block may include determining a weight of each neighboring block of the current block based on the ith candidate weight derivation mode and attribute information of the current block, and further determining that the ith candidate weight derivation mode corresponds to one candidate prediction mode list based on the weights of the neighboring blocks. For example, the ith candidate weight derivation mode may be determined to correspond to one candidate prediction mode list based on the prediction mode of a neighboring block with a relatively large weight.

[0221] In some embodiments, when the i-th candidate weight derivation mode corresponds to K prediction modes, the above S102-A includes the following step S102-A1.

[0222] In step S102-A1, a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i-th candidate weight derivation mode is determined based on the i-th candidate weight derivation mode and attribute information of the current block.

[0223] In this embodiment, the decoding side determines a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i-th candidate weight derivation mode.

[0224] For example, when K=2, the decoding side may determine one candidate prediction mode list for the first prediction mode but not for the second candidate prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block. Optionally, the decoding side may determine one candidate prediction mode list for the second prediction mode but not for the first candidate prediction mode. Optionally, the decoding side may determine one candidate prediction mode list for the first prediction mode and one candidate prediction mode list for the second candidate prediction mode. Optionally, the decoding side may determine a common candidate prediction mode list for the first prediction mode and the second prediction mode.

[0225] In an embodiment of the present application, a candidate prediction mode list is determined for at least one prediction mode corresponding to the i-th candidate weight derivation mode, and further, at least one prediction mode corresponding to the i-th candidate weight derivation mode is accurately determined from the constructed candidate prediction mode list.

[0226] In some embodiments, when the at least one prediction mode corresponds to one candidate prediction mode list, the above S102-A1 includes the following steps S102-A1-11 and S102-A1-12.

[0227] S102-A1-11, for a j-th prediction mode of the at least one prediction mode, determine a candidate prediction mode list for the j-th prediction mode according to the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer.

[0228] S102-A1-12: determining a candidate prediction mode list for at least one prediction mode based on the candidate prediction mode list for the j-th prediction mode;

[0229] In this embodiment, at least one prediction mode corresponding to the i-th candidate weight derivation mode corresponds to one candidate prediction mode list, that is, the candidate prediction mode list corresponding to this at least one prediction mode is the same, that is, one candidate prediction mode list, thereby reducing the complexity of determining the candidate prediction mode list and improving decoding efficiency. At this time, the decoding side determines one candidate prediction mode list for this at least one prediction mode.

[0230] Specifically, a candidate prediction mode list for a jth prediction mode among the at least one prediction mode is determined based on the ith candidate weight derivation mode and attribute information of the current block. Optionally, the jth prediction mode is one of the at least one prediction modes. Then, a candidate prediction mode list for the at least one prediction mode is determined based on the candidate prediction mode list for the jth prediction mode.

[0231] Here, a specific example of determining the candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j-th prediction mode in S102-A1-12 is as follows: Aspect 1 is aspect 1 in which the candidate prediction mode list of the j-th prediction mode is directly determined as the candidate prediction mode list of the at least one prediction mode; The present invention includes, but is not limited to, form 2, in which it is determined whether a candidate prediction mode list for a j-th prediction mode includes a preset prediction mode, and if the candidate prediction mode list for the j-th prediction mode includes the preset prediction mode, the candidate prediction mode list for the j-th prediction mode is determined as the candidate prediction mode list for at least one prediction mode, and if the candidate prediction mode list for the j-th prediction mode does not include the preset prediction mode, the preset prediction mode is added to the candidate prediction mode list for the j-th prediction mode to obtain a candidate prediction mode list for at least one prediction mode.

[0232] In the embodiment of the present application, the preset prediction mode in the above-mentioned second embodiment is not limited, and specifically, is determined according to actual needs.

[0233] In this embodiment, when the at least one prediction mode corresponds to one candidate prediction mode list, a specific process of determining the candidate prediction mode list for the at least one prediction mode will be described.

[0234] In some embodiments, when each prediction mode of the at least one prediction mode corresponds to one candidate prediction mode list, the above S102-A1 includes the following step S102-A1-21.

[0235] S102-A1-21, for a j-th prediction mode of the at least one prediction mode, determine a candidate prediction mode list for the j-th prediction mode according to the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer.

[0236] In this embodiment, since each prediction mode of the at least one prediction mode corresponds to one candidate prediction mode list, the decoding side determines, for an ith candidate weight derivation mode, one candidate prediction mode list for each prediction mode of the at least one prediction mode corresponding to the ith candidate weight derivation mode. For example, the at least one prediction mode includes a first prediction mode and a second prediction mode corresponding to the ith candidate weight derivation mode, and thus the encoding side determines one candidate prediction mode list for the first prediction mode and one candidate prediction mode list for the second prediction mode.

[0237] In this embodiment, the process of determining one candidate prediction mode list corresponding to each prediction mode among the at least one prediction mode is the same, and for convenience of explanation, the embodiment of the present application will be described as an example of determining a candidate prediction mode list for the jth prediction mode among the at least one prediction mode.

[0238] The following describes the process of determining the candidate prediction mode list for the j-th prediction mode based on the i-th candidate weight derivation mode and the attribute information of the current block in the above S102-A1-11 and S102-A1-21.

[0239] In the embodiment of the present application, specific embodiments for determining the candidate prediction mode list of the j-th prediction mode based on the i-th candidate weight derivation mode and the attribute information of the current block include at least the following two forms.

[0240] In the first embodiment, the decoding side determines the candidate prediction mode list for the j-th prediction mode by the method of steps 11 to 13 below: Step 11: determining a first lookup table including neighboring blocks corresponding to different prediction modes under different block attribute information and different weight derivation modes; Step 12: Determine the neighboring block corresponding to the jth prediction mode in the first lookup table according to the attribute information of the current block and the ith candidate weight derivation mode; Step 13: determining a candidate prediction mode list for the j-th prediction mode based on the prediction modes of the neighboring blocks corresponding to the j-th prediction mode;

[0241] In this form 1, based on different block attribute information, a first lookup table is determined which includes adjacent blocks corresponding to different prediction modes in different block attribute information and different weight derivation modes. In this way, by searching the first lookup table, the adjacent block corresponding to the jth prediction mode can be directly obtained, and thereby a candidate prediction mode list for the jth prediction mode is determined based on the prediction mode of the adjacent block corresponding to the jth prediction mode.

[0242] In the embodiment of the present application, the specific representation form of the first lookup table is not limited.

[0243] In one possible embodiment, the first lookup table includes P different sub lookup tables, where the P sub lookup tables respectively correspond to the P blocks of attribute information, and the lookup tables include neighboring blocks corresponding to different prediction modes in different weight derivation modes. In this way, the decoding side can determine a first sub lookup table corresponding to the current block from the P sub lookup tables based on the attribute information of the current block, where the first sub lookup table includes neighboring blocks corresponding to different prediction modes in different weight derivation modes, and then determine a neighboring block corresponding to the jth prediction mode in the first sub lookup table based on the i-th candidate weight derivation mode, and then determine a candidate prediction mode list for the jth prediction mode based on the prediction mode of the neighboring block corresponding to the jth prediction mode.

[0244] In the embodiment of the present application, different sub-lookup tables are determined based on the attribute information of different blocks, where the lookup tables include neighboring blocks corresponding to different prediction modes in different weight derivation modes.

[0245] In one example, it is assumed that the attribute information of a block includes the aspect ratio of the block, and that the P sub-lookup tables include a lookup table corresponding to blocks with an aspect ratio of 1:2, a lookup table corresponding to blocks with an aspect ratio of 1:1, and a lookup table corresponding to blocks with an aspect ratio of 2:1.

[0246] For example, a sub-lookup table corresponding to a block with an aspect ratio of 1:2 is shown in Table 6. [Table 6]

[0247] Thus, when decoding the current block, if the aspect ratio of the current block is determined to be 1:2 based on the size information of the current block, a first sub lookup table as shown in Table 6 is obtained from the P sub lookup tables. Next, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Specifically, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Assuming K=2, the j-th prediction mode is the first prediction mode, which corresponds to the first portion of Table 6 above. In this way, a neighboring block corresponding to the i-th prediction mode can be determined from the neighboring blocks corresponding to the first portion based on the i-th candidate weight derivation mode. For example, since the i-th candidate weight derivation mode is a4 and the neighboring block of the first portion corresponding to a4 is A, the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block are determined as neighboring blocks corresponding to the i-th prediction mode, and the candidate prediction mode list of the j-th prediction mode can be determined based on the prediction modes of the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block. For example, the prediction modes of the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block are added to the candidate prediction mode list of the j-th prediction mode in a predetermined order.

[0248] For example, a sub-lookup table corresponding to a block with an aspect ratio of 1:1 is shown in Table 7. [Table 7]

[0249] In this way, when decoding the current block, if it is determined that the aspect ratio of the current block is 1:1 based on the size information of the current block, the first sub-lookup table is obtained from the P sub-lookup tables as shown in Table 7. Then, based on the i-th candidate weight derivation mode, SubIn the lookup table, a neighboring block corresponding to the jth prediction mode is determined. Specifically, a neighboring block corresponding to the jth prediction mode is determined in the first sub-lookup table based on the ith candidate weight derivation mode. Assuming K=2, the jth prediction mode is the first prediction mode, which corresponds to the first part of Table 7 above. Thus, based on the ith candidate weight derivation mode, a neighboring block corresponding to the ith prediction mode can be determined from the neighboring blocks corresponding to the first part. For example, the ith candidate weight derivation mode is a2, and the neighboring block of the first part corresponding to a2 is L+A, so the left neighboring block, the lower left neighboring block, the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block are determined as neighboring blocks corresponding to the ith prediction mode. Thus, a candidate prediction mode list for the jth prediction mode can be determined based on the prediction modes of the left neighboring block, the lower left neighboring block, the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block. For example, the prediction modes of the left neighboring block, the lower left neighboring block, the upper left neighboring block, the upper neighboring block, and the upper right neighboring block of the current block are added to the candidate prediction mode list of the jth prediction mode in a predetermined order.

[0250] For example, a sub-lookup table corresponding to a block with an aspect ratio of 2:1 is shown in Table 8. [Table 8]

[0251] Thus, when decoding the current block, if it is determined that the aspect ratio of the current block is 2:1 based on the size information of the current block, a first sub lookup table as shown in Table 8 is obtained from the P sub lookup tables. Next, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Specifically, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Assuming K=2, the j-th prediction mode is the first prediction mode, which corresponds to the first portion of Table 8 above. In this way, a neighboring block corresponding to the i-th prediction mode can be determined from the neighboring blocks corresponding to the first portion based on the i-th candidate weight derivation mode. For example, since the i-th candidate weight derivation mode is a1 and the neighboring block of the first portion corresponding to a1 is L, the left neighboring block, the lower left neighboring block, and the upper left neighboring block of the current block are determined as neighboring blocks corresponding to the i-th prediction mode, and the candidate prediction mode list of the j-th prediction mode can be determined based on the prediction modes of the left neighboring block, the lower left neighboring block, and the upper left neighboring block of the current block. For example, the prediction modes of the left neighboring block, the lower left neighboring block, and the upper left neighboring block of the current block are added to the candidate prediction mode list of the j-th prediction mode in a predetermined order.

[0252] Note that the above Tables 6, 7, and 8 are merely examples and do not limit the embodiments of the present application. In the embodiments of the present application, the contents included in the sub lookup tables corresponding to blocks of different attribute information are specifically determined based on the actual situation.

[0253] The above Tables 7 and 8 show neighboring blocks corresponding to different prediction modes (ie, different parts) in different candidate weight derivation modes, where the candidate weight derivation modes can be understood as indexes of the candidate weight derivation modes.

[0254] In some embodiments, the candidate weight derivation mode may be replaced by an angle index, i.e., the above-mentioned sub lookup table includes neighboring blocks corresponding to different prediction modes at different angle indexes. In this way, when searching for neighboring blocks, first, a first sub lookup table is determined from the P lookup tables based on the attribute information of the current block, then an angle index corresponding to the i-th candidate prediction mode is determined, and then, based on this angle index, a neighboring block corresponding to the j-th prediction mode in the first sub lookup table is determined.

[0255] In some embodiments, the aspect ratio of the current block may be replaced with the shape index of the current block, e.g., a shape index of 0 represents a length:width ratio of 1:1, a shape index of 1 represents a length:width ratio of 2:1, a shape index of 2 represents a length:width ratio of 1:2, etc. Each shape index in the present embodiment builds a sub-lookup table, and thus there are P lookup tables.

[0256] In the embodiment of the present application, there is no limitation on the specific form in which the decoding side determines the P sub look-up tables.

[0257] In one possible embodiment, the encoding side transmits P sub lookup tables to the decoding side. Because the P sub lookup tables do not contain image information, in one example, the encoding side can transmit these P sub lookup tables to the decoding side in the same way as transmitting other data. In another example, the encoding side writes these P sub lookup tables into a codestream and transmits them to the decoding side.

[0258] In another possible embodiment, the decoding side obtains the P sub-lookup tables from other storage devices.

[0259] In yet another possible embodiment, P sub-lookup tables are stored on the decode side.

[0260] In another possible embodiment, the decoding side can construct P sub look-up tables. For example, for each candidate weight derivation mode among the N candidate weight derivation modes, a first adjacent block having a relatively strong association with the first portion of the block and a second adjacent block having a relatively strong association with the second portion of the block are determined based on the candidate weight derivation mode and block attribute information, and the sub look-up tables shown in Tables 6 to 8 above are constructed based on the first adjacent block and the second adjacent block.

[0261] In some embodiments, the first lookup table is a table including attribute information of different blocks and neighboring blocks corresponding to different prediction modes in different weight derivation modes, i.e., the sub-lookup tables shown in Tables 6 and 7 above are combined into one lookup table. [Table 9]

[0262] In this way, the decoding side can determine the adjacent block corresponding to the jth prediction mode in the first lookup table shown in Table 9 based on the attribute information of the current block and the i-th candidate weight derivation mode, and can determine the candidate prediction mode list for the jth prediction mode based on the prediction mode of the adjacent block corresponding to the j-th prediction mode.

[0263] The above-mentioned first embodiment indicates that the candidate prediction mode list for the j-th prediction mode is determined by searching a table based on the i-th candidate weight derivation mode and attribute information of the current block.

[0264] In some embodiments, the candidate prediction mode list for the j-th prediction mode may be determined according to the following form 2.

[0265] In the second aspect, the decoding side determines the candidate prediction mode list for the j-th prediction mode by the methods of steps 21 and 22: Step 21: determining a weight for the jth prediction mode of the neighboring block of the current block according to the ith candidate weight derivation mode and the attribute information of the current block; Step 22: determining a candidate prediction mode list for the j-th prediction mode based on the weight for the j-th prediction mode of the neighboring blocks;

[0266] In this form 2, a weight for the jth prediction mode of each adjacent block of the current block is determined, thereby determining which adjacent block's prediction mode to select, and constructing a candidate prediction mode list for the jth prediction mode.

[0267] The following describes a specific process for determining the weight for the j-th prediction mode of the neighboring block of the current block based on the i-th candidate weight derivation mode and the attribute information of the current block.

[0268] Here, in the above step 21, the method for determining the weight for the j-th prediction mode of the neighboring block of the current block includes, but is not limited to:

[0269] In form 1, for any of the adjacent blocks of the current block, a weight for the jth prediction mode of each point in the adjacent block is determined based on the i-th candidate weight derivation mode and attribute information of the current block, and a weight for the jth prediction mode of the adjacent block is determined based on the weight for the jth prediction mode of each point in the adjacent block.

[0270] In one example, the average value of the weights for the j-th prediction mode of each point in this neighboring block is determined as the weight for the j-th prediction mode of this neighboring block.

[0271] In another example, a weighted average of the weights for the j-th prediction mode of each point in the neighboring block is determined as the weight for the j-th prediction mode of the neighboring block. Optionally, when determining the weighted average, a relatively large weight is assigned to a pixel point in the neighboring block that is adjacent to the current block, and a relatively small weight is assigned to a pixel point in the neighboring block that is relatively far from the current block.

[0272] In yet another example, the sum of the weights for the j-th prediction mode of each point in the neighboring block is determined as the weight for the j-th prediction mode of the neighboring block.

[0273] In another example, a weighted sum of the weights for the j-th prediction mode of each point in the neighboring block is determined as the weight for the j-th prediction mode of the neighboring block. Optionally, when determining the weighted sum, a relatively large weight is assigned to a pixel point in the neighboring block that is adjacent to the current block, and a relatively small weight is assigned to a pixel point in the neighboring block that is relatively far from the current block.

[0274] In this embodiment, the method for determining the weight for the jth prediction mode of each point in the neighboring block based on the i-th candidate weight derivation mode and the attribute information of the current block is the same. In some embodiments, the neighboring blocks of the current block are located within the template of the current block, so that the weight of each point in the neighboring blocks can be determined after determining the weight of the template of the current block.

[0275] For example, the i candidate A template weight for the current block is determined based on the weight derivation mode, attribute information of the current block, and a template for the current block. For point 1 in the neighboring block, the weight corresponding to point 1 among the template weights of the current block is determined as the weight for the j-th prediction mode of point 1. According to this embodiment, it is possible to determine the weight for the j-th prediction mode of each point in the neighboring block.

[0276] In the second embodiment, the weight of a point in the neighboring block is determined as the weight for the j-th prediction mode of the neighboring block, and in this case, the step 21 is Step 21-A: determining a weight of a first point in an adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block; Step 21-B: determining the weight of the first point as the weight for the j-th prediction mode of the neighboring block.

[0277] In this form 2, the decoding side determines the weight for the jth prediction mode of the first point in the adjacent block, thereby determining the weight for the jth prediction mode of the adjacent block, thereby reducing the amount of calculation required to determine the weight of the adjacent block and ultimately improving decoding efficiency.

[0278] In the embodiment of the present application, the specific position of the first point within the adjacent block is not limited.

[0279] In one possible embodiment, the first point is any point within the adjacent block.

[0280] In another possible embodiment, the first point is a point adjacent to the current block in the neighboring block.

[0281] In this second embodiment, specific embodiments for determining the weight of the first point in the adjacent block include at least the following embodiments.

[0282] In the first form, the weight of the first point in the adjacent block is determined directly, and in this case, the above step 21-A is Step 21-A11 includes determining the weight of the first point based on the i-th candidate weight derivation mode, the attribute information of the current block, and the template of the current block.

[0283] In the embodiment of the present application, since the neighboring block is located within the template area of ​​the current block, the first point in the neighboring block is located within the template area of ​​the current block. Therefore, the weight of the first point can be determined by referring to the manner of determining the template weight of the current block, such as the following examples:

[0284] In Example 1, when the weight of each point in the template is determined, and a matrix composed of the weights of each point is determined as the weight of the template, the decoding side can directly determine the weight of the first point based on the i-th candidate weight derivation mode, the attribute information of the current block and the template of the current block, and the position information (x, y) of the first point in the template.

[0285] Specifically, an angle index and a distance index corresponding to the i-th candidate weight derivation mode are determined, and a first parameter of the first point in the template is determined based on the angle index, the distance index, the size of the template, and the position information (x, y) of the first point. In some embodiments, the first parameter is also called a weight index weightIdx, and the weight of the first point in the template is determined based on the first parameter of the first point in the template.

[0286] In one possible embodiment, the weight of the first point in the template is: The inputs of the weight derivation process for the first point in the template may be determined as follows: the width nCbW of the current block, the height nCbH of the current block, the width nVmW of the left template, the height nVmH of the upper template, the “split” angle index variable angleId of the i-th candidate weight derivation mode, the distance index variable distanceIdx of the i-th candidate weight derivation mode, and the component index variable cIdx, where, for example, since the present application takes the luminance component as an example, cIdx is 0, representing the luminance component.

[0287] Here, the variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived in the following manner. nW=(cIdx==0)?nCbW:nCbW*EubWidthC nH=(cIdx==0)?nCbH:nCbH*EubHeightC shift1=Max(5,17-BitDepth), where BitDepth is the bit depth of the codec. offset1=1<<(shift1-1) displacementX=angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)?0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))?0:1 Here, the offset amounts offsetX and offsetY are derived by the following method. If -shiftHor has a value of 0: offsetX=(-nW)>>1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) -Otherwise (i.e., shiftHor has a value of 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY=(-nH)>>1 The template weight matrix wVemplateValue[x][y] (where x = -nVmW..nCbW-1, y = -nVmH..nCbH-1, except when both x and y are 0 or greater) is calculated as follows, assuming that the coordinates of the top left corner of the current block are (0,0): The variables xL and yL are derived in the following way: xL=(cIdx==0)?x:x*EubWidthC yL=(cIdx==0)?y:y*EubHeightC where disLut is determined according to Table 3 above, Here, the first parameter, weightIdx, is weightIdx = ( ( ( xL + offsetX ) << 1 ) + 1 ) * disLut[ displacementX ] + ( ( ( yL + offsetY ) << 1 ) + 1 ) * disLut[ displacementY ] is derived by

[0288] After the first parameter weightIdx corresponding to the first point is determined based on the above-described form, the weight of the first point can be determined in at least two of the following forms.

[0289] One possible form is to determine the weight of the first point in the template according to the following formula: weightIdxL=partFlip?32+weightIdx:32-weightIdx wVemplateValue[x][y]=Clip3(0,8,(weightIdxL+4)>>3) where wVemplateValue[x][y] is the weight of the first point (x, y) in the template, weightIdxL is the weight index for the first component (e.g., luminance component), wVemplateValue[x][y] is the weight of the first point (x, y) in the template, and partFlip is an intermediate variable that is determined based on the angle index angleIdx, for example, as shown above, partFlip=(angleIdx>=13&&angleIdx<=27)?0:1, that is, the value of partFlip is 1 or 0, and when partFlip is 0, weightIdxL is 32-weightIdx, and when partFlip is 1, weightIdxL is 32+weightIdx, where 32 is just an example and the present application is not limited thereto.

[0290] Another possible embodiment is to determine the weight of the first point based on a first parameter weightIdx corresponding to the first point in the template, a first threshold value, and a second threshold value.

[0291] In order to reduce the complexity of calculating the weight of the first point, in the second embodiment, the weight of the pixel point in the template is limited to the first threshold or the second threshold, i.e., the weight of the first point is either the first threshold or the second threshold, thereby reducing the complexity of calculating the weight of the first point.

[0292] In the present application, the specific values ​​of the first threshold and the second threshold are not limited.

[0293] Optionally, the first threshold is 1.

[0294] Optionally, the second threshold is 0.

[0295] In one example, the weight of the first point may be determined by the following formula: wVemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 Here, wVemplateValue[x][y] is the weight of the midpoint (x, y) in the template, and the 1 in the above "1:0" is the first threshold value, and the 0 is the second threshold value.

[0296] In the above description, the j-th prediction mode is the first prediction mode, and the weight determined above is the weight for the first prediction mode of the first point. If the j-th prediction mode is the second prediction mode, the weight for the second prediction mode of the first point is 8-wVemplateValue[x][y], where 8 is merely an example and may be other values, and is not limited to this in the embodiments of the present application.

[0297] In the above example 1, the weight of the first point in the neighboring block is determined by referring to the form of determining the weight of the pixel point in the template, so the entire process is simple and the determined weight of the first point is relatively accurate.

[0298] In Example 2, as can be seen from the above, since the first point is one point in the template, the weight of the entire template is determined, and then the weight of the first point can be determined based on the weight of the template. In this case, the above step 21-A11 includes determining the weight of the template based on the i-th candidate weight derivation mode, the attribute information of the current block, and the template of the current block, and determining the weight of the template corresponding to the first point as the weight of the first point.

[0299] Specifically, an angle index and a distance index corresponding to the i-th candidate weight derivation mode are determined, the size of the current block is determined based on the attribute information of the current block, and a first parameter of each pixel point in the template is determined based on the angle index, the distance index, the size of the current block, and the size of the template. In some embodiments, the first parameter is also called a weight index (weightIdx), and the weight of the template is determined based on the first parameter of each pixel point in the template.

[0300] In one possible embodiment, determining the weights of the templates comprises: The inputs to the template weight derivation process may be determined as follows: width nCbW of the current block, height nCbH of the current block, width nVmW of the left template, height nVmH of the top template, GPM "split" angle index variable angleId, GPM distance index variable distanceIdx, and component index variable cIdx; for example, since the present application takes the luminance component as an example, cIdx is 0, representing the luminance component.

[0301] Here, the variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived in the following manner. nW=(cIdx==0)?nCbW:nCbW*EubWidthC nH=(cIdx==0)?nCbH:nCbH*EubHeightC shift1=Max(5,17-BitDepth), where BitDepth is the bit depth of the codec. offset1=1<<(shift1-1) displacementX=angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)?0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))?0:1 Here, the offset amounts offsetX and offsetY are derived by the following method. If -shiftHor has a value of 0: offsetX=(-nW)>>1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) -Otherwise (i.e., shiftHor has a value of 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY=(-nH)>>1 The template weight matrix wVemplateValue[x][y] (where x = -nVmW..nCbW-1, y = -nVmH..nCbH-1, except when both x and y are 0 or greater) is calculated as follows, assuming that the coordinates of the top left corner of the current block are (0,0): The variables xL and yL are derived in the following way: xL=(cIdx==0)?x:x*EubWidthC yL=(cIdx==0)?y:y*EubHeightC where disLut is determined according to Table 3 above, Here, the first parameter weightIdx is derived by the following method. weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY]

[0302] In some embodiments, according to the method, after determining the first parameter weightIdx, the weight of the pixel point in the template is determined by the following formula: weightIdxL=partFlip?32+weightIdx:32-weightIdx wVemplateValue[x][y]=Clip3(0,8,(weightIdxL+4)>>3) where wVemplateValue[x][y] is the weight of point (x, y) in the template, weightIdxL is the weight index for the first component (e.g., the luminance component), wVemplateValue[x][y] is the weight of point (x, y) in the template, and partFlip is an intermediate variable that is determined based on the angle index angleIdx, for example, as shown above, partFlip=(angleIdx>=13&&angleIdx<=27)?0:1, that is, the value of partFlip is 1 or 0, and when partFlip is 0, weightIdxL is 32-weightIdx, and when partFlip is 1, weightIdxL is 32+weightIdx, where 32 is just an example and the present application is not limited thereto.

[0303] In some embodiments, the method determines a weight for a pixel point in the template based on the first parameter weightIdx, the first threshold, and the second threshold for the pixel point in the template after determining the first parameter weightIdx.

[0304] In order to reduce the complexity of calculating the template weight, in this embodiment, the weight of a pixel point in the template is limited to the first threshold or the second threshold, that is, the weight of a pixel point in the template is either the first threshold or the second threshold, thereby reducing the complexity of calculating the template weight.

[0305] In one example, the weight of a pixel point in the template may be determined by the following formula: wVemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 In the formula, wVemplateValue[x][y] is the weight of the midpoint (x, y) in the template, and the 1 in the above "1:0" is the first threshold and the 0 is the second threshold.

[0306] In the above embodiment, the weight of each point in the template is determined by the weight derivation mode, and the weight matrix formed from the weights of each point in the template is used as the template weight.

[0307] In another possible embodiment, the merged region consisting of the current block and the template is treated as a whole, and the weights of the pixel points in the merged region are derived according to a weight derivation mode, thereby determining the weight of the template based on the weight of the merged region.

[0308] For example, the decoding side determines the weights of pixel points in the merged region formed by the current block and the template based on the angle index, the distance index, the size of the template, and the size of the current block, and determines the template weights based on the size of the template and the weights of pixel points in the merged region.

[0309] In this embodiment, the weights of pixel points in the merged region formed by the current block and the template are determined based on the angle index, distance index, template size, and current block size, regarding the current block and the template as a whole. As a result, the weight corresponding to the template in the merged region is determined as the template weight based on the size of the template. For example, as shown in Figures 21A and 21B, the weight corresponding to the L-shaped template region in the merged region is determined as the template weight.

[0310] In one example, in this embodiment, the process of deriving template weights includes: The inputs for this process are the width of the current block nCbW, the height of the current block nCbH, the width of the left template nTmW, the height of the top template nTmH, the GPM "split" angle index variable angleIdx, the GPM distance index variable distanceIdx, and the component index variable cIdx. Since this example only illustrates luminance, cIdx is 0 in this example, representing the luminance component.

[0311] The output of this process is the template weight matrix wTemplateValue.

[0312] The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived in the following manner. nW=(cIdx==0)?nCbW:nCbW*SubWidthC nH=(cIdx==0)?nCbH:nCbH*SubHeightC shift1=Max(5,17-BitDepth), where BitDepth is the bit depth of the codec. offset1=1<<(shift1-1) displacementX=angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)?0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))?0:1 The variables offsetX and offsetY are derived in the following way: If -shiftHor has a value of 0: offsetX=(-nW)>>1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) -Otherwise (i.e., shiftHor has a value of 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY=(-nH)>>1 The template weight matrix wVemplateValue[x][y] (where x = -nVmW..nCbW-1, y = -nVmH..nCbH-1, except when both x and y are 0 or greater) is calculated as follows, assuming that the coordinates of the top left corner of the current block are (0,0): The variables xL and yL are derived in the following way: xL=(cIdx==0)?x:x*SubWidthC yL=(cIdx==0)?y:y*SubHeightC Here, disLut is determined according to Table 3. Here, the first parameter weightIdx is derived by the following method. weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] weightIdxL=partFlip?32+weightIdx:32-weightIdx wTemplateValue[x][y]=Clip3(0,8,(weightIdxL+4)>>3)

[0313] In some embodiments, for ease of calculation, it is also possible to set the weight of a template to only two possible values, eg, 0 and 1.

[0314] In one example, the weight of a pixel point in a template may be determined by the following formula: wVemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0

[0315] In the above description, the j-th prediction mode is the first prediction mode, and the weight determined above is the weight for the first prediction mode of the template. If the j-th prediction mode is the second prediction mode, the weight for the second prediction mode of the template is 8-wVemplateValue[x][y], where 8 is merely an example and may be other values, and is not limited to this in the embodiments of the present application.

[0316] In the above example 2, the weight for the jth prediction mode of the template in the ith candidate weight derivation mode is determined, and the weight of the first point among the weights for the jth prediction mode of the template can be determined as the weight for the jth prediction mode of the first point in the adjacent block.

[0317] In the above-mentioned first embodiment, the weight of the first point in the adjacent block is directly determined by referring to the template weight determination method, thereby enabling accurate determination of the weight of the first point, and thereby enabling accurate determination of the weight for the jth prediction mode of the adjacent block based on the weight of the first point.

[0318] In the second embodiment, the weight of the first point in the adjacent block is determined based on the weight of the second point in the current block, and in this case, the step 21-A is Step 21-A-21, determining a second point corresponding to the first point in the current block; Step 21-A-22: determining a weight of a second point based on the i-th candidate weight derivation mode and attribute information of the current block; Step 21-A-23 includes determining a weight for the first point based on the weight for the second point.

[0319] As can be seen from the above, in this second embodiment, when directly determining the weight of the first point in the adjacent block, it is necessary to take into account the related information of the template, which increases the complexity of determining the weight of the first point. In this second embodiment, the weight of the first point in the adjacent block is determined by the weight of the second point in the current block, and when determining the weight of the second point, it is not necessary to take into account the related information of the template, which reduces the complexity of determining the weight of the first point.

[0320] In the embodiment of the present application, the specific position of the second point corresponding to the first point in the current block is not limited.

[0321] In some embodiments, the second point is the closest point to the first point in the current block.

[0322] In one example, the second point is a point adjacent to the first point in the current block. For example, as shown in Figure 18, if the first point is a point at (x0-1, y0-1) in the adjacent block, the second point may be a point at (x0, y0) in the current block. For further example, as shown in Figure 18, if the first point is a point at (x0-1, y0+height-1) in the adjacent block, the second point may be a point at (x0, y0+height-1) in the current block.

[0323] In this second embodiment, a specific process for determining the weight of the second point based on the i-th candidate weight derivation mode and attribute information of the current block may be to determine a division angle index variable angleIdx and a distance index variable distanceIdx corresponding to the i-th candidate weight derivation mode based on the i-th candidate weight derivation mode, and to determine the size of the current block (nCbW) × (nCbH) based on attribute information of the current block. The weight of the second point in the current block is determined by referring to the method for determining the weight of the predicted value. Note that the above description is given using the example where the j-th prediction mode is the first prediction mode, that is, the weight determined above is the weight of the second point related to the first prediction mode. If the j-th prediction mode is the second prediction mode, the weight of the second point related to the second prediction mode is 8 - wVemplateValue[x][y], where 8 is merely an example and other values ​​may be used, and the embodiment of the present application is not limited thereto.

[0324] After determining the weight of the second point in the current block for the j-th prediction mode, the decoding side determines the weight of the first point in the adjacent block based on the weight of the second point. For example, if the second point is adjacent to the first point, the weight of the second point may be directly determined as the weight of the first point. Furthermore, for example, if the second point is not adjacent to the first point, the weight of the second point may be corrected to obtain the weight of the first point. In the embodiment of the present application, the correction method provided is not limited, and for example, the weight of the first point may be obtained by adding or subtracting a preset value based on the weight of the second point.

[0325] In the process of determining the weight of the first point in the above-described first embodiment and the process of determining the weight of the second point in the above-described second embodiment, the influence of the weight gradient parameter is not taken into consideration.

[0326] In some embodiments, if the influence of the weight gradient parameter is taken into consideration in the process of determining the weight of the first point above, the decoding side needs to further determine the weight gradient parameter, and then determine the weight of the first point in the adjacent block based on the i-th candidate weight derivation mode, the attribute information of the current block, and the weight gradient parameter.

[0327] The variable weight gradient can adjust the gradient of the weight change, so that for the same dividing line angle and dividing line offset, the GPM obtains transition regions with different widths.

[0328] Illustratively, as shown in FIGS. 22A and 22B, FIG. 22A is a schematic diagram of a blending area of ​​GPM in VVC, and FIG. 22B is an example of a GPM variable weight gradient.

[0329] The value of blendingCoeff may be 1 / 4, 1 / 2, 1, 2, 4, etc.

[0330] Illustratively, the value of blendingCoeff may be derived by the weight gradient index gpm_blending_idx.

[0331] In some embodiments, the weight gradient index is also referred to as a transition gradient parameter or a transition parameter.

[0332] In the present embodiment, the method for determining the weight gradient parameter includes at least some of the following aspects.

[0333] In aspect 1, the codestream is decoded to obtain a second index for indicating a weight gradient parameter, and the weight gradient parameter is determined based on the second index. Specifically, after the encoding side determines the weight gradient parameter, the encoding side writes the second index corresponding to the weight gradient parameter into the codestream. Next, the decoding side decodes the codestream to obtain the second index, and further determines the weight gradient parameter based on the second index.

[0334] In the present embodiment, the second index is also called a weight gradient index.

[0335] In the embodiment of the present application, there is no limitation on a specific form for determining the weight gradient parameter based on the second index.

[0336] In some embodiments, the decoding side determines a candidate transition parameter list including a plurality of candidate transition parameters, and determines the candidate transition parameter corresponding to a second index in the candidate transition parameter list as the weighted gradient parameter.

[0337] In the embodiment of the present application, there is no limitation on the method for determining the candidate transition parameter list.

[0338] In one example, the candidate transition parameters in the candidate transition parameter list are preset.

[0339] In another example, the decoding side selects at least one transition parameter from a plurality of preset transition parameters based on feature information of the current block to construct a candidate transition parameter list. For example, based on image information of the current block, the decoding side selects a transition parameter that matches the image information of the current block from a plurality of preset transition parameters to construct a candidate transition parameter list.

[0340] For example, suppose the image information includes the sharpness of the image edge. If the sharpness of the image edge of the current block is less than a preset value, at least one first-type weighted gradient parameter, for example, 1 / 4, 1 / 2, etc., is selected from the plurality of preset weighted gradient parameters to form the candidate weighted gradient parameter list. If the sharpness of the image edge of the current block is equal to or greater than the preset value, at least one second-type weighted gradient parameter, for example, 2, 4, etc., is selected from the plurality of preset weighted gradient parameters to form the candidate weighted gradient parameter list.

[0341] For illustrative purposes, a list of candidate weight gradient parameters in an embodiment of the present application is shown in Table 10. [Table 10]

[0342] As shown in Table 10, the candidate weight gradient parameter list includes multiple candidate weight gradient parameters, and each candidate weight gradient parameter corresponds to one index.

[0343] For example, in the above Table 10, the order of the candidate weight gradient parameters in the candidate weight gradient parameter list is used as an index. Optionally, the index of the candidate weight gradient parameters in the candidate weight gradient parameter list may be expressed in other ways, but the embodiments of the present application are not limited thereto.

[0344] Based on the above Table 10, the decoding side determines the candidate weight gradient parameter corresponding to the second index in Table 10 as the weight gradient parameter according to the second index.

[0345] The decoding side decodes the codestream according to the above-mentioned form 1 to obtain the second index, and further determines the weight gradient parameter based on the second index. Alternatively, the decoding side can determine the weight gradient parameter according to the following form 2.

[0346] In some embodiments, instead of transmitting the weight gradient index in the codestream, one weight gradient index gpm_blending_idx or blendingCoeff may be directly derived based on the block size, etc. The decoding side may determine the weight gradient parameter according to the following form 2.

[0347] In the second aspect, the decoding side determines a plurality of candidate weight gradient parameters, G is a positive integer, and determines the weight gradient parameter from among the plurality of candidate weight gradient parameters.

[0348] In this second embodiment, the decoding side independently determines the weight gradient parameter, thereby avoiding the need for the encoding side to incorporate a second index into the codestream and saving codewords. Specifically, the decoding side first determines multiple candidate weight gradient parameters, and then selects one candidate weight gradient parameter from the multiple candidate weight gradient parameters as the weight gradient parameter.

[0349] In the embodiment of the present application, there is no limitation on the specific form in which the decoding side determines the plurality of candidate weight gradient parameters.

[0350] In one possible embodiment, the plurality of candidate weight gradient parameters are preset, that is, the decoding side and the encoding side agree to determine some preset weight gradient parameters as the G candidate weight gradient parameters.

[0351] In another possible embodiment, the plurality of candidate weight gradient parameters may be instructed by the encoding side, for example, the encoding side instructs that a plurality of weight gradient parameters among a plurality of preset weight gradient parameters be the plurality of candidate weight gradient parameters.

[0352] In another possible embodiment, multiple candidate weight gradient parameters may be determined depending on the size of the current block.

[0353] In another possible embodiment, image information of the current block is determined, and a plurality of candidate weight gradient parameters are determined from a plurality of pre-set candidate weight gradient parameters based on the image information of the current block.

[0354] After determining a plurality of candidate weight gradient parameters, the decoding side determines a weight gradient parameter from among the plurality of candidate weight gradient parameters.

[0355] In the embodiment of the present application, there is no limitation on the specific manner in which a weight gradient parameter is determined from among these multiple candidate weight gradient parameters.

[0356] In some embodiments, any candidate weight gradient parameter of a plurality of candidate weight gradient parameters is determined as the weight gradient parameter.

[0357] In some embodiments, a cost corresponding to each candidate weight gradient parameter among the plurality of candidate weight gradient parameters is determined, and a weight gradient parameter is determined from the plurality of candidate weight gradient parameters according to the cost, for example, the weight gradient parameter with the smallest cost is determined as the gradient parameter corresponding to the current block.

[0358] In the third embodiment, the weight gradient parameter is determined according to the size of the current block.

[0359] As can be seen from the above, there is a certain relationship between the weight gradient parameter and the size of the block, so in the embodiment of the present application, the weight gradient parameter can also be determined according to the size of the current block.

[0360] In one possible embodiment, a fixed weight gradient parameter is determined as the weight gradient parameter depending on the size of the current block.

[0361] For example, if the size of the current block is smaller than a first set threshold, the weight gradient parameter is determined to be a first value.

[0362] Further, for example, if the size of the current block is equal to or greater than the first set threshold, the weight gradient parameter is determined to be a second value, where the second value is less than the first value.

[0363] In the embodiment of the present application, the first value, the second value, and the first set threshold value are not limited to specific values.

[0364] Illustratively, the first value is 1 and the second value is 1 / 2.

[0365] For example, when the size of the current block is expressed by the number of pixels (or the number of sampling points) of the current block, the first set threshold may be 256 or the like.

[0366] Another possible embodiment is to determine a range of values ​​within which the weight gradient parameter lies based on the size of the current block, and then determine the weight gradient parameter as a value within that range of values.

[0367] For example, if the size of the current block is smaller than a first set threshold, the weight gradient parameter is determined to be within the range of values ​​of the weight gradient parameter. For example, the weight gradient parameter is any weight gradient parameter, such as the minimum weight gradient parameter, the maximum weight gradient parameter, or the middle weight gradient parameter, within the range of values ​​of the weight gradient parameter. Furthermore, for example, the weight gradient parameter is the weight gradient parameter with the smallest cost within the range of values ​​of the weight gradient parameter. Here, the method for determining the cost of the weight gradient parameter can be referred to the descriptions of other embodiments of the present application, and therefore the description thereof will be omitted here.

[0368] Furthermore, for example, if the size of the current block is equal to or greater than the first set threshold, it is determined that the weight gradient parameter is within the value range of the second weight gradient parameter. For example, the weight gradient parameter may be any weight gradient parameter, such as the minimum weight gradient parameter, the maximum weight gradient parameter, or the middle weight gradient parameter, within the value range of the second weight gradient parameter. For example, the weight gradient parameter may be the weight gradient parameter with the smallest cost within the value range of the second weight gradient parameter. Here, the minimum value of the value range of the second weight gradient parameter is smaller than the minimum value of the value range of the weight gradient parameter, and the value range of the weight gradient parameter and the value range of the second weight gradient parameter may or may not intersect, and this is not limited to this embodiment of the present application.

[0369] After determining the weight gradient parameter according to the above steps, the decoding side determines the weight of the first point of the adjacent block based on the i-th candidate weight derivation mode, the attribute information of the current block, and the weight gradient parameter.

[0370] In one example, the decoding side determines a weight index weightIdx, for example, a weight index weightIdx corresponding to a first point in the adjacent block or a weight index weightIdx corresponding to a second point in the current block, based on the i-th candidate weight derivation mode and attribute information of the current block, then processes the weight index weightIdx using the determined weight gradient parameter to obtain a processed weight index weightIdx, and determines a weight wVemplateValue of the first or second point based on the processed weightIdx.

[0371] In one example, using the weight gradient parameter, the weight of the first or second point, wVemplateValue, can be determined by the following formula: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] weightIdx=weightIdx*blendingCoeff weightIdxL=partFlip?32+weightIdx:32-weightIdx wValue=Clip3(0,8,(weightIdxL+4)>>3) However, blendingCoef f is is the weight gradient parameter.

[0372] In the above embodiment, the specific process of determining the weight of the first point in the neighboring block based on the i-th candidate weight derivation mode and the attribute information of the current block in step 21-A is described. Then, the weight of the first point is determined as the weight for the j-th prediction mode of the neighboring block.

[0373] In the above-mentioned form 2, the decoding side determines the weight for the jth prediction mode of each adjacent block of the current block through the above-mentioned step, and then executes the above-mentioned step 22, that is, determines the candidate prediction mode list for the jth prediction mode based on the weight for the jth prediction mode of the adjacent block.

[0374] The implementation process of the above step 22 includes, but is not limited to:

[0375] In the first aspect, step 22 is Step 22-A1: if the weight for the j-th prediction mode of the neighboring block is equal to or greater than a predetermined threshold, obtaining the prediction mode of the neighboring block; Step 22-A2 includes determining a candidate prediction mode list for the j-th prediction mode based on the prediction modes of the neighboring blocks.

[0376] In this embodiment, the decoding side determines a weight for the j-th prediction mode of each of the neighboring blocks of the current block in the i-th candidate weight derivation mode based on the above steps. Next, the weight corresponding to each neighboring block is compared with a preset threshold. If the weight corresponding to the neighboring block is equal to or greater than the preset threshold, it means that the neighboring block has a relatively strong association with the j-th prediction mode. Further, a candidate prediction mode list for the j-th prediction mode can be determined based on the prediction mode of the neighboring block. For example, the prediction mode of the neighboring block is added to the candidate prediction mode list for the j-th prediction mode. In some embodiments, when the weight value ranges from 0 to n, the preset threshold is n / 2, where n is a positive number.

[0377] In some embodiments, when the weight value is a first value or a second value, for example, when the weight value is set to 0 or 1, step 22 above may include: Step 22-B1: if the weight for the j-th prediction mode of the neighboring block is equal to a first value, obtaining the prediction mode of the neighboring block, where the first value is greater than a second value; Step 22-B2 includes determining a candidate prediction mode list for the j-th prediction mode based on the prediction modes of the neighboring blocks.

[0378] In this embodiment, if the weight for the jth prediction mode of an adjacent block is either a first value or a second value, when it is determined that the weight for the jth prediction mode of the adjacent block is equal to the first value, it means that the association between the adjacent block and the jth prediction mode is relatively strong, and further, a candidate prediction mode list for the jth prediction mode can be determined based on the prediction mode of the adjacent block.

[0379] In the embodiment of the present application, the first value and the second value are not limited to specific values.

[0380] Optionally, the first value is 1.

[0381] Optionally, the second value is 0.

[0382] In some embodiments, if the weight corresponding to the adjacent block is smaller than a predetermined threshold value or equal to a second value, it means that the association between the adjacent block and the jth prediction mode is relatively weak, and thus the candidate prediction mode list for the jth prediction mode is not determined based on the prediction mode of the adjacent block, for example, by skipping obtaining the prediction mode of this adjacent block, thereby improving the accuracy of determining the candidate prediction mode list.

[0383] In some embodiments, the number of neighboring blocks included in the current block and the specific locations of the neighboring blocks are not limited.

[0384] In some embodiments, when the length of the candidate prediction mode list for the jth prediction mode is not limited, the weight for the jth prediction mode of each neighboring block of the current block can be compared with a predetermined threshold or a first value in a random manner to obtain the prediction mode of the neighboring block whose weight is greater than or equal to the predetermined threshold or equal to the first value.

[0385] In some embodiments, when the length of the candidate prediction mode list for the jth prediction mode is limited, obtaining the prediction mode of the neighboring block in step 22-A1 above includes sequentially obtaining the prediction mode of each neighboring block of the current block whose weight for the jth prediction mode is greater than or equal to a predetermined threshold or equal to a first value according to a predetermined checking order.

[0386] In the embodiment of the present application, the above-described predetermined check order is not limited.

[0387] In some embodiments, when the neighboring blocks included in the current block include a left neighboring block L, an upper neighboring block A, a lower-left neighboring block BL, an upper-right neighboring block AR, and an upper-left neighboring block AL, as shown in Figure 18, the predetermined checking order is the left neighboring block, the upper neighboring block, the lower-left neighboring block, the upper-right neighboring block, and the upper-left neighboring block, i.e., L -> A -> BL -> AR -> AL. That is, first, the weight for the jth prediction mode of the left neighboring block of the current block is compared with a predetermined threshold or a first value. If the weight corresponding to the left neighboring block is greater than or equal to the predetermined threshold or the first value, the prediction mode of the left neighboring block is obtained. If the weight corresponding to the left neighboring block is less than the predetermined threshold or equal to a second value, obtaining the prediction mode of the left neighboring block is skipped. Next, the weight for the j-th prediction mode of the upper neighboring block of the current block is compared with a predetermined threshold or a first value, and if the weight corresponding to the upper neighboring block is equal to or greater than the predetermined threshold or equal to the first value, the prediction mode of the upper neighboring block is obtained, and if the weight corresponding to the upper neighboring block is less than the predetermined threshold or equal to a second value, the prediction mode of the upper neighboring block is skipped. Next, the weight for the j-th prediction mode of the lower-left neighboring block of the current block is compared with a predetermined threshold or a first value, and if the weight corresponding to the lower-left neighboring block is equal to or greater than the predetermined threshold or equal to the first value, the prediction mode of the lower-left neighboring block is obtained, and if the weight corresponding to the lower-left neighboring block is less than the predetermined threshold or equal to the second value, the prediction mode of the lower-left neighboring block is skipped. Next, the weight for the jth prediction mode of the upper right neighboring block of the current block is compared with a predetermined threshold or a first value. If the weight corresponding to the upper right neighboring block is greater than or equal to the predetermined threshold or equal to the first value, the prediction mode of the upper right neighboring block is obtained; if the weight corresponding to the upper right neighboring block is less than the predetermined threshold or equal to the second value, obtaining the prediction mode of the upper right neighboring block is skipped.Finally, the weight for the j-th prediction mode of the upper-left neighboring block of the current block is compared with a preset threshold or a first value, and if the weight corresponding to the upper-left neighboring block is equal to or greater than the preset threshold or equal to the first value, the prediction mode of the upper-left neighboring block is obtained, and if the weight corresponding to the upper-left neighboring block is less than the preset threshold or equal to a second value, obtaining the prediction mode of the upper-left neighboring block is skipped. According to the above checking order, the above checking is performed sequentially for neighboring blocks L->A->BL->AR->AL until the length of the candidate prediction mode list corresponding to the j-th prediction mode reaches an upper limit or until checking of all of the neighboring blocks is completed.

[0388] In some embodiments, the decoding side is not limited to the order in which prediction modes of neighboring blocks are filled into the candidate prediction mode list corresponding to the j-th prediction mode.

[0389] In some embodiments, the decoding side sequentially adds the obtained prediction modes of the neighboring blocks to the candidate prediction mode list for the j-th prediction mode according to the check order. For example, the decoding side first determines whether the weight for the j-th prediction mode of neighboring block L is equal to or less than a predetermined threshold or equal to a first value. If the weight for the j-th prediction mode of neighboring block L is equal to or less than a predetermined threshold or equal to the first value, the decoding side adds the prediction mode of neighboring block L to the candidate prediction mode list corresponding to the j-th prediction mode. Next, the decoding side determines whether the weight for the j-th prediction mode of neighboring block A is equal to or less than a predetermined threshold or equal to the first value. If the weight for the j-th prediction mode of neighboring block A is equal to or less than a predetermined threshold or equal to the first value, the decoding side adds the prediction mode of neighboring block A to the candidate prediction mode list corresponding to the j-th prediction mode. This analogy continues until the length of the candidate prediction mode list corresponding to the j-th prediction mode reaches an upper limit or until checking of all the neighboring blocks is completed.

[0390] In some embodiments, when the candidate prediction mode list does not include any duplicate candidate prediction modes, before adding the prediction mode of the neighboring block whose weight is equal to or greater than a predetermined threshold or equal to a first value to the candidate prediction mode list, it is first determined whether the prediction mode of the neighboring block is included in the candidate prediction mode list of the jth prediction mode, and when the prediction mode of the neighboring block is not included in the candidate prediction mode list of the jth prediction mode, the prediction mode of the neighboring block is added to the candidate prediction mode list of the jth prediction mode.When the prediction mode of the neighboring block is already included in the candidate prediction mode list of the jth prediction mode, adding the prediction mode of the neighboring block to the candidate prediction mode list of the jth prediction mode is skipped.

[0391] In this form 1, the prediction mode of each adjacent block whose weight for the jth prediction mode is greater than or equal to a predetermined threshold or equal to a first value is added to the candidate prediction mode list for the jth prediction mode, thereby improving the accuracy of determining the candidate prediction mode list.

[0392] In some embodiments, the decoding side may determine the candidate prediction mode list for the j-th prediction mode according to the following form 2.

[0393] In the second embodiment, if the current block includes M adjacent blocks, where M is a positive integer, the above step 22 is Step 22-C1 includes determining a candidate prediction mode list for the j-th prediction mode based on the weights for the j-th prediction mode of each of the M neighboring blocks and the prediction modes of the M neighboring blocks.

[0394] For example, based on the weights for the jth prediction mode of each of the M neighboring blocks, several neighboring blocks whose weights are within a predetermined range are selected from the M neighboring blocks, and the prediction modes of these several neighboring blocks are added to the candidate prediction mode list for the jth prediction mode.

[0395] Furthermore, for example, prediction modes of the M neighboring blocks are added to the candidate prediction mode list until the length of the candidate prediction mode list reaches a predetermined length based on the magnitude of the weight for each of the M neighboring blocks. For example, a neighboring block with a larger weight is more likely to be added to the candidate prediction mode list, but a neighboring block with a relatively small weight may also be added to the candidate prediction mode list, but the probability of this is relatively low.

[0396] In the embodiment of the present application, the specific number and locations of the M adjacent blocks are not limited.

[0397] In some embodiments, the M neighboring blocks include at least one of a left neighboring block, an upper neighboring block, a lower-left neighboring block, an upper-right neighboring block, and an upper-left neighboring block of the current block.

[0398] As can be seen from the above, in the above step, when determining the candidate prediction mode list for the jth prediction mode in the ith candidate weight derivation mode, the candidate prediction mode list for the jth prediction mode is determined based on the ith candidate weight derivation mode and the attribute information of the current block, for example, by determining a weight for the jth prediction mode of the adjacent block of the current block, and then determining whether to add the prediction mode of the adjacent block to the candidate prediction mode list for the jth prediction mode based on the weight.

[0399] Based on this, in an embodiment of the present application, before determining a candidate prediction mode list for the j-th prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block, the decoding side must first determine whether the candidate prediction mode list for the j-th prediction mode includes a prediction mode of an adjacent block. If it is determined that the candidate prediction mode list for the j-th prediction mode includes a prediction mode of an adjacent block, the decoding side determines a candidate prediction mode list for the j-th prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block.

[0400] In the embodiment of the present application, there is no limitation on the specific manner in which the decoding side determines whether or not the prediction mode of the neighboring block is included in the candidate prediction mode list of the j-th prediction mode.

[0401] In a first example, the encoding side and the decoding side may default to the fact that the candidate prediction mode lists corresponding to the current block all include the prediction mode of the neighboring block, and based on this, the decoding side may determine that the candidate prediction mode list of the j-th prediction mode includes the prediction mode of the neighboring block. Alternatively, the encoding side and the decoding side may default to the fact that the candidate prediction mode lists corresponding to the current block all do not include the prediction mode of the neighboring block, and based on this, the decoding side may determine that the candidate prediction mode list of the j-th prediction mode does not include the prediction mode of the neighboring block.

[0402] In a second example, the decoding side decodes the code stream to obtain first information indicating whether the candidate prediction mode list includes the prediction mode of the adjacent block, and determines whether the candidate prediction mode list of the jth prediction mode includes the prediction mode of the adjacent block based on the first information.

[0403] Optionally, the first information may be frame-level information, ie, indicating whether the prediction mode of the neighboring block is included in the candidate prediction mode list corresponding to the current frame.

[0404] Optionally, the first information may be block-level information, ie, indicating whether the candidate prediction mode list corresponding to the current block includes the prediction mode of a neighboring block.

[0405] Optionally, the first information may be other level of indication information, and in the embodiment of the present application, it is not limited thereto, as long as the decoding side can determine whether the prediction mode of the neighboring block is included in the candidate prediction mode list of the jth prediction mode corresponding to the current block using this first information.

[0406] In a third type of example, the decoding side adds each prediction mode that is located before the prediction mode of the adjacent block in the predetermined order to the candidate prediction mode list according to a predetermined order, and then, if the length of the candidate prediction mode list does not reach the predetermined length, determines that the prediction mode of the adjacent block is included in the candidate prediction mode list of the jth prediction mode.

[0407] In this example, the candidate prediction mode list for the j-th prediction mode further includes other prediction modes. When determining the candidate prediction mode list for the j-th prediction mode, the decoding side first sequentially adds prediction modes to the candidate prediction mode list for the j-th prediction mode according to a predetermined order, and then determines whether the length of the candidate prediction mode list reaches a predetermined length after adding each prediction mode that precedes the prediction mode of the adjacent block in the predetermined order to the candidate prediction mode list. If the length of the candidate prediction mode list does not reach the predetermined length after adding each prediction mode that precedes the prediction mode of the adjacent block in the predetermined order to the candidate prediction mode list, the decoding side determines that the candidate prediction mode list for the j-th prediction mode includes the prediction mode of the adjacent block. If the length of the candidate prediction mode list reaches the predetermined length after adding each prediction mode that precedes the prediction mode of the adjacent block in the predetermined order to the candidate prediction mode list, the decoding side determines that the candidate prediction mode list for the j-th prediction mode does not include the prediction mode of the adjacent block.

[0408] In some embodiments, the decoding side sequentially adds, in a predetermined order, a prediction mode whose prediction angle is parallel to the dividing line of the i-th candidate weight derivation mode, a candidate prediction mode derived based on a template of the current block, a candidate prediction mode derived based on reconstructed pixels around the current block, a prediction mode of a neighboring block, a prediction mode whose prediction angle is perpendicular to the dividing line of the i-th candidate weight derivation mode, and a preset mode to the candidate prediction mode list of the j-th prediction mode until the length of the list reaches a predetermined length.

[0409] In the embodiment of the present application, there is no limitation to the preset order.

[0410] In one example, the preset order includes a prediction mode whose prediction angle is parallel to the dividing line of the i-th candidate weight derivation mode, a candidate prediction mode derived based on a template of the current block, a candidate prediction mode derived based on reconstructed pixels around the current block, a prediction mode of a neighboring block, a prediction mode whose prediction angle is perpendicular to the dividing line of the i-th candidate weight derivation mode, and a preset mode.

[0411] In some embodiments, the candidate prediction modes derived based on the template of the current block can be understood as prediction modes derived by the TIMD.

[0412] In some embodiments, candidate prediction modes derived based on the reconstructed pixels surrounding the current block can be understood as prediction modes derived by DIMD.

[0413] In some embodiments, the preset modes include a planar mode.

[0414] In one example, when constructing the candidate prediction mode list for the j-th prediction mode, the list length is increased until it reaches a preset length (e.g., 3). 1. A prediction mode whose prediction angle is parallel to the dividing line of the i-th candidate weight derivation mode; 2. Prediction mode derived by TIMD; 3. Prediction mode derived by DIMD, 4. Prediction mode of the neighboring blocks of the current block; 5. A prediction mode whose prediction angle is perpendicular to the division line of the i-th candidate weight derivation mode; and 6. The prediction modes, PLANAR mode, are sequentially added to the candidate prediction mode list.

[0415] In the above embodiment, a specific process in which the decoding side determines the candidate prediction mode list has been described.

[0416] After determining the candidate prediction mode list based on the above steps, the decoding side executes the following step S103.

[0417] S103: determining a first weight derivation mode and K first prediction modes corresponding to the current block according to the N candidate weight derivation modes and at least one candidate prediction mode;

[0418] The decoding side determines N candidate weight derivation modes based on the above step S101, determines at least one candidate prediction mode based on the above step S102, selects one candidate weight derivation mode from the N candidate weight derivation modes as a first weight derivation mode corresponding to the current block, and determines at least one first prediction mode from the at least one candidate prediction mode included in the at least one candidate prediction mode as one of the K first prediction modes. Finally, the current block is predicted using the determined first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block.

[0419] Note that the first weight derivation mode and the K first prediction modes are used together to determine a predicted value for the current block. In some embodiments, the first weight derivation mode is also referred to as a weight derivation mode for the current block or a weight derivation mode corresponding to the current block. In some embodiments, the K first prediction modes are also referred to as K prediction modes for the current block or K prediction modes corresponding to the current block. In one example, when K=2, the K first prediction modes include a first prediction mode and a second prediction mode corresponding to the current block, and in some embodiments, the first prediction mode is referred to as the first prediction mode and the second prediction mode is referred to as the second prediction mode.

[0420] In the embodiments of the present application, the specific manner in which the decoding side determines the first weight derivation mode and the K first prediction modes based on the N candidate weight derivation modes and at least one candidate prediction mode is not limited.

[0421] In some embodiments, as shown in Figure 17A, in GPM intra / inter prediction, it is assumed that N = 1, that is, N candidate weight derivation modes are a first weight derivation mode, the first prediction mode is an inter prediction mode, and the second prediction mode is an intra prediction mode. As shown in S102 above, the decoding side determines a candidate prediction mode list for the second prediction mode based on the first weight derivation mode and attribute information of the current block, and further selects one candidate prediction mode from the candidate prediction mode list for the second prediction mode as the second prediction mode. For example, it determines the candidate prediction mode with the lowest cost from the candidate prediction mode list as the second prediction mode. Next, the current block is predicted based on the first weight derivation mode, the first prediction mode, and the second prediction mode to obtain a predicted value of the current block.

[0422] In some embodiments, when at least one candidate prediction mode is included in the candidate prediction mode list corresponding to K first prediction modes, i.e., when all of the K first prediction modes are selected from the candidate prediction mode list, the decoding side combines N candidate weight derivation modes with the candidate prediction modes included in the candidate prediction mode list. For example, each candidate weight derivation mode among the N candidate weight derivation modes is combined with any K candidate prediction modes in the candidate prediction mode list to obtain multiple combinations, each combination including one candidate weight derivation mode and K candidate prediction modes. Next, the template of the current block is predicted using the candidate weight derivation mode and the K candidate prediction modes included in each combination, and the cost of each combination is determined. Further, one combination is determined from the multiple combinations based on the cost. For example, the combination with the smallest cost is selected from the multiple combinations, and the candidate weight derivation mode included in the combination with the smallest cost is determined as the first weight derivation mode, and the K prediction modes included in the combination with the smallest cost are determined as the K first prediction modes.

[0423] In some embodiments, when at least one candidate prediction mode is a candidate prediction mode list for a first prediction mode among K first prediction modes, for example, K=2, and the candidate prediction mode is a candidate prediction mode list for the first prediction mode, the decoding side determines a selectable prediction mode set corresponding to a second prediction mode. Next, for each of the N candidate weight derivation modes, the decoding side selects one candidate prediction mode from the candidate prediction mode list for the first prediction mode as one possibility for the first prediction mode and one prediction mode from the selectable prediction mode set corresponding to the second prediction mode as one possibility for the second prediction mode, and obtains that a combination of this candidate weight derivation mode, one possibility for the first prediction mode, and one possibility for the second prediction mode constitutes one combination, resulting in multiple possible combinations. Each combination includes one candidate weight derivation mode and two candidate prediction modes. Next, a template for the current block is predicted using the candidate weight derivation mode and two candidate prediction modes included in each combination, the cost of each combination is determined, and one combination is determined from the multiple combinations based on the cost. For example, the combination with the lowest cost is selected from the multiple combinations, the candidate weight derivation mode included in the combination with the lowest cost is determined as the first weight derivation mode, and the K prediction modes included in this combination with the lowest cost are determined as the K first prediction modes.

[0424] In some embodiments, the at least one candidate prediction mode may include a candidate prediction mode list corresponding to each of the K first prediction modes, i.e., the decoding side determines the K candidate prediction modes based on step S102. For example, assume K=2. That is, the decoding side determines a candidate prediction mode list for the first prediction mode and a candidate prediction mode list for the second prediction mode. In this manner, the decoding side selects one candidate weight derivation mode from N candidate weight derivation modes, selects one candidate prediction mode from the candidate prediction mode list for the first prediction mode, and selects one candidate prediction mode from the candidate prediction mode list for the second prediction mode. At this time, the selected candidate weight derivation mode and the two candidate prediction modes form one combination. Multiple combinations can be obtained by referring to the above method. Each combination includes one candidate weight derivation mode and two candidate prediction modes. Next, a template for the current block is predicted using the candidate weight derivation mode and two candidate prediction modes included in each combination, the cost of each combination is determined, and one combination is determined from the multiple combinations based on the cost. For example, the combination with the lowest cost is selected from the multiple combinations, the candidate weight derivation mode included in the combination with the lowest cost is determined as the first weight derivation mode, and the K prediction modes included in this combination with the lowest cost are determined as the K first prediction modes.

[0425] Based on the above description, one weight derivation mode and K prediction modes can act on the current block as one combination. In order to save codewords and reduce encoding costs, in some embodiments, the weight derivation mode and K prediction modes corresponding to the current block are combined into one combination, i.e., a first combination, and the combination is indicated using a first index. Compared with indicating the weight derivation mode and the K prediction modes individually, the embodiments of the present application use fewer codewords and thus reduce encoding costs.

[0426] Based on this, the above S103 is divided into the following steps S103-A to S103-C: S103-A, decoding the codestream to obtain a first index for indicating a first combination including a first weight derivation mode and K first prediction modes, the first combination including the first weight derivation mode and the K first prediction modes; S103-B: determining a candidate combination list including at least one candidate combination based on the N candidate weight derivation modes and at least one candidate prediction mode, where the candidate combination includes one weight derivation mode and K prediction modes; S103-C, determining a first combination from the candidate combination list based on the first index.

[0427] In the embodiment of the present application, the format of the specific syntax element of the first index is not limited.

[0428] In one possible embodiment, if the current block is predicted using the GPM technique, the first index is represented using gpm_cand_idx.

[0429] Since the first index is used to indicate the first combination, in some embodiments, the first index may also be referred to as a first combination index or an index of the first combination.

[0430] In one example, the syntax after adding the first index to the codestream is shown in Table 11. [Table 11] Here, gpm_cand_idx is the first index.

[0431] For example, a list of candidate combinations is shown in Table 12. [Table 12]

[0432] As shown in Table 12, the candidate combination list includes a plurality of candidate combinations, and any two of the plurality of candidate combinations are not completely the same, that is, the weight derivation modes included in any two candidate combinations are different from at least one of the K prediction modes. For example, the weight derivation modes in candidate combination 1 and candidate combination 2 are different, or the weight derivation modes in candidate combination 1 and candidate combination 2 are the same and at least one prediction mode among the K prediction modes is different, or the weight derivation modes in candidate combination 1 and candidate combination 2 are different and at least one prediction mode among the K prediction modes is different.

[0433] For example, in the above Table 12, the order of the candidate combinations in the candidate combination list is used as an index, and optionally, the index of the candidate combination in the candidate combination list may be expressed in other ways, but the embodiments of the present application are not limited to this.

[0434] In this embodiment, the decoding side decodes the code stream, obtains a first index, determines the candidate combination list shown in Table 12 above, queries this candidate combination list according to the first index, and obtains the first weight derivation mode and K prediction modes included in the first combination indicated by the first index.

[0435] For example, the first index is index 1, and in the candidate combination list shown in Table 12, the candidate combination corresponding to index 1 is candidate combination 2, that is, the first combination indicated by the first index is candidate combination 2. As a result, the decoding side determines the weight derivation mode and K prediction modes included in candidate combination 2 as the first weight derivation mode and K first prediction modes included in the first combination, and predicts the current block using this first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

[0436] In this second embodiment, the encoding side and the decoding side may each determine the same candidate combination list, for example, the encoding side and the decoding side each determine a list including X candidate combinations, each of which includes one weight derivation mode and K prediction modes. In the code stream, the encoding side only needs to write one candidate combination finally selected, for example, the first combination, and the decoding side analyzes the first combination finally selected by the encoding side. Specifically, the decoding side decodes the code stream to obtain a first index and determines the first combination from the candidate combination list determined by the decoding side using the first index.

[0437] The following describes a specific process of determining the candidate combination list based on N candidate weight derivation modes and at least one candidate prediction mode in the above S103-B.

[0438] In the embodiment of the present application, there are no limitations on the specific form in which the candidate combination list is determined based on N candidate weight derivation modes and at least one candidate prediction mode in S103-B above.

[0439] In some embodiments, the N candidate weight derivation modes are arbitrarily combined with a plurality of candidate prediction modes included in at least one candidate prediction mode, with each combination including one weight derivation mode and two prediction modes. This allows for a plurality of combinations to be obtained, and information about the current block is used to analyze the magnitude of occurrence probability of different combinations, and a candidate combination list is constructed based on the magnitude of occurrence probability of each combination. Optionally, the information about the current block includes mode information of neighboring blocks of the current block, reconstructed pixels of the current block, etc.

[0440] In some embodiments, the above S103-B includes the following steps S103-B1 and S103-B2: S103-B1, obtaining T second combinations based on N candidate weight derivation modes and at least one candidate prediction mode; S103-B2, which includes a step of obtaining a candidate combination list based on the T second combinations.

[0441] Here, any of the T second combinations includes one weight derivation mode and K prediction modes, and the weight derivation mode and the K prediction modes included in any two of the T second combinations are not exactly the same, and T is a positive integer greater than 1.

[0442] In this embodiment, the decoding side determines T second combinations based on N candidate weight derivation modes and at least one candidate prediction mode, and the present application is not limited to specific values ​​of the T second combinations, such as 8, 16, 32, etc., and each second combination among the T second combinations includes one weight derivation mode and K prediction modes, and the weight derivation mode and the K prediction modes included in any two combinations among the T second combinations are not exactly the same.

[0443] In the embodiment of the present application, the specific manner of obtaining the T second combinations based on the N candidate weight derivation modes and at least one candidate prediction mode in the above S103-B1 is not limited.

[0444] In some embodiments, the at least one candidate prediction mode is a candidate prediction mode list corresponding to K first prediction modes, that is, all of the K first prediction modes are selected from the candidate prediction mode list. At this time, the decoding side combines the N candidate weight derivation modes with the candidate prediction modes included in the candidate prediction mode list. For example, each candidate weight derivation mode among the N candidate weight derivation modes is combined with any K candidate prediction modes in the candidate prediction mode list to obtain T second combinations, each of which includes one candidate weight derivation mode and K candidate prediction modes.

[0445] In some embodiments, when at least one candidate prediction mode is a candidate prediction mode list of a first prediction mode among K first prediction modes, for example, K=2, and the candidate prediction mode is a candidate prediction mode list of the first prediction mode, the decoding side determines a selectable prediction mode set corresponding to a second prediction mode. Next, for each of the N candidate weight derivation modes, the decoding side selects one candidate prediction mode from the candidate prediction mode list of the first prediction mode as one possibility of the first prediction mode and one prediction mode from the selectable prediction mode set corresponding to the second prediction mode as one possibility of the second prediction mode, and obtains that this candidate weight derivation mode, one possibility of the first prediction mode, and one possibility of the second prediction mode form one second combination, thereby obtaining T second combinations, and each second combination includes one candidate weight derivation mode and two candidate prediction modes.

[0446] In some embodiments, the at least one candidate prediction mode may include a candidate prediction mode list corresponding to each of the K first prediction modes, i.e., the decoding side determines the K candidate prediction modes based on step S102. For example, assume K=2. The decoding side determines a candidate prediction mode list for the first prediction mode and a candidate prediction mode list for the second prediction mode. In this manner, the decoding side selects one candidate weight derivation mode from N candidate weight derivation modes, selects one candidate prediction mode from the candidate prediction mode list for the first prediction mode, and selects one candidate prediction mode from the candidate prediction mode list for the second prediction mode, where the selected candidate weight derivation mode and two candidate prediction modes form one combination. Referring to the above method, T second combinations can be obtained, each of which includes one candidate weight derivation mode and two candidate prediction modes.

[0447] In the above S103-B2, an embodiment in which a candidate combination list is obtained based on T second combinations includes: Aspect 1, in which the T second combinations are sorted according to a preset rule to obtain a candidate combination list; In the second aspect, S103-B2 is S103-B21, for any one of the T second combinations, determining a cost corresponding to the second combination when predicting a template of the current block using a weight derivation mode in the second combination and the K prediction modes; S103-B22, and determining a candidate combination list based on a cost corresponding to each second combination among the T second combinations.

[0448] In this form 2, for each second combination among the T second combinations, a template for the current block is predicted using the weight derivation mode included in this second combination and K prediction modes, and a predicted value of the template corresponding to this second combination is obtained.

[0449] Specifically, for each of the T second combinations, the template of the current block is predicted using K prediction modes in the second combination to obtain K predicted values.

[0450] Next, the template weights corresponding to this second combination are determined based on the weight derivation mode for this second combination.

[0451] In some embodiments, determining the template weights based on the weight derivation mode includes determining an angle index, a distance index, and a transition parameter based on the weight derivation mode, and determining the template weights based on the angle index, the distance index, the transition parameter, and the size of the template.

[0452] In this application, the template weights can be derived in the same way as the weights of the predictors, for example, by first determining the angle index and the distance index based on the weight derivation mode.

[0453] Here, the manner in which the template weight is determined based on the angle index, the distance index, and the size of the template includes, but is not limited to, the following several manners.

[0454] In form 1, a first parameter of a pixel point in the template is determined based on an angle index, a distance index, and a size of the template, and in some embodiments, the first parameter is also referred to as a weight index weightIdx, and weights of the pixel points in the template are determined based on the first parameter of the pixel point in the template, and template weights are determined based on the weights of the pixel points in the template. For specific processes, refer to the process of determining the template weight in S102 above, and description thereof will be omitted here.

[0455] In the second embodiment, the weights of the current block and the template are determined based on the weight derivation mode. That is, in the second embodiment, the merged region consisting of the current block and the template is treated as a whole, and the weights of the pixel points in the merged region are derived based on the weight derivation mode.

[0456] For example, the decoding side determines the weights of the pixels in the merged region formed by the current block and the template based on the angle index, the distance index, the size of the template, and the size of the current block, and determines the template weights based on the size of the template and the weights of the pixels in the merged region. The specific process can be referred to the process of determining the template weight in S102 above, and the description thereof will be omitted here.

[0457] Using the above method, the template weights and K template predicted values ​​corresponding to a certain second combination are determined, and the K template predicted values ​​are weighted using the template weights to obtain the template predicted values ​​for this second combination.

[0458] Since the template of the current block is a reconstructed region, the decoding side can obtain the reconstructed value of the template, and can determine the cost corresponding to each of the T second combinations based on the predicted value of the template and the reconstructed value of the template in the second combination. Here, methods for determining the cost corresponding to the second combination include, but are not limited to, SAD, SATD, SEE, etc. Next, a candidate combination list is constructed based on the cost corresponding to each of the T second combinations.

[0459] In the embodiment of the present application, the template prediction value corresponding to the second combination includes at least some of the following forms.

[0460] In the first type, the template prediction value corresponding to the second combination is a single numerical value, that is, the decoding side predicts the template using the K prediction modes included in the second combination to obtain K prediction values, determines template weights based on the weight derivation modes included in the second combination, weights the K prediction values ​​with the template weights to obtain weighted prediction values, and determines the weighted prediction values ​​as the template prediction value corresponding to the second combination.

[0461] In a second embodiment, a hierarchical filtering approach may be used. For example, if a weight derivation mode can obtain a relatively low cost, similar weight derivation modes may be continuously tried. Conversely, if a weight derivation mode cannot obtain a relatively low cost, similar weight derivation modes may not be continuously tried. For example, if a certain intra prediction mode can obtain a relatively low cost, similar intra prediction modes may be continuously tried. Conversely, if a certain intra prediction mode cannot obtain a relatively low cost, similar intra prediction modes may not be continuously tried. Of course, these filtering methods may be limited to use in combination with the other two elements. For example, if a certain intra prediction mode cannot obtain a relatively low cost as the first prediction mode in a certain weight derivation mode, similar intra prediction modes may not be tried in that weight derivation mode when they are the first prediction mode.

[0462] A third type of embodiment is to determine the cost corresponding to each second combination using a high-speed cost calculation method. As can be seen from the above, the template prediction value corresponding to the second combination includes template prediction values ​​corresponding to each of the K prediction modes included in the second combination. At this time, the costs corresponding to each of the K prediction modes in the second combination are determined based on the template prediction values ​​and template reconstruction values ​​corresponding to each of the K prediction modes in the second combination, and the cost corresponding to this second combination is determined based on the costs corresponding to each of the K prediction modes in the second combination. For example, the sum of the costs corresponding to each of the K prediction modes in the second combination is determined as the cost corresponding to this second combination.

[0463] In an embodiment of the present application, taking K=2 as an example, the weight on the template can be simplified to only two possibilities, 0 and 1, so that for each pixel position, the pixel value is derived only from the predicted block of the first prediction mode or the predicted block of the second prediction mode. Therefore, for one prediction mode, the cost on the template when the prediction mode is the first prediction mode of a certain weight derivation mode can be calculated, that is, only the cost of some pixels occurring on the template with a weight of 1 when the prediction mode is the first prediction mode when the prediction mode is that weight derivation mode is calculated. As an example, this cost is represented as cost[pred_mode_idx][gpm_idx][0], where pred_mode_idx represents the index of this prediction mode, gpm_idx represents the index of this weight derivation mode, and 0 represents the first prediction mode.

[0464] Furthermore, the cost on the template when this prediction mode is set as the second prediction mode of a certain weight derivation mode is calculated, that is, only the cost of some pixels occurring on the template with a weight of 1 when this prediction mode is set as the second prediction mode in that weight derivation mode. As an example, this cost is written as cost[pred_mode_idx][gpm_idx][1], where pred_mode_idx represents the index of this prediction mode, gpm_idx represents the index of this weight derivation mode, and 1 represents the second prediction mode.

[0465] Then, when calculating the cost of one combination, the two corresponding costs can be directly added. For example, when the cost of the prediction modes pred_mode_idx0 and pred_mode_idx1 in the weight derivation mode gpm_idx is required, where pred_mode_idx0 is the first prediction mode and pred_mode_idx1 is the second prediction mode, and this cost is denoted as costTemp, costTemp=cost[pred_mode_idx0][gpm_idx][0]+cost[pred_mode_idx1][gpm_idx][1]. When the cost in weight derivation mode gpm_idx for prediction modes pred_mode_idx0 and pred_mode_idx1 is requested, where pred_mode_idx1 is the first prediction mode and pred_mode_idx0 is the second prediction mode, and this cost is written as costTemp, then costTemp = cost[pred_mode_idx1][gpm_idx][0] + cost[pred_mode_idx0][gpm_idx][1].

[0466] One advantage of this is that it simplifies the process of first weighting and combining them into one prediction block and then calculating the cost to directly calculating the costs of the two parts and then adding the costs to get the combined cost. Since one prediction mode can be combined with multiple other prediction modes and the costs of that prediction mode as part of the first and second prediction modes for the same weight derivation mode are fixed, these costs, i.e., cost[pred_mode_idx][gpm_idx][0] and cost[pred_mode_idx][gpm_idx][1] in the above example, can be retained and reused to reduce the amount of calculation.

[0467] According to the above method, a cost corresponding to each of the T second combinations can be determined, and then a candidate combination list is constructed based on the cost corresponding to each of the T second combinations.

[0468] In the embodiment of the present application, in S103-B22, the form of determining the candidate combination list based on the cost corresponding to each second combination among the T second combinations includes, but is not limited to, some examples below.

[0469] In Example 1, the T second combinations are sorted based on the cost corresponding to each of the T second combinations, and the sorted T second combinations are determined as a candidate combination list.

[0470] The candidate combination list generated in this Example 1 includes T first candidate combinations.

[0471] Optionally, the T first candidate combinations in the candidate combination list are sorted in order from smallest to largest according to the magnitude of their costs, i.e., the costs corresponding to the T first candidate combinations in the candidate combination list increase sequentially according to the sorting order.

[0472] Here, sorting the T second combinations based on the cost corresponding to each second combination among the T second combinations may be sorting the T second combinations in order from lowest to highest cost.

[0473] In Example 2, C second combinations are selected from T second combinations based on the costs corresponding to the second combinations, and a list consisting of these C second combinations is determined as a candidate combination list.

[0474] Optionally, the C second combinations are the first C second combinations with the smallest costs among the T second combinations, for example, based on the costs corresponding to each second combination among the T second combinations, the C second combinations with the smallest costs are selected from the T second combinations to form a candidate combination list, where the candidate combination list includes the C candidate combinations.

[0475] Optionally, the C candidate combinations in this candidate combination list are sorted in order from smallest to largest according to the magnitude of their costs, i.e., the costs corresponding to the C candidate combinations in the candidate combination list increase sequentially according to the sorting order.

[0476] Based on the above steps, the decoding side determines a candidate combination list, selects a first combination corresponding to a first index from the candidate combination list, determines a weight derivation mode included in the first combination as a first weight derivation mode, and determines K prediction modes included in the first combination as K first prediction modes.

[0477] Based on the above steps, the decoding side determines the first weight derivation mode and K first prediction modes, and then executes the following step S104.

[0478] S104, predicting the current block according to the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block.

[0479] In this embodiment, when decoding a current block, the decoder determines N candidate weight derivation modes, determines at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block, determines a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, and predicts the current block using the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. That is, in this embodiment, when determining a candidate prediction mode list, the weight derivation mode and attribute information of the current block are taken into consideration to improve the accuracy of determining the candidate prediction mode list, and when predicting the current block based on this accurately determined candidate prediction mode list, the prediction accuracy of the current block can be improved, thereby improving decoding performance.

[0480] In the embodiment of the present application, the specific process of predicting the current block based on the first weight derivation mode and the K first prediction modes to obtain the predicted value of the current block in S104 is not limited.

[0481] In case 1, if the weight gradient parameter (also called the transition parameter) is not considered when determining the weight of the prediction value, the weight of the prediction value of the current block is determined based on a first weight derivation mode, the current block is predicted based on K first prediction modes to obtain K prediction values ​​of the current block, and the weight of the prediction value of the current block is weighted to obtain the prediction value of the current block. Here, the process of deriving the weight of the prediction value of the current block based on the first weight derivation mode may refer to the process of deriving the weight of the prediction value of the current block in the above embodiment, and its description will be omitted here.

[0482] In case 2, when determining the weight of the predicted value, the weight gradient parameter is taken into consideration. In this case, the above S104 is S104-A1, determining a weight gradient parameter; S104-A2, predicting the current block based on the weight gradient parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block.

[0483] Here, the process of determining the weight gradient parameters in S104-A1 is basically the same as the process of determining the weight gradient parameters in S102 above, so please refer to the description of S102 above and the description thereof will be omitted here.

[0484] In the embodiment of the present application, the specific implementation process of the above S104-A2 is not limited. For example, the current block is predicted based on the first weight derivation mode and the K first prediction modes to obtain a predicted value, and then the predicted value of the current block is determined based on the weight gradient parameter and this predicted value.

[0485] In some embodiments, S104-A2 above may be S104-A21, determining weights for the predicted values ​​based on a weight gradient parameter and a first weight derivation mode; S104-A22, predicting the current block based on the K first prediction modes to obtain K predicted values; S104-A23 includes weighting the K predicted values ​​according to the weights of the predicted values ​​to obtain a predicted value of the current block.

[0486] The above S104-A22 and S104-A21 are not ordered in the execution order, that is, S104-A22 may be executed before S104-A21, after S104-A21, or in parallel with S104-A21.

[0487] In this case 2, the decoding side determines a weight gradient parameter, and determines weights of prediction values ​​based on the weight gradient parameter and the first weight derivation mode. Next, the current block is predicted based on the K first prediction modes to obtain K prediction values ​​of the current block. Then, the prediction value weights are used to weight the K prediction values ​​of the current block to obtain a prediction value of the current block.

[0488] In the embodiment of the present application, the method for determining the weight of the predicted value based on the weight gradient parameter and the first weight derivation mode includes at least the methods shown in the following examples.

[0489] In Example 1, when deriving weights for predictors using the first weight derivation mode, multiple intermediate variables need to be determined, and one or more of these multiple intermediate variables can be adjusted using a weight gradient parameter, and the adjusted variables can be used to derive weights for predictors.

[0490] In example 2, a weight index weightIdx corresponding to the current block is determined based on the first weight derivation mode and the current block, the weight index weightIdx is processed using a weight gradient parameter to obtain a processed weight index weightIdx, and a weight wVemplateValue of the prediction value is determined based on the processed weightIdx.

[0491] In one example, using the weight gradient parameter, the weight of the predicted value, wVemplateValue, can be determined by the following formula: …… weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] weightIdx=weightIdx*blendingCoeff weightIdxL=partFlip?32+weightIdx:32-weightIdx wValue=Clip3(0,8,(weightIdxL+4)>>3) However, blendingCoef f is is the weight gradient parameter.

[0492] Next, the current block is predicted based on the K first prediction modes to obtain K predicted values, and the K predicted values ​​are weighted based on the weights of the predicted values ​​to obtain a predicted value of the current block.

[0493] In the above embodiment, the template weight and the predicted value weight can be understood as two independent processes that do not interfere with each other. By the above method, the predicted value weight can be determined individually.

[0494] In some embodiments, when determining the weight of the template, a merge region is formed by the template region and the current block, and when determining the weight of the template by determining the weight of the merge region, since the current block is included in the merge region, the weight of the merge region corresponding to the current block is determined as the weight of the prediction value. Note that when determining the weight of the merge region, the influence of the weight gradient parameter on the weight is also taken into consideration. For details, please refer to the description of the above embodiments, and the description thereof will be omitted here.

[0495] In some embodiments, the prediction process is performed on a pixel point basis, and the weight of the corresponding predicted value is also a weight corresponding to the pixel point. In this case, when predicting the current block, a pixel point A of the current block is predicted using each of the K first prediction modes to obtain K predicted values ​​for pixel point A of the K first prediction modes, and the weight of the predicted value of pixel point A is determined based on the first weight derivation mode and the weight gradient parameter. Then, the weight of the predicted value of pixel point A is used to weight the K predicted values ​​to obtain a predicted value of pixel point A. By performing the above steps for each pixel point in the current block, a predicted value of each pixel point in the current block can be obtained, and the predicted values ​​of each pixel point in the current block constitute a predicted value of the current block. Taking K=2 as an example, a pixel point A in the current block is predicted using a first prediction mode to obtain a first predicted value for this pixel point A, and a second prediction mode is used to predict this pixel point A to obtain a second predicted value for this pixel point A. Based on the weight of the predicted value corresponding to pixel point A, the first predicted value and the second predicted value are weighted to obtain a predicted value for pixel point A.

[0496] In one example, taking K=2 as an example, when the first prediction mode and the second prediction mode are both intra prediction modes, prediction is performed using the first intra prediction mode to obtain a first predicted value, prediction is performed using the second intra prediction mode to obtain a second predicted value, and the first predicted value and the second predicted value are weighted based on the weight of the predicted values ​​to obtain a predicted value of the current block. For example, pixel point A is predicted using the first intra prediction mode to obtain a first predicted value of pixel point A, and pixel point A is predicted using the second intra prediction mode to obtain a second predicted value of pixel point A, and the first predicted value and the second predicted value are weighted based on the weight of the predicted value corresponding to pixel point A to obtain a predicted value of pixel point A.

[0497] In some embodiments, when K is greater than 2, weights of predictors corresponding to two of the K first prediction modes may be determined based on the first weight derivation mode, and weights of predictors corresponding to the other of the K first prediction modes may be preset values. For example, when K=3, first weights of predictors corresponding to the first and second prediction modes are derived according to the weight derivation mode, and a weight of predictor corresponding to the third prediction mode is a preset value. In some embodiments, when the total weights of predictors corresponding to the K first prediction modes are constant, for example, 8, weights of predictors corresponding to each of the K first prediction modes may be determined according to a preset weight ratio. Assuming that the weight of the predictor corresponding to the third prediction mode accounts for 1 / 4 of the total weights of predictors, the weight of the predictor for the third prediction mode may be determined to be 2, and the remaining 3 / 4 of the total weights of predictors may be assigned to the first and second prediction modes. For example, when a weight 3 of a prediction value corresponding to a first prediction mode is derived based on a first weight derivation mode, the weight of the prediction value corresponding to the first prediction mode is determined to be (3 / 4)*3, and the weight of the prediction value corresponding to the second prediction mode is determined to be (3 / 4)*5.

[0498] According to the above method, a predicted value of a current block is determined, and at the same time, the codestream is decoded to obtain the quantized coefficients of the current block, the quantized coefficients of the current block are inverse quantized and inverse transformed to obtain the residual value of the current block, and the predicted value and the residual value of the current block are added to obtain the reconstructed value of the current block.

[0499] In a video decoding method according to an embodiment of the present application, a decoding side determines N candidate weight derivation modes when decoding a current block, further determines at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block, further determines a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, and further predicts the current block using the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. That is, in this embodiment of the present application, when determining at least one candidate prediction mode, the decoding side takes into account the weight derivation mode and attribute information of the current block to improve the accuracy of determining the candidate prediction mode, and when predicting the current block based on the accurately determined candidate prediction mode, the prediction accuracy of the current block can be improved, thereby improving decoding performance.

[0500] The video decoding method of the present invention has been described above using the decoding side as an example, but the following description will be given using the encoding side as an example.

[0501] Figure 23 is a flow diagram of a video encoding method provided in an embodiment of the present application, which is applied to the video encoder shown in Figures 1 and 2. As shown in Figure 24, the method of the embodiment of the present application includes the following steps:

[0502] S201, N candidate weight derivation modes are determined.

[0503] where N is a positive integer. Optionally, N is a preset value or a default value. Optionally, N may be determined by the encoding side in other ways, and the embodiments of the present application are not limited thereto.

[0504] As can be seen from the above, in the embodiment of the present application, one weight derivation mode and K prediction modes jointly generate one prediction block, and this prediction block acts on the current block, that is, the weight is determined based on the weight derivation mode, the current block is predicted based on the K prediction modes to obtain K prediction values, and the K prediction values ​​are weighted based on the weights to obtain the prediction value of the current block.

[0505] That is, when encoding the current block, the encoding side needs to determine N candidate weight derivation modes and multiple candidate prediction modes, further select one weight derivation mode from the N candidate weight derivation modes, select K prediction modes from the multiple candidate prediction modes, and further predict the current block using the selected one weight derivation mode and the K prediction modes to obtain a predicted value of the current block.

[0506] In an embodiment of the present invention, Encoding There is no limitation on the specific method by which the side determines the N candidate weight derivation modes.

[0507] In one possible embodiment, there are 56 weight derivation modes in the AWP and 64 weight derivation modes in the GPM, and the N candidate weight derivation modes include at least one weight derivation mode of the 56 weight derivation modes in the AWP or at least one weight derivation mode of the 64 weight derivation modes in the GPM.

[0508] In one possible embodiment, several weight derivation modes in the AWP or GPM may be filtered as N candidate weight derivation modes. That is, the N candidate weight derivation modes in the embodiment of the present application are a subset of all weight derivation modes of the AWP or GPM. For example, the same "division" angle in a weight derivation mode can correspond to multiple offset amounts. For example, when these "division" angles are the same but the offset amounts are different, such as modes 10, 11, 12, and 13 in FIG. 4 or FIG. 5, modes corresponding to some offset amounts can be removed in the embodiment of the present application. Of course, modes corresponding to some "division" angles can also be removed. This reduces the total number of possible combinations and makes the differences between each possible combination more apparent. Of course, different filtering methods can be set for different block sizes. For example, fewer weight derivation modes can be used for relatively small blocks and more weight derivation modes can be used for larger blocks. Different filtering methods can also be set for different block shapes. One interpretation is that the block shape refers to the ratio of width to height.

[0509] In this embodiment, the encoding side and the decoding side have the same filtering method to obtain the N candidate weight derivation modes. In one example, the filtering method to obtain the N candidate weight derivation modes is the default on both sides of the codec. In another example, the encoding side has the same filtering method to obtain the N candidate weight derivation modes. Decoding The decoder may be instructed to use the same method and filter to obtain the same N candidate weight derivation modes as the encoder.

[0510] In some embodiments, N weight derivation modes are obtained by eliminating weight derivation modes corresponding to preset division angles and / or preset offset amounts from the M preset weight derivation modes. Since the same division angle in a weight derivation mode can correspond to multiple offset amounts, such as weight derivation modes 10, 11, 12, and 13 shown in FIG. 4, these division angles are the same but the offset amounts are different, so that weight derivation modes corresponding to some of the preset offset amounts can be eliminated and / or weight derivation modes corresponding to some of the preset division angles can be eliminated.

[0511] In some embodiments, the filtering conditions corresponding to different blocks may be different, so that when determining the N weight derivation modes corresponding to the current block, the filtering conditions corresponding to the current block are first determined, and then the N weight derivation modes are selected from the M preset weight derivation modes based on the filtering conditions corresponding to the current block.

[0512] In some embodiments, the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block. During prediction, for smaller blocks, similar weight derivation modes have little difference in their influence on the prediction result, while for larger blocks, similar weight derivation modes have more significant difference in their influence on the prediction result. Based on this, in embodiments of the present application, different N values ​​are set for blocks of different sizes, i.e., a larger N value is set for relatively larger blocks, and a smaller N value is set for relatively smaller blocks.

[0513] In one possible embodiment, the encoding side indicates N candidate weight derivation modes to the decoding side.

[0514] In some embodiments, the filtering condition comprises an array containing N elements, where the N elements correspond one-to-one to the N weight derivation modes, and an element corresponding to each weight derivation mode is used to indicate whether the weight derivation mode is available.

[0515] The above sequence may be a single-digit number or a two-digit number.

[0516] For example, taking GPM as an example, there are a total of 64 possible weight derivation modes, and a lookup table containing 64 elements is set on the encoding side, and the value of each element indicates whether or not the corresponding weight derivation mode is to be used.

[0517] In one example, using a single-digit number as an example, one specific example is: g_sgpm_splitDir

[64] ={ 1,1,1,0,1,0,1,0, 1,0,1,0,1,0,1,0, 1,0,1,1,1,0,1,0, 1,0,1,0,1,0,1,0, 0,0,0,0,1,1,0,1, 0,0,1,0,0,1,0,0, 1,0,1,1,0,1,0,0, 1,0,0,1,0,0,1,0 }; and set the g_sgpm_splitDir array, where, if the value of g_sgpm_splitDir[x] is 1, it indicates that the weight derivation mode of index x can be used, otherwise it indicates that the weight derivation mode of index x cannot be used. In this example, the decoding side determines 26 candidate weight derivation modes from this array.

[0518] In another example, one array can be used to indicate N candidate weight derivation modes, where the array contains only the indices of the available weight derivation modes, e.g., a length 26 array g_sgpm_splitDir

[26] ={0,1,6,8,10,12,14,16,18,19,20,22,24,26,28,30,36,37,42,45,48,50,51,53, 56, 59} is used to indicate 26 candidate weight derivation modes. The encoding side determines the weight derivation mode corresponding to the index as a candidate weight derivation mode based on the weight derivation mode index included in this number, and obtains 26 candidate weight derivation modes.

[0519] In some embodiments, if the filtering conditions corresponding to the current block include a filtering condition corresponding to the size of the current block and a filtering condition corresponding to the shape of the current block, and for the same weight derivation mode, if the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicate that this weight derivation mode is all available, then determine this weight derivation mode as one of the N weight derivation modes; if at least one of the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicates that this weight derivation mode is not available, then determine that this weight derivation mode does not constitute the N weight derivation modes.

[0520] In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes may be implemented using multiple arrays, respectively.

[0521] In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes may be realized using a two-bit array, i.e., one two-bit array includes both filtering conditions corresponding to block sizes and filtering conditions corresponding to block shapes.

[0522] For example, the filtering condition for a block of size A and shape B is: g_sgpm_splitDir

[64] = { (1,1),(1,1),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (1,1),(0,0),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (0,1),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0), (1,1),(0,0),(0,1),(1,0),(1,0),(1,0),(1,0),(0,0), (0,0),(0,0),(1,1),(0,0),(1,1),(1,1),(1,0),(0,1), (0,0),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0), (1,0),(0,0),(1,1),(1,0),(1,0),(1,0),(0,0),(0,0), (1,1),(0,0),(1,1),(0,0),(0,0),(1,0),(1,1),(0,0) }; As shown in the figure, this filtering condition is expressed as a binary array, In the formula, if all values ​​of g_sgpm_splitDir[x] are 1, it indicates that the weight derivation mode of index x is available, and if one of the values ​​of g_sgpm_splitDir[x] is 0, it indicates that the weight derivation mode of index x is not available. For example, g_sgpm_splitDir[4]=(1,0) indicates that weight derivation mode 4 is available for blocks of size A but not for blocks of shape B, so when the block size is A and the shape is B, the weight derivation mode is not available.

[0523] In the above, an example was given in which the GPM includes 64 weight derivation modes, but the weight derivation modes in the embodiments of the present application include, but are not limited to, the 64 weight derivation modes included in the GPM and the 56 weight derivation modes included in the AMP.

[0524] In some embodiments, before determining the N candidate weight derivation modes, the encoding side must first determine whether the current block will undergo weighted prediction processing using K different prediction modes. If the encoding side determines that the current block will undergo weighted prediction processing using K different prediction modes, 2 01 to determine N candidate weight derivation modes. If the encoding side determines that the current block is not to be subjected to weighted prediction processing using K different prediction modes, the encoding side executes the above S 2 Skip step 01.

[0525] In one possible embodiment, the encoding side can determine whether the current block undergoes weighted prediction processing using K different prediction modes by determining a prediction mode parameter for the current block.

[0526] Optionally, in an embodiment of the present application, the prediction mode parameter may indicate whether the current block can use GPM mode or AWP mode, i.e., whether the current block can be predicted using K different prediction modes.

[0527] Note that, in this embodiment, the prediction mode parameter can be understood as a flag bit indicating whether the GPM mode or the AWP mode is used. Specifically, the encoder may use one variable as the prediction mode parameter, and the setting of the prediction mode parameter can be achieved by setting the value of the variable. Exemplarily, in this embodiment, if the current block uses the GPM mode or the AWP mode, the encoder may set the value of the prediction mode parameter to indicate that the current block uses the GPM mode or the AWP mode, specifically, the encoder may set the value of the variable to 1. Exemplarily, in this embodiment, if the current block does not use the GPM mode or the AWP mode, the encoder may set the value of the prediction mode parameter to indicate that the current block does not use the GPM mode or the AWP mode, specifically, the encoder may set the value of the variable to 0. Furthermore, in this embodiment, after the encoder completes setting the prediction mode parameter, the encoder may write the prediction mode parameter into a codestream and transmit it to a decoder, so that the decoder can obtain the prediction mode parameter after parsing the codestream.

[0528] In some embodiments, the embodiments of the present application may further conditionally restrict the current block to use the GPM mode or the AWP mode, i.e., if it is determined that the current block satisfies a predetermined condition, it may determine that the current block performs weighted prediction using K prediction modes, and thus determine N candidate weight derivation modes corresponding to the current block.

[0529] Illustratively, when applying the GPM mode or the AWP mode, the size of the current block can be limited.

[0530] In addition, since the video encoding method provided in the embodiment of the present application needs to generate K predicted values ​​using K different prediction modes respectively and then weight them based on the weights to obtain the predicted value of the current block, in order to reduce complexity while considering the trade-off between compression performance and complexity, the embodiment of the present application may restrict the use of the GPM mode or AWP mode for blocks of some sizes. Therefore, in the present application, the encoder can first determine the size parameter of the current block, and then determine whether the current block uses the GPM mode or the AWP mode based on the size parameter.

[0531] In an embodiment of the present application, the size parameters of the current block may include the height and width of the current block, so that the encoder can determine whether the current block uses GPM mode or AWP mode depending on the height and width of the current block.

[0532] Illustratively, in this application, it is determined that the current block can use GPM mode or AWP mode if the width is greater than threshold 1 and the height is greater than threshold 2. Thus, one possible restriction is to use GPM mode or AWP mode only if the width of the block is greater than (or equal to) threshold 1 and the height of the block is greater than (or equal to) threshold 2. Here, the values ​​of threshold 1 and threshold 2 may be 4, 8, 16, 32, 128, 256, etc., and threshold 1 may be equal to threshold 2.

[0533] Illustratively, in the present application, it is determined that the current block can use the GPM mode or the AWP mode if the width is smaller than the threshold 3 and the height is larger than the threshold 4. Thus, one possible restriction is to use the GPM mode or the AWP mode only if the width of the block is smaller than (or smaller than) the threshold 3 and the height of the block is larger than (or larger than) the threshold 4. Here, the values ​​of the threshold 3 and the threshold 4 may be 4, 8, 16, 32, 128, 256, etc., and the threshold 3 may be equal to the threshold 4.

[0534] Furthermore, in the present embodiment, pixel parameter restrictions may be implemented to limit the size of blocks that can use the GPM mode or AWP mode.

[0535] Illustratively, in this application, the encoder may first determine pixel parameters of the current block, and then further determine whether the current block can use the GPM mode or the AWP mode based on the pixel parameters and a threshold value 5. Thus, one possible restriction is to use the GPM mode or the AWP mode only if the number of pixels of the block is greater than (or equal to) the threshold value 5. Here, the value of the threshold value 5 may be 4, 8, 16, 32, 128, 256, 1024, etc.

[0536] That is, in this application, the current block can use the GPM mode or the AWP mode only under the condition that the size parameter of the current block meets the size requirement.

[0537] For example, the present application may have a frame-level flag for determining whether or not a frame currently waiting to be encoded uses the present application. For example, intraframes (e.g., I frames) may be configured to use the present application, while interframes (e.g., B frames, P frames) may not. Alternatively, intraframes may be configured not to use the present application, while interframes may be configured to use the present application. Alternatively, some interframes may be configured to use the present application, while other interframes may not. Since intraframes can also use intraprediction, there is a possibility that the present application may also be used in interframes.

[0538] In some embodiments, there may also be a flag below the frame level to determine whether the current block uses this application.

[0539] S202: determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block;

[0540] In an embodiment of the present application, when determining at least one candidate prediction mode, not only is the influence of the candidate weight derivation mode on the candidate prediction mode taken into consideration, but the influence of the attribute information of the current block on the candidate prediction mode is also taken into consideration, thereby improving the accuracy of determining the candidate prediction mode.

[0541] In the embodiment of the present application, the specific content of the attribute information of the current block is not limited.

[0542] In some embodiments, the attribute information of the current block includes size information of the current block, such as the length and width of the current block, the aspect ratio of the current block, or the number of pixel points included in the current block.

[0543] In some embodiments, the attribute information of the current block further includes shape information of the current block, such as the shape of the current block being a square, the shape of the current block being a rectangle, or the shape of the current block being a predetermined shape such as a polygon or a circle.

[0544] In the embodiment of the present application, determining at least one candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block can be understood as determining which prediction mode of a neighboring block of the current block can be used to determine the candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block. For example, determining weights of the neighboring blocks based on the candidate weight derivation modes and attribute information of the current block, and determining which prediction mode of the neighboring block to select for use in determining the candidate prediction mode based on the weights of the neighboring blocks.

[0545] For example, in a certain GPM weight derivation mode, if the weight of a neighboring block for a certain prediction mode (first prediction mode or second prediction mode) is greater than (or equal to) a certain threshold, it indicates that the neighboring block has a strong correlation with the area occupied by the current prediction mode; otherwise, it indicates that the neighboring block has a weak correlation with the area occupied by the current prediction mode.

[0546] In some embodiments, the encoding side may determine at least one candidate prediction mode based on N candidate weight derivation modes and attribute information of the current block. That is, in this embodiment, the N candidate weight derivation modes correspond to one candidate prediction mode list. For example, if the division line angles and offset amounts of the N candidate weight derivation modes are not significantly different from each other, in order to reduce the amount of calculation and improve encoding efficiency, the encoding side may determine one candidate weight derivation mode A from among the N candidate weight derivation modes and determine one candidate prediction mode list based on this candidate weight derivation mode and attribute information of the current block. In one example, the candidate weight derivation mode A may be a default candidate weight derivation mode among the N candidate weight derivation modes. For example, the encoding side may instruct the decoding side of the index of this candidate weight derivation mode A, so that the decoding side can decode the codestream and obtain the index of the candidate weight derivation mode A.

[0547] In some embodiments, at least one candidate weight derivation mode among the N candidate weight derivation modes corresponds to one candidate prediction mode list, that is, the encoding side determines one candidate prediction mode list for each candidate weight derivation mode among the N candidate weight derivation modes, and in this case, the above S202 includes the following step S202-A:

[0548] In step S202-A, for an ith candidate weight derivation mode among the N candidate weight derivation modes, a candidate prediction mode list corresponding to the ith candidate weight derivation mode is determined based on the ith candidate weight derivation mode and attribute information of the current block.

[0549] In this embodiment, the method for determining the candidate prediction mode list corresponding to each of the N candidate weight derivation modes is the same, so for convenience of explanation, the i-th candidate weight derivation mode of the N candidate weight derivation modes will be taken as an example. Here, the i-th candidate weight derivation mode can be understood as any of the N candidate weight derivation modes.

[0550] In the embodiment of the present application, there is no limitation on the specific form of determining the candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block.

[0551] In some embodiments, the i-th candidate weight derivation mode corresponds to one candidate prediction mode list, i.e., one candidate prediction mode list corresponding to the i-th candidate weight derivation mode is determined based on the i-th candidate weight derivation mode and attribute information of the current block. When predicting the current block in this way, K prediction modes are determined from the candidate prediction mode list corresponding to the i-th candidate weight derivation mode, and the current block is predicted using the i-th candidate weight derivation mode and the K prediction modes to obtain a predicted value of the current block. For example, weights are determined based on the i-th candidate weight derivation mode, the current block is predicted using the K prediction modes to obtain K predicted values, and the K predicted values ​​are weighted using the weights to obtain a predicted value of the current block in the i-th candidate weight derivation mode.

[0552] In one example of this embodiment, a method for determining a candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block may include determining a division line corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode, and dividing the current block by determining the division line based on attribute information of the current block to obtain a first portion and a second portion, where the first portion can be understood as a portion corresponding to the first prediction mode, and the second portion can be understood as a portion corresponding to the second prediction mode. In this way, it can be determined that the ith candidate weight derivation mode corresponds to one candidate prediction mode list based on the prediction modes of the neighboring blocks of the current block that are adjacent to the first portion of the current block.

[0553] In another example of this embodiment, a method for determining a candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block may include determining a weight of each neighboring block of the current block based on the ith candidate weight derivation mode and attribute information of the current block, and further determining that the ith candidate weight derivation mode corresponds to one candidate prediction mode list based on the weights of the neighboring blocks. For example, the ith candidate weight derivation mode may be determined to correspond to one candidate prediction mode list based on the prediction mode of a neighboring block with a relatively large weight.

[0554] In some embodiments, when the i-th candidate weight derivation mode corresponds to K prediction modes, the above S202-A includes the following step S202-A1.

[0555] In step S202-A1, a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i-th candidate weight derivation mode is determined based on the i-th candidate weight derivation mode and attribute information of the current block.

[0556] In this embodiment, the encoding side determines a candidate prediction mode list of at least one prediction mode list from among the K prediction modes corresponding to the i-th candidate weight derivation mode.

[0557] For example, when K=2, the encoding side may determine one candidate prediction mode list for the first prediction mode but not for the second candidate prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block. Optionally, the encoding side may determine one candidate prediction mode list for the second prediction mode but not for the first candidate prediction mode. Optionally, the encoding side may determine one candidate prediction mode list for the first prediction mode and one candidate prediction mode list for the second candidate prediction mode. Optionally, the encoding side may determine a common candidate prediction mode list for the first prediction mode and the second prediction mode.

[0558] In an embodiment of the present application, a candidate prediction mode list is determined for at least one prediction mode corresponding to the i-th candidate weight derivation mode, and further, at least one prediction mode corresponding to the i-th candidate weight derivation mode is accurately determined from the constructed candidate prediction mode list.

[0559] In some embodiments, when the at least one prediction mode corresponds to one candidate prediction mode list, the above S202-A1 includes the following steps S202-A1-11 and S202-A1-12.

[0560] S202-A1-11, for a j-th prediction mode of the at least one prediction mode, determine a candidate prediction mode list for the j-th prediction mode according to the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer.

[0561] S202-A1-12: determining a candidate prediction mode list for at least one prediction mode based on the candidate prediction mode list for the j-th prediction mode;

[0562] In this embodiment, at least one prediction mode corresponding to the i-th candidate weight derivation mode corresponds to one candidate prediction mode list, that is, the candidate prediction mode list corresponding to this at least one prediction mode is the same, that is, one candidate prediction mode list, thereby reducing the complexity of determining the candidate prediction mode list and improving encoding efficiency. At this time, the encoding side determines one candidate prediction mode list for this at least one prediction mode.

[0563] Specifically, a candidate prediction mode list for a jth prediction mode among the at least one prediction mode is determined based on the ith candidate weight derivation mode and attribute information of the current block. Optionally, the jth prediction mode is one of the at least one prediction modes. Then, a candidate prediction mode list for the at least one prediction mode is determined based on the candidate prediction mode list for the jth prediction mode.

[0564] Here, a specific example of determining the candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j-th prediction mode in S202-A1-12 is as follows: Aspect 1 is aspect 1 in which the candidate prediction mode list of the j-th prediction mode is directly determined as the candidate prediction mode list of the at least one prediction mode; The present invention includes, but is not limited to, form 2, in which it is determined whether a candidate prediction mode list for a j-th prediction mode includes a preset prediction mode, and if the candidate prediction mode list for the j-th prediction mode includes the preset prediction mode, the candidate prediction mode list for the j-th prediction mode is determined as the candidate prediction mode list for at least one prediction mode, and if the candidate prediction mode list for the j-th prediction mode does not include the preset prediction mode, the preset prediction mode is added to the candidate prediction mode list for the j-th prediction mode to obtain a candidate prediction mode list for at least one prediction mode.

[0565] In the embodiment of the present application, the preset prediction mode in the above-mentioned second embodiment is not limited, and specifically, is determined according to actual needs.

[0566] In this embodiment, when the at least one prediction mode corresponds to one candidate prediction mode list, a specific process of determining the candidate prediction mode list for the at least one prediction mode will be described.

[0567] In some embodiments, when each prediction mode of the at least one prediction mode corresponds to one candidate prediction mode list, the above S202-A1 includes the following step S202-A1-21.

[0568] S202-A1-21, for a j-th prediction mode of the at least one prediction mode, determine a candidate prediction mode list for the j-th prediction mode according to the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer.

[0569] In this embodiment, since each prediction mode of the at least one prediction mode corresponds to one candidate prediction mode list, the encoding side determines, for an ith candidate weight derivation mode, one candidate prediction mode list for each prediction mode of the at least one prediction mode corresponding to the ith candidate weight derivation mode. For example, the at least one prediction mode includes a first prediction mode and a second prediction mode corresponding to the ith candidate weight derivation mode, and thus the encoding side determines one candidate prediction mode list for the first prediction mode and one candidate prediction mode list for the second prediction mode.

[0570] In this embodiment, the process of determining one candidate prediction mode list corresponding to each prediction mode among the at least one prediction mode is the same, and for convenience of explanation, the embodiment of the present application will be described as an example of determining a candidate prediction mode list for the jth prediction mode among the at least one prediction mode.

[0571] The following describes the process of determining the candidate prediction mode list for the j-th prediction mode based on the i-th candidate weight derivation mode and the attribute information of the current block in the above S202-A1-11 and S202-A1-21.

[0572] In the embodiment of the present application, specific embodiments for determining the candidate prediction mode list of the j-th prediction mode based on the i-th candidate weight derivation mode and the attribute information of the current block include at least the following two forms.

[0573] In the first embodiment, the encoding side determines the candidate prediction mode list for the j-th prediction mode by the method of steps 31 to 33 below: Step 31: determining a first lookup table including neighboring blocks corresponding to different prediction modes under different block attribute information and different weight derivation modes; Step 32: determining the neighboring block corresponding to the jth prediction mode in the first lookup table according to the attribute information of the current block and the ith candidate weight derivation mode; Step 33: determining a candidate prediction mode list for the j-th prediction mode based on the prediction modes of the neighboring blocks corresponding to the j-th prediction mode;

[0574] In this form 1, based on different block attribute information, a first lookup table is determined which includes adjacent blocks corresponding to different prediction modes in different block attribute information and different weight derivation modes. In this way, by searching the first lookup table, the adjacent block corresponding to the jth prediction mode can be directly obtained, and thereby a candidate prediction mode list for the jth prediction mode is determined based on the prediction mode of the adjacent block corresponding to the jth prediction mode.

[0575] In the embodiment of the present application, the specific representation form of the first lookup table is not limited.

[0576] In one possible embodiment, the first lookup table includes P different sub lookup tables, where the P sub lookup tables respectively correspond to the P blocks of attribute information, and the lookup tables include neighboring blocks corresponding to different prediction modes in different weight derivation modes. In this way, the encoding side can determine a first sub lookup table corresponding to the current block from the P sub lookup tables based on the attribute information of the current block, where the first sub lookup table includes neighboring blocks corresponding to different prediction modes in different weight derivation modes. Then, based on the ith candidate weight derivation mode, determine a neighboring block corresponding to the jth prediction mode in the first sub lookup table, and then determine a candidate prediction mode list for the jth prediction mode based on the prediction mode of the neighboring block corresponding to the jth prediction mode.

[0577] In the embodiment of the present application, different sub-lookup tables are determined based on the attribute information of different blocks, where the lookup tables include neighboring blocks corresponding to different prediction modes in different weight derivation modes.

[0578] In one example, it is assumed that the attribute information of a block includes the aspect ratio of the block, and that the P sub-lookup tables include a lookup table corresponding to blocks with an aspect ratio of 1:2, a lookup table corresponding to blocks with an aspect ratio of 1:1, and a lookup table corresponding to blocks with an aspect ratio of 2:1.

[0579] For example, a lookup table corresponding to a block with an aspect ratio of 1:2 is shown in Table 6.

[0580] Thus, when encoding the current block, if the aspect ratio of the current block is determined to be 1:2 based on the size information of the current block, a first sub lookup table as shown in Table 6 is obtained from the P sub lookup tables. Next, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Specifically, a neighboring block corresponding to the jth prediction mode is determined in the first sub lookup table based on the i-th candidate weight derivation mode. Assuming K=2, the jth prediction mode is the first prediction mode, which corresponds to the first portion of Table 6 above. In this way, a neighboring block corresponding to the i-th prediction mode can be determined from the neighboring blocks corresponding to the first portion based on the i-th candidate weight derivation mode. For example, since the i-th candidate weight derivation mode is...

Claims

1. 1. A video decoding method, comprising: determining N candidate weight derivation modes, where N is a positive integer; determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block; determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; predicting a current block based on the first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

2. The step of determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block includes:

2. The method of claim 1, further comprising: a step of determining a candidate prediction mode list corresponding to an i-th candidate weight derivation mode among the N candidate weight derivation modes based on the i-th candidate weight derivation mode and attribute information of the current block, wherein i is a positive integer equal to or less than N.

3. determining a candidate prediction mode list corresponding to the i-th candidate weight derivation mode based on the i-th candidate weight derivation mode and attribute information of the current block, 3. The method of claim 2, further comprising: determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i-th candidate weight derivation mode based on the i-th candidate weight derivation mode and attribute information of the current block.

4. When the at least one prediction mode corresponds to one candidate prediction mode list, the step of determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i candidate weight derivation mode based on the i candidate weight derivation mode and attribute information of the current block includes: determining a candidate prediction mode list for a j-th prediction mode among the at least one prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer; and determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the jth prediction mode.

5. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes: The method of claim 4 , comprising determining a candidate prediction mode list for the at least one prediction mode based on a candidate prediction mode list for the jth prediction mode.

6. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes:

5. The method of claim 4, further comprising: determining, when a predetermined prediction mode is included in the candidate prediction mode list for the j prediction mode, the candidate prediction mode list for the j prediction mode as the candidate prediction mode list for the at least one prediction mode.

7. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes:

5. The method of claim 4, further comprising: if a preset prediction mode is not included in the candidate prediction mode list for the j prediction mode, adding the preset prediction mode to the candidate prediction mode list for the j prediction mode to obtain a candidate prediction mode list for the at least one prediction mode.

8. When each prediction mode among the at least one prediction mode corresponds to one candidate prediction mode list, the step of determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i candidate weight derivation mode based on the i candidate weight derivation mode and attribute information of the current block includes:

4. The method of claim 3, further comprising: determining a candidate prediction mode list for a j-th prediction mode of the at least one prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block, wherein j is a positive integer.

9. determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining a first lookup table including neighboring blocks corresponding to different prediction modes under different block attribute information and different weight derivation modes; determining an adjacent block corresponding to the j prediction mode in the first lookup table based on attribute information of the current block and the i candidate weight derivation mode; and determining a candidate prediction mode list for the jth prediction mode based on prediction modes of neighboring blocks corresponding to the jth prediction mode.

10. determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining a weight for the j prediction mode of the neighboring block of the current block based on the i candidate weight derivation mode and attribute information of the current block; and determining a candidate prediction mode list for the jth prediction mode based on weights for the jth prediction mode of the neighboring blocks.

11. The step of determining a weight for the j prediction mode of the neighboring block of the current block based on the i candidate weight derivation mode and attribute information of the current block includes: determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block; and determining the weight of the first point as the weight for the jth prediction mode of the neighboring block.

12. The step of determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block includes: The method of claim 11 , further comprising determining a weight for the first point based on the i-th candidate weight derivation mode, attribute information of the current block, and a template of the current block.

13. The step of determining the weight of the first point based on the i-th candidate weight derivation mode, the attribute information of the current block, and the template of the current block includes: determining a weight of the template based on the i-th candidate weight derivation mode, attribute information of the current block, and a template of the current block; and determining a weight of the template corresponding to the first point as the weight of the first point.

14. The step of determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block includes: determining a second point within the current block that corresponds to the first point; determining a weight of the second point based on the i-th candidate weight derivation mode and attribute information of the current block; and determining a weight for the first point based on a weight for the second point.

15. 15. The method of claim 14, wherein the second point is a point adjacent to the first point in the current block.

16. The method according to any one of claims 11 to 15, wherein the first point is any point within the adjacent block.

17. The method according to any one of claims 11 to 15, wherein the first point is a point in the neighboring block adjacent to the current block.

18. determining a candidate prediction mode list for the j prediction mode based on weights for the j prediction mode of the neighboring blocks, obtaining a prediction mode of the neighboring block when a weight for the j prediction mode of the neighboring block is equal to or greater than a predetermined threshold; and determining a candidate prediction mode list for the jth prediction mode based on prediction modes of the neighboring blocks.

19. 19. The method of claim 18, wherein when the weight value ranges from 0 to n, the preset threshold is n / 2, where n is a positive number.

20. When the value of the weight is a first value or a second value, the step of determining a candidate prediction mode list for the j prediction mode based on a weight for the j prediction mode of the neighboring block includes: obtaining a prediction mode of the neighboring block if the weight for the jth prediction mode of the neighboring block is equal to the first value, the first value being greater than the second value; and determining a candidate prediction mode list for the jth prediction mode based on prediction modes of the neighboring blocks.

21. The step of obtaining a prediction mode of the neighboring block includes:

21. The method according to claim 18 or 20, further comprising: sequentially obtaining prediction modes of neighboring blocks of the current block whose weights for the j prediction mode are equal to or greater than a predetermined threshold or equal to a first value according to a predetermined check order.

22. The step of determining a candidate prediction mode list for the j prediction mode based on the prediction modes of the neighboring blocks includes: The method of claim 21 , further comprising: sequentially adding the obtained prediction modes of the neighboring blocks to the candidate prediction mode list of the jth prediction mode according to the checking order.

23. 22. The method of claim 21, wherein, when the neighboring blocks of the current block include a left neighboring block, an upper neighboring block, a lower-left neighboring block, an upper-right neighboring block, and an upper-left neighboring block, the predetermined checking order is the left neighboring block, the upper neighboring block, the lower-left neighboring block, the upper-right neighboring block, and the upper-left neighboring block.

24. The step of determining a candidate prediction mode list for the j prediction mode based on the prediction modes of the neighboring blocks includes:

21. The method according to claim 18, further comprising adding the prediction mode of the neighboring block to a candidate prediction mode list for the j prediction mode if the prediction mode of the neighboring block is not included in the candidate prediction mode list for the j prediction mode.

25. 21. The method according to claim 18 or 20, further comprising: skipping obtaining the prediction mode of the neighboring block if the weight for the j prediction mode of the neighboring block is less than a predetermined threshold or equal to a second value.

26. When the current block includes M neighboring blocks, determining a candidate prediction mode list for the j prediction mode based on weights of the neighboring blocks for the j prediction mode includes:

11. The method of claim 10, further comprising determining a candidate prediction mode list for the jth prediction mode based on a weight for the jth prediction mode of each of the M neighboring blocks and the prediction modes of the M neighboring blocks, wherein M is a positive integer.

27. determining a candidate prediction mode list for the j prediction mode based on weights for the j prediction mode of each of the M neighboring blocks and the prediction modes of the M neighboring blocks, 27. The method of claim 26, further comprising adding prediction modes of the M neighboring blocks to the candidate prediction mode list based on a weight magnitude for the jth prediction mode of each of the M neighboring blocks until the length of the candidate prediction mode list reaches a predetermined length.

28. 28. The method of claim 27, wherein the M neighboring blocks include at least one of a left neighboring block, an upper neighboring block, a lower left neighboring block, an upper right neighboring block, and an upper left neighboring block.

29. before determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining whether a candidate prediction mode list of the j prediction mode includes a prediction mode of a neighboring block; determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, 9. The method according to claim 4, further comprising: determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block when it is determined that the prediction mode of the neighboring block is included in the candidate prediction mode list for the j prediction mode.

30. The step of determining whether the candidate prediction mode list of the j prediction mode includes a prediction mode of a neighboring block includes: decoding a codestream to obtain first information indicating whether the candidate prediction mode list includes a prediction mode of a neighboring block; and determining whether the prediction mode of the neighboring block is included in a candidate prediction mode list for the jth prediction mode based on the first information.

31. The step of determining whether the candidate prediction mode list of the j prediction mode includes a prediction mode of a neighboring block includes:

30. The method of claim 29, further comprising: determining that the prediction mode of the neighboring block is included in the candidate prediction mode list of the j prediction mode if the length of the candidate prediction mode list does not reach a predetermined length after adding, to the candidate prediction mode list, each prediction mode that is located before the prediction mode of the neighboring block in the predetermined order according to a predetermined order.

32. 32. The method of claim 31 , wherein the preset order includes a prediction mode whose prediction angle is parallel to a dividing line of the i-th candidate weight derivation mode, a candidate prediction mode derived based on a template of the current block, a candidate prediction mode derived based on reconstructed pixels around the current block, a prediction mode of the neighboring block, a prediction mode whose prediction angle is perpendicular to a dividing line of the i-th candidate weight derivation mode, and a preset mode.

33. 33. The method of claim 32, wherein the preset modes include a PLANAR mode.

34. determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, decoding a codestream to obtain a first index for indicating a first combination including the first weight derivation mode and the K first prediction modes; determining a candidate combination list based on the N candidate weight derivation modes and the at least one candidate prediction mode, the candidate combination list including at least one candidate combination, the candidate combination including one weight derivation mode and K prediction modes; and determining the first combination from the candidate combination list based on the first index.

35. The step of determining a candidate combination list based on the N candidate weight derivation modes and the at least one candidate prediction mode includes: obtaining T second combinations based on the N candidate weight derivation modes and the at least one candidate prediction mode, wherein any one of the T second combinations includes one weight derivation mode and K prediction modes, and the weight derivation mode and the K prediction modes included in any two of the T second combinations are not exactly the same, where T is a positive integer greater than 1; and obtaining the list of candidate combinations based on the T second combinations.

36. The step of obtaining the candidate combination list based on the T second combinations includes: determining a cost corresponding to any one of the T second combinations when predicting a template of the current block using a weight derivation mode in the second combination and K prediction modes; and determining the candidate combination list based on a cost corresponding to each second combination among the T second combinations.

37. 9. The method according to claim 1, wherein the height of the top template of the current block is 1 and / or the width of the left template of the current block is 1.

38. 9. The method according to claim 1, wherein the attribute information of the current block includes size information of the current block.

39. 1. A video encoding method, comprising: determining N candidate weight derivation modes, where N is a positive integer; determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block; determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; predicting a current block based on the first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

40. The step of determining at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of the current block includes:

40. The method of claim 39, further comprising: for an ith candidate weight derivation mode among the N candidate weight derivation modes, determining a candidate prediction mode list corresponding to the ith candidate weight derivation mode based on the ith candidate weight derivation mode and attribute information of the current block, wherein i is a positive integer equal to or less than N.

41. determining a candidate prediction mode list corresponding to the i-th candidate weight derivation mode based on the i-th candidate weight derivation mode and attribute information of the current block, The method of claim 40, further comprising determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i-th candidate weight derivation mode based on the i-th candidate weight derivation mode and attribute information of the current block.

42. When the at least one prediction mode corresponds to one candidate prediction mode list, the step of determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i candidate weight derivation mode based on the i candidate weight derivation mode and attribute information of the current block includes: determining a candidate prediction mode list for a j-th prediction mode among the at least one prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block, where j is a positive integer; and determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the jth prediction mode.

43. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes:

43. The method of claim 42, comprising determining a candidate prediction mode list for the at least one prediction mode based on a candidate prediction mode list for the jth prediction mode.

44. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes:

43. The method of claim 42, further comprising determining the candidate prediction mode list of the jth prediction mode as the candidate prediction mode list for the at least one prediction mode if a predetermined prediction mode is included in the candidate prediction mode list of the jth prediction mode.

45. The step of determining a candidate prediction mode list for the at least one prediction mode based on the candidate prediction mode list for the j prediction mode includes:

43. The method of claim 42, further comprising: if a preset prediction mode is not included in the candidate prediction mode list for the j prediction mode, adding the preset prediction mode to the candidate prediction mode list for the j prediction mode to obtain a candidate prediction mode list for the at least one prediction mode.

46. When each prediction mode among the at least one prediction mode corresponds to one candidate prediction mode list, the step of determining a candidate prediction mode list of at least one prediction mode among the K prediction modes corresponding to the i candidate weight derivation mode based on the i candidate weight derivation mode and attribute information of the current block includes:

42. The method of claim 41, further comprising: determining a candidate prediction mode list for a j-th prediction mode of the at least one prediction mode based on the i-th candidate weight derivation mode and attribute information of the current block, wherein j is a positive integer.

47. determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining a first lookup table including neighboring blocks corresponding to different prediction modes under different block attribute information and different weight derivation modes; determining an adjacent block corresponding to the j prediction mode in the first lookup table based on attribute information of the current block and the i candidate weight derivation mode; and determining a candidate prediction mode list for the jth prediction mode based on prediction modes of neighboring blocks corresponding to the jth prediction mode.

48. determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining a weight for the j prediction mode of the neighboring block of the current block based on the i candidate weight derivation mode and attribute information of the current block; and determining a candidate prediction mode list for the jth prediction mode based on weights for the jth prediction mode of the neighboring blocks.

49. The step of determining a weight for the j prediction mode of the neighboring block of the current block based on the i candidate weight derivation mode and attribute information of the current block includes: determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block; 49. The method of claim 48, further comprising determining the weight of the first point as the weight for the jth prediction mode of the neighboring block.

50. The step of determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block includes:

50. The method of claim 49, further comprising determining a weight for the first point based on the i-th candidate weight derivation mode, attribute information of the current block, and a template of the current block.

51. The step of determining the weight of the first point based on the i-th candidate weight derivation mode, the attribute information of the current block, and the template of the current block includes: determining a weight of the template based on the i-th candidate weight derivation mode, attribute information of the current block, and a template of the current block; and determining a weight of the template corresponding to the first point as the weight of the first point.

52. The step of determining a weight of a first point in the adjacent block based on the i-th candidate weight derivation mode and attribute information of the current block includes: determining a second point within the current block that corresponds to the first point; determining a weight of the second point based on the i-th candidate weight derivation mode and attribute information of the current block; and determining a weight for the first point based on a weight for the second point.

53. 53. The method of claim 52, wherein the second point is a point adjacent to the first point in the current block.

54. 54. The method of any one of claims 49 to 53, wherein the first point is any point within the adjacent block.

55. 54. The method of any one of claims 49 to 53, wherein the first point is a point in the neighboring block adjacent to the current block.

56. determining a candidate prediction mode list for the j prediction mode based on weights for the j prediction mode of the neighboring blocks, obtaining a prediction mode of the neighboring block when a weight for the j prediction mode of the neighboring block is equal to or greater than a predetermined threshold; 49. The method of claim 48, further comprising determining a candidate prediction mode list for the jth prediction mode based on prediction modes of the neighboring blocks.

57. 57. The method of claim 56, wherein when the weight value ranges from 0 to n, the preset threshold is n / 2, where n is a positive number.

58. When the value of the weight is a first value or a second value, the step of determining a candidate prediction mode list for the j prediction mode based on a weight for the j prediction mode of the neighboring block includes: obtaining a prediction mode of the neighboring block if the weight for the j prediction mode of the neighboring block is equal to the first value, the first value being greater than the second value; 49. The method of claim 48, further comprising determining a candidate prediction mode list for the jth prediction mode based on prediction modes of the neighboring blocks.

59. The step of obtaining a prediction mode of the neighboring block includes:

59. The method of claim 56 or 58, further comprising: sequentially obtaining prediction modes of neighboring blocks of the current block whose weights for the j prediction mode are equal to or greater than a predetermined threshold or equal to a first value according to a predetermined check order.

60. The step of determining a candidate prediction mode list for the j prediction mode based on the prediction modes of the neighboring blocks includes:

60. The method of claim 59, further comprising: sequentially adding the obtained prediction modes of the neighboring blocks to a candidate prediction mode list of the jth prediction mode according to the checking order.

61. 60. The method of claim 59, wherein, when the neighboring blocks of the current block include a left neighboring block, an upper neighboring block, a lower-left neighboring block, an upper-right neighboring block, and an upper-left neighboring block, the predetermined checking order is the left neighboring block, the upper neighboring block, the lower-left neighboring block, the upper-right neighboring block, and the upper-left neighboring block.

62. The step of determining a candidate prediction mode list for the j prediction mode based on the prediction modes of the neighboring blocks includes:

59. The method of claim 56 or 58, further comprising adding the prediction mode of the neighboring block to the candidate prediction mode list for the j prediction mode if the prediction mode of the neighboring block is not included in the candidate prediction mode list for the j prediction mode.

63. 59. The method of claim 56 or 58, further comprising: skipping obtaining the prediction mode of the neighboring block if the weight for the j prediction mode of the neighboring block is less than a preset threshold or less than a second value.

64. When the current block includes M neighboring blocks, determining a candidate prediction mode list for the j prediction mode based on weights of the neighboring blocks for the j prediction mode includes:

49. The method of claim 48, comprising determining a candidate prediction mode list for the jth prediction mode based on a weight for the jth prediction mode of each of the M neighboring blocks and the prediction modes of the M neighboring blocks, wherein M is a positive integer.

65. determining a candidate prediction mode list for the j prediction mode based on weights for the j prediction mode of each of the M neighboring blocks and the prediction modes of the M neighboring blocks, 65. The method of claim 64, further comprising adding prediction modes of the M neighboring blocks to the candidate prediction mode list based on a weight for the j prediction mode of each of the M neighboring blocks until the length of the candidate prediction mode list reaches a predetermined length.

66. 66. The method of claim 65, wherein the M neighboring blocks include at least one of a left neighboring block, an upper neighboring block, a lower left neighboring block, an upper right neighboring block, and an upper left neighboring block.

67. before determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, determining whether a candidate prediction mode list of the j prediction mode includes a prediction mode of a neighboring block; determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block, 47. The method according to claim 42 or 46, further comprising: determining a candidate prediction mode list for the j prediction mode based on the i candidate weight derivation mode and attribute information of the current block when it is determined that the prediction mode of the neighboring block is included in the candidate prediction mode list for the j prediction mode.

68. The step of determining whether the candidate prediction mode list of the j prediction mode includes a prediction mode of a neighboring block includes:

68. The method of claim 67, further comprising: determining that the prediction mode of the neighboring block is included in the candidate prediction mode list of the j prediction mode if the length of the candidate prediction mode list does not reach a predetermined length after adding, to the candidate prediction mode list, each prediction mode that is located before the prediction mode of the neighboring block in the predetermined order according to a predetermined order.

69. 69. The method of claim 68, wherein the preset order includes a prediction mode whose prediction angle is parallel to a dividing line of the i-th candidate weight derivation mode, a candidate prediction mode derived based on a template of the current block, a candidate prediction mode derived based on reconstructed pixels around the current block, a prediction mode of the neighboring block, a prediction mode whose prediction angle is perpendicular to a dividing line of the i-th candidate weight derivation mode, and a preset mode.

70. 70. The method of claim 69, wherein the preset modes include a PLANAR mode.

71. 69. The method of claim 68, further comprising writing first information into a codestream to indicate whether the candidate prediction mode list includes a prediction mode of a neighboring block.

72. determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, determining a candidate combination list based on the N candidate weight derivation modes and the at least one candidate prediction mode, the candidate combination list including at least one candidate combination, the candidate combination including one weight derivation mode and K prediction modes; and determining a first combination including the first weight derivation mode and the K first prediction modes from the candidate combination list.

73. The step of determining a candidate combination list based on the N candidate weight derivation modes and the at least one candidate prediction mode includes: obtaining T second combinations based on the N candidate weight derivation modes and the at least one candidate prediction mode, wherein any one of the T second combinations includes one weight derivation mode and K prediction modes, and the weight derivation mode and the K prediction modes included in any two of the T second combinations are not exactly the same, where T is a positive integer greater than 1; and obtaining the list of candidate combinations based on the T second combinations.

74. The step of obtaining the candidate combination list based on the T second combinations includes: determining a cost corresponding to any one of the T second combinations when predicting a template of the current block using a weight derivation mode in the second combination and K prediction modes; and determining the list of candidate combinations based on a cost corresponding to each second combination among the T second combinations.

75. 73. The method of claim 72, further comprising writing a first index into the codestream to indicate the first combination.

76. 47. The method according to any one of claims 39 to 46, wherein the height of the top template of the current block is 1 and / or the width of the left template of the current block is 1.

77. 47. The method according to claim 39, wherein the attribute information of the current block includes size information of the current block.

78. A video decoding device, a weight derivation mode determination unit used to determine N candidate weight derivation modes, where N is a positive integer; a prediction list determination unit used to determine at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block, wherein the candidate prediction mode list includes at least one candidate prediction mode; a processing unit used for determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; a prediction unit used to predict a current block based on the first weight derivation mode and K first prediction modes to obtain a predicted value of the current block.

79. 1. A video encoding device, comprising: a weight derivation mode determination unit used to determine N candidate weight derivation modes, where N is a positive integer; a prediction list determination unit used to determine at least one candidate prediction mode based on the N candidate weight derivation modes and attribute information of a current block, wherein the candidate prediction mode list includes at least one candidate prediction mode; a processing unit used for determining a first weight derivation mode and K first prediction modes corresponding to the current block based on the N candidate weight derivation modes and the at least one candidate prediction mode, where K is a positive integer greater than 1; a prediction unit used to predict a current block based on the first weight derivation mode and K first prediction modes and to obtain a predicted value of the current block.

80. a processor and a memory, the memory is used to store a computer program; An electronic device characterized in that the processor calls and executes a computer program stored in the memory to realize the method of any one of claims 1 to 38 or claims 39 to 77.

81. a video encoder and a video decoder, The video decoder is used to implement a method according to any one of claims 1 to 38, Video codec system, characterized in that the video encoder is used to implement the method according to any one of claims 39 to 77.

82. A computer-readable storage medium used to store a computer program, A computer-readable storage medium, the computer program causing a computer to execute the method according to any one of claims 1 to 38 or claims 39 to 77.