Video encoding / decoding method, device, equipment, system, and storage medium
The video encoding/decoding method addresses high coding costs by indicating a combination of weight derivation and prediction modes, enhancing efficiency through simplified syntax and reduced codeword usage.
Patent Information
- Application Number
- JP2024560819
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-04-12
- Filing Date
- 2022-06-09
- Publication Date
- 2026-02-19
- Estimated Expiration
- 2042-06-09
AI Technical Summary
Current video encoding methods require increased coding costs due to the need to transmit more information when predicting a current block using multiple prediction modes.
A video encoding/decoding method that indicates a first combination of a weight derivation mode and K first prediction modes through a first index, allowing for efficient prediction of a current block without the need for explicit judgment of various cases, thereby simplifying syntax and reducing codeword usage.
This approach improves coding efficiency by reducing encoding costs and simplifying syntax through the use of a combined weight derivation mode and prediction modes, indicated by a first index.
Smart Images

Figure 0007818102000124 
Figure 0007818102000125 
Figure 0007818102000126
Abstract
Description
[Technical Field]
[0001] The present application relates to the technical field of video encoding and decoding, and in particular to a video encoding and decoding method, apparatus, device, system, and storage medium. [Background technology]
[0002] Digital video technology can be incorporated into various video devices, such as digital televisions, smartphones, computers, e-readers, or video players. With the development of video technology, the amount of data contained in video data is large. In order to facilitate the transmission of video data, video devices implement video compression techniques to transmit or store video data more efficiently.
[0003] Since video has temporal or spatial redundancy, prediction can eliminate or reduce the video redundancy and improve compression efficiency. Currently, in order to improve prediction efficiency, a current block can be predicted using multiple prediction modes. However, when predicting a current block using multiple prediction modes, more information needs to be transmitted in the codestream, which increases coding costs. Summary of the Invention [Means for solving the problem]
[0004] In the embodiments of the present application, a video encoding / decoding method, device, apparatus, system, and storage medium are provided that can reduce encoding costs.
[0005] In a first aspect, the present application provides a video decoding method, the video decoding method being applied to a decoder,
[0006] decoding the codestream to obtain a first index, the first index being used to indicate a first combination, the first combination including one first weight derivation mode and K first prediction modes, where K is a positive integer greater than 1;
[0007] determining a first weight derivation mode and K first prediction modes included in the first combination based on the first index;
[0008] predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block.
[0009] In a second aspect, an embodiment of the present application provides a video encoding method, the video encoding method comprising:
[0010] determining a first combination, the first combination including a first weight derivation mode and K first prediction modes;
[0011] predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block;
[0012] and obtaining a codestream based on the predicted value of the current block, the codestream including a first index, the first index being used to indicate a first combination.
[0013] In a third aspect, the present application provides a video decoding device, which is used to perform the method in the first aspect or each embodiment thereof, specifically, the device includes functional units for performing the method in the first aspect or each embodiment thereof.
[0014] In a fourth aspect, the present application provides a video encoding device, which is used to perform the method in the second aspect or each embodiment thereof, specifically, the device includes functional units for performing the method in the second aspect or each embodiment thereof.
[0015] In a fifth aspect, a video decoder is provided, the video decoder comprising a processor and a memory, the memory being adapted to store a computer program, and the processor being adapted to call and execute the computer program stored in the memory, thereby performing the method of the first aspect or any of its embodiments.
[0016] A sixth aspect provides a video encoder, the 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, and to perform the method of the second aspect or any of its embodiments.
[0017] A seventh aspect provides a video encoding / decoding system, the video encoding / decoding system including a video encoder and a video decoder, the video decoder being used to perform the method of the first aspect or any of its embodiments, and the video encoder being used to perform the method of the second aspect or any of its embodiments.
[0018] An eighth aspect provides a chip for implementing the method according to any one of the first to second aspects or their respective embodiments. Specifically, the chip includes a processor that calls up and executes a computer program from a memory, thereby causing a device in which the chip is installed to implement the method according to any one of the first to second aspects or their respective embodiments.
[0019] A ninth aspect provides a computer-readable storage medium, which is used to store a computer program, and the computer program causes a computer to execute the method in the first to second aspects or each embodiment thereof.
[0020] In a tenth aspect, a computer program product is provided, the computer program product including computer program instructions for causing a computer to perform the method according to any one of the first to second aspects or each embodiment thereof.
[0021] An eleventh aspect provides a computer program, which, when executed on a computer, causes the computer to perform the method according to any one of the first and second aspects or the respective embodiments thereof.
[0022] A twelfth aspect provides a codestream, the codestream being generated according to the method of the second aspect. Optionally, the codestream includes a first index, the first index being used to indicate a first combination of one weight derivation mode and K prediction modes, where K is a positive integer greater than 1.
[0023] Based on the above technical solution, the present application indicates a weight derivation mode and K prediction modes as one combination, and indicates the weight derivation mode and K prediction modes to be used for the current block in this manner. At this time, the decoding side obtains a first index by decoding the code stream, and the first index is used to indicate a first combination consisting of one weight derivation mode and K prediction modes. Based on the first index, the decoding side determines the first weight derivation mode and K first prediction modes included in the first combination, and predicts the current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. In the present application, by indicating the first weight derivation mode and K first prediction modes corresponding to the current block in the form of a combination, the syntax is simplified, codewords are saved, and judgment of various cases is not required, thereby further improving coding efficiency. [Brief explanation of the drawings]
[0024] [Figure 1]1 is a block diagram showing a video encoding / decoding system according to an embodiment of the present application. [Figure 2] 1 is a block diagram illustrating a video encoder according to an embodiment of the present application; [Figure 3] FIG. 2 is a block diagram illustrating 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 weighted prediction. [Figure 14]FIG. 1 is a schematic diagram of template matching. [Figure 15] 1 is a schematic flowchart of a video decoding method according to an embodiment of the present application; [Figure 16A] FIG. 1 is a schematic diagram of weight assignment. [Figure 16B] FIG. 10 is a schematic diagram of another weight assignment. [Figure 17] FIG. 10 is a schematic diagram of deriving template weights; [Figure 18] FIG. 1 is a schematic diagram of a template. [Figure 19] 1 is a schematic flowchart of a video encoding method according to an embodiment of the present application; [Figure 20] 1 is a block diagram illustrating a video decoding device according to an embodiment of the present application. [Figure 21] 1 is a block diagram illustrating a video encoding device according to an embodiment of the present application. [Figure 22] 1 is a block diagram illustrating an electronic device according to an embodiment of the present application. [Figure 23] 1 is a block diagram showing a video encoding / decoding system according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0025] The present application can be applied to fields such as image encoding / decoding, video encoding / decoding, hardware video encoding / decoding, dedicated circuit video encoding / decoding, real-time video encoding / decoding, etc. For example, the solution 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 present solution may 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 Coding and Decoding (SVC) and Multiview Video Coding and Decoding (MVC) extensions. It should be understood that the present technology is not limited to any particular coding and decoding standard or technology.
[0026] For ease of understanding, a video encoding / decoding system according to an embodiment of the present application will be described with reference to FIG.
[0027] FIG. 1 is a block diagram illustrating a video encoding / decoding system according to an embodiment of the present application. Note that FIG. 1 is merely an example, and video encoding / decoding systems according to embodiments of the present application include, but are not limited to, those illustrated in FIG. 1. As illustrated in FIG. 1, the video encoding / decoding system 100 includes an encoding device 110 and a decoding device 120. Here, the encoding device is used to encode (which may also be understood as compression) video data to generate a codestream and transmit the codestream to a decoding device. The decoding device decodes the codestream generated by the encoding device to obtain decoded video data.
[0028] In the present embodiment, the encoding device 110 is understood as a device having a video encoding function, and the decoding device 120 is understood as a device having a video decoding function. That is, in the present embodiment, the encoding device 110 and the decoding device 120 include a broader 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, and in-vehicle computers.
[0029] 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.
[0030] In one example, channel 130 includes one or more communication media over which encoding device 110 can transmit encoded video data directly to decoding device 120 in real time. In this example, encoding device 110 may modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding device 120. The communication media may include wireless communication media, such as a radio frequency spectrum; alternatively, the communication media may also include wired communication media, such as one or more physical transmission lines.
[0031] In another example, channel 130 includes a storage medium capable of storing video data encoded by encoding device 110. Storage media include various locally accessible data storage media, such as optical disks, DVDs, flash memory, etc. In this example, decoding device 120 may obtain the encoded video data from the storage medium.
[0032] 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 as a web server (e.g., for a website), a file transfer protocol (FTP) server, or the like.
[0033] In some embodiments, encoding device 110 includes a video encoder 112 and an output interface 113. Output interface 113 may include a modulator / demodulator (modem) and / or a transmitter.
[0034] In some embodiments, encoding device 110 may include a video source 111 in addition to a video encoder 112 and an output interface 113 .
[0035] The video source 111 may include at least one of a video acquisition 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 video data.
[0036] 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 a picture or sequence of pictures in the form of a bitstream. The coding information may include coded image data and associated data. The associated data may include a sequence parameter set (SPS), a picture parameter set (PPS), 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 refers to a set of zero or more syntax elements arranged in a specified order within the codestream.
[0037] Video encoder 112 transmits the encoded video data directly to decoding device 120 via output interface 113. The encoded video data may be stored on a storage medium or storage server for subsequent retrieval by decoding device 120.
[0038] In some embodiments, decoding device 120 includes an input interface 121 and a video decoder 122 .
[0039] In some embodiments, decoding device 120 may include a display device 123 in addition to input interface 121 and video decoder 122 .
[0040] The input interface 121 may include a receiver and / or a modem and may receive encoded video data via a channel 130.
[0041] The video decoder 122 is used to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to a display device 123 .
[0042] Display device 123 displays the decoded video data and may be integrated with decoding device 120 or may be external to decoding device 120. Display device 123 may include a variety of 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.
[0043] 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 may also be applied to one-sided video encoding or one-sided video decoding.
[0044] A video coding framework according to an embodiment of the present application will now be described.
[0045] 2 is a block diagram illustrating a video encoder according to one embodiment of the present application. It should be understood that the video encoder 200 may be used to perform lossy compression on images or lossless compression on images. The lossless compression may be visually lossless compression or mathematically lossless compression.
[0046] The video encoder 200 may be applied 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. Y represents luminance (Luma), Cb (U) represents blue chrominance, and Cr (V) represents red chrominance. U and V are referred to as chroma and are used to describe color and saturation. For example, in color format, 4:2:0 means that there are four luminance components and two chrominance components (YYYYCbCr) for every four pixels, and 4:2:2 means that there are four luminance components and four chrominance components (YYYYCbCrCbCr) for every four pixels. 4:4:4 means full pixel representation (YYYYCbCrCbCrCbCrCbCr).
[0047] For example, the video encoder 200 reads video data and, for each frame of image in the video data, divides the image into several coding tree units (CTUs). In some examples, a CTU may be referred to as a "tree block," a "largest coding unit" (LCU), or a "coding tree block" (CTB). Each CTU may be associated with a block of pixels of the same size in the image. Each pixel may correspond to one luminance (luma) sample and two chrominance (chroma) samples. Thus, each CTU may be associated with one luminance sample block and two chrominance sample blocks. The size of a CTU may be, for example, 128x128, 64x64, 32x32, etc. The CTU may be further divided into several coding units (CUs) for encoding. A CU may be a rectangular block or a square block. CUs can be further divided into prediction units (PUs) and transform units (TUs), thereby separating coding, prediction, and transformation, and thereby providing more flexibility in processing. In one example, CTUs are divided into CUs in a quadtree fashion, and CUs are divided into TUs and PUs in a quadtree fashion.
[0048] Video encoders and video decoders can support various PU sizes. Assuming that a particular 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 intra prediction. The video encoder and video decoder can also support asymmetric PUs of 2NxnU, 2NxnD, nLx2N, and nRx2N for inter prediction.
[0049] 2, the video encoder 200 includes 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 cull unit 260, a decoded image buffer 270, and an entropy coding unit 280. Note that the video encoder 200 may include more, fewer, or different functional components.
[0050] Alternatively, in this application, the current block may be referred to as a current coding 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 reconstructed block or an image reconstructed image block.
[0051] 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 in one intra of a video, the video encoding and decoding technique uses an intra prediction method to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent inters in a video, the video encoding and decoding technique uses an inter prediction method to eliminate temporal redundancy between adjacent inters and improve coding efficiency.
[0052] The inter prediction unit 211 is used for inter prediction, which includes motion estimation and motion compensation. It references image information from different frames and uses motion information to find a reference block from a reference frame and generate a predicted block based on the reference block to eliminate temporal redundancy. The frames used for inter prediction are 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 list of reference frames in which the reference frame exists, a reference frame index, and a motion vector. The motion vector can be for a whole pixel or a pixel-partitioned vector. If the motion vector is for a pixel-partitioned vector, interpolation is required to generate the required pixel-partitioned block. Here, the whole pixel or pixel-partitioned block in the reference frame found based on the motion vector is called the reference block. Some techniques use the reference block as a direct prediction block, while others use reprocessing based on the reference block to generate a predicted block. Generating a predicted block by reprocessing based on a reference block can also be understood as using the reference block as a predicted block and processing based on the predicted block to generate a new predicted block.
[0053] The intra prediction unit 212 eliminates spatial redundancy by predicting pixel information within the current coded image block with reference to only information of the same frame image. The frame used in intra prediction may be an I frame.
[0054] There are multiple prediction modes for intra prediction. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard has eight angular prediction modes and one non-angular prediction mode, while H.265 / HEVC expands this to 33 angular prediction modes and two non-angular prediction modes. HEVC uses intra prediction modes including planar mode, DC, and 33 angular modes, for a total of 35 prediction modes. VVC uses intra modes including planar mode, DC, and 65 angular modes, for a total of 67 prediction modes.
[0055] Furthermore, as the number of angle modes increases, intra prediction becomes more accurate, meeting the needs of the development of high-definition and ultra-high-definition digital video.
[0056] Residual unit 220 may generate a residual block for 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 generates a residual block for a 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.
[0057] 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.
[0058] 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.
[0059] Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to generate a reconstructed image block associated with the TU. In this manner, by reconstructing sample blocks for each TU of a CU, video encoder 200 may reconstruct blocks of pixels of the CU.
[0060] The loop culling unit 260 is used to process the inverse transformed and dequantized pixels to compensate for distortion information and provide a better reference for encoding subsequent pixels. For example, it may perform a deblocking culling operation to reduce blocking artifacts in pixel blocks associated with a CU.
[0061] In some embodiments, the loop culling unit 260 includes a deblocking culling unit and a sample adaptive compensation / adaptive loop culling (SAO / ALF) unit, where the deblocking culling unit is used to remove blocking artifacts and the SAO / ALF unit is used to remove blocking artifacts.
[0062] The decoded image buffer 270 may store the reconstructed pixelblock. The inter prediction unit 211 may perform inter prediction on PUs of other images using a reference image including the reconstructed pixelblock. Furthermore, the intra prediction unit 212 may perform intra prediction on other PUs in the same image as the CU using the reconstructed pixelblock in the decoded image buffer 270.
[0063] Entropy coding unit 280 may receive the quantized transform coefficients from transform / quantization unit 230. Entropy coding unit 280 may perform one or more entropy coding operations on the quantized transform coefficients to generate entropy-coded data.
[0064] FIG. 3 is a block diagram illustrating a video decoder according to an embodiment of the present invention.
[0065] 3, the video decoder 300 includes an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transform unit 330, a reconstruction unit 340, a loop culling unit 350, and a decoded image buffer 360. Note that the video decoder 300 may include more, fewer, or different functional components.
[0066] 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 analyze entropy-encoded syntax elements in the codestream. The prediction unit 320, the inverse quantization / transform unit 330, the reconstruction unit 340, and the loop cull unit 350 may decode video data based on the syntax elements extracted from the codestream, i.e., generate decoded video data.
[0067] In some embodiments, the prediction unit 320 includes an intra prediction unit 322 and an inter prediction unit 321 .
[0068] The intra prediction unit 322 may generate a predictive block of the PU by performing intra prediction. The intra prediction unit 322 may generate a predictive block of the PU based on pixel blocks of spatially neighboring PUs using an intra prediction mode. The intra prediction unit 322 may further determine the intra prediction mode of the PU based on one or more syntax elements parsed from the codestream.
[0069] 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 coding, 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 of the PU.
[0070] The inverse quantization / transform unit 330 may inverse quantize (i.e., dequantize) the transform coefficients associated with the TU. The inverse quantization / transform unit 330 may use a QP value associated with the CU of the TU to determine the degree of quantization.
[0071] 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.
[0072] The reconstruction unit 340 reconstructs a pixel block of the CU using a residual block associated with a TU of the CU and a prediction block of a PU of the CU. For example, the reconstruction unit 340 may add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
[0073] Loop culling unit 350 may perform a deblocking culling operation to reduce blocking artifacts in blocks of pixels associated with a CU.
[0074] The video decoder 300 may store the reconstructed image of the CU in the decoded image buffer 360. The video decoder 300 may perform subsequent prediction using the reconstructed image in the decoded image buffer 360 as a reference image, or may transmit the reconstructed image to a display device for display.
[0075] The basic process of video encoding and decoding is as follows: At the encoding side, an image of one frame is divided into blocks, and for a current block, the prediction unit 210 generates a predicted block of the current block using intra prediction or inter prediction. The residual unit 220 may calculate a residual block, i.e., a difference between the predicted block and the original block of the current block, based on the predicted block and the original block of the current block. The residual block is also called residual information. The residual block undergoes processes such as transformation and quantization by the transform / quantization unit 230 to remove information insensitive to the human eye and eliminate visual redundancy. Alternatively, the residual block before transformation and quantization by the transform / quantization unit 230 is called a time-domain residual block, and the time-domain residual block after transformation and quantization by the transform / quantization unit 230 is called a frequency residual block or frequency-domain residual block. The entropy coding unit 280 receives the quantized variable coefficients output from the variable quantization unit 230, entropy codes the quantized variable coefficients, and outputs a codestream. For example, entropy coding unit 280 may eliminate character redundancies based on a target context model and probability information in the binary code stream.
[0076] On the decoding side, the entropy decoding unit 310 may analyze 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 perform inverse quantization and inverse transformation on 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 culling unit 350 performs loop culling on the reconstructed image based on an image or block to obtain a decoded image. Obtaining a decoded image on the encoding side requires similar operations to those on the decoding side. The decoded image is also called a reconstructed image, and the reconstructed image can be used as a reference frame for inter-prediction of a subsequent frame.
[0077] The block division information determined by the encoding side, and mode or parameter information such as prediction, transform, quantization, entropy coding, and loop selection are included in the code stream as needed. The decoding side analyzes the code stream and determines the same block division information, mode or parameter information such as prediction, transform, quantization, entropy coding, and loop selection as the encoding side by analyzing the code stream based on existing information, thereby ensuring that the decoded image obtained by the encoding side is the same as the decoded image obtained by the decoding side.
[0078] The above is the basic process of video codec in a block-based hybrid coding framework. As technology develops, some modules or steps of the framework or process may be optimized. This application applies to the basic flow of video codec in a block-based hybrid coding framework, but is not limited to this framework and flow.
[0079] In some embodiments, the current block may be a current coding unit (CU) or a current prediction unit (PU). Since parallel processing is required, an image may be divided into slices. Slices within the same image may be processed in parallel. That is, there is no data dependency between slices. "Frame" is a commonly used term, and one frame is generally understood to be one image. Frames described in this application may be replaced with images, slices, etc.
[0080] The Versatile Video Coding (VVC) video encoding / decoding standard currently under development includes an inter-prediction mode called Geometric Partitioning Mode (GPM). The Audio Video Coding Standard (AVS) video encoding / decoding standard currently under development includes an inter-prediction mode called Angular Weighted Prediction (AWP). Although these two modes have different names and implementations, they share a common principle.
[0081] While traditional unidirectional prediction detects only one reference block of the same size as the current block, 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., the average value of all points in each reference block accounts for 50%. Bidirectional weighted prediction allows the two reference blocks to have different percentages. 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 must account for the same percentage. Other optimization methods, such as decoder-side motion vector refinement (DMVR) and bidirectional optical flow (BIO), may result in some changes to the reference pixels and predicted pixels, but are unrelated to the above principles. BIO may also be abbreviated as BDOF. GPM or AWP also uses two reference blocks of the same size as the current block, but some pixel positions use the pixel values of the corresponding positions of the first reference block 100%, some pixel positions use the pixel values of the corresponding positions of the second reference block 100%, and in the boundary or blending region, pixel values of the corresponding positions of the two reference blocks are used at a constant rate. The weights of the boundary region also change gradually. How these weights are assigned depends on the mode of GPM or AWP. The weight of each pixel position is determined based on the mode of GPM or AWP. Of course, in GPM or AWP modes, such as when the block size is small, it is not guaranteed that some pixel positions use the pixel values of the corresponding positions of the first reference block 100%, and some pixel positions use the pixel values of the corresponding positions of the second reference block 100%. It is also possible to consider that GPM or AWP uses two reference blocks different in size from the current block, i.e., the necessary portions of each, as reference blocks. That is, the portions with a weight other than 0 are used as reference blocks, and the portions with a weight of 0 are deleted. This is an implementation issue and is not the focus of the discussion of this invention.
[0082] For example, FIG. 4 is a schematic diagram of weight allocation. As shown in FIG. 4, a schematic diagram of weight allocation for multiple partition modes of a GPM on a 64x64 current block provided by an embodiment of the present application is shown. The GPM has 64 partition modes. FIG. 5 is a schematic diagram of weight allocation. As shown in FIG. 5, a schematic diagram of weight allocation for multiple partition modes of an AWP on a 64x64 current block provided by an embodiment of the present application is shown. The AWP has 56 partition modes. In both FIG. 4 and FIG. 5, for each partition mode, a black area indicates a weight value of 0% for the corresponding position of the first reference block, and a white area indicates a weight value of 100% for the corresponding position of the first reference block. The gray area indicates a weight value greater than 0% and less than 100% depending on the shade of color, and indicates that the weight value for the corresponding position of the second reference block is 100% minus the weight value for the corresponding position of the first reference block.
[0083] GPM and AWP derive their weights differently. GPM determines the angle and offset for each mode and calculates the weight matrix for each mode. AWP first creates a one-dimensional weight line and then spreads it across the matrix using a method similar to intra-angle prediction.
[0084] It is understood that in early encoding and decoding technologies, only rectangular partitioning methods existed, whether for CU, PU, or transform unit (TU) partitioning. Both GPM and AWP achieve the predicted non-rectangular partitioning effect without partitioning. GPM and AWP use a weight mask of two reference blocks, i.e., the aforementioned weight map. This mask determines the weights of the two reference blocks when generating a predicted block. It is easy to understand that part of the predicted block's position comes from the first reference block, part of the predicted block's position comes from the second reference block, and the blending area is weighted by the corresponding positions of the two reference blocks, resulting in smoother blending. Because GPM and AWP do not partition the current block into two CUs or PUs according to a partition line, the transform, quantization, inverse transform, and inverse quantization of the predicted residual are also performed on the entire current block.
[0085] GPM uses a weight matrix to simulate the segmentation of geometric shapes, or more precisely, the predicted segmentation. To run GPM, two predictors are required in addition to the weight matrix. Each predictor is determined by one unidirectional motion information. These two unidirectional motion information are obtained from a motion information candidate list, e.g., the merge motion information candidate list (mergeCandList). GPM uses two indices in the codestream to determine the two unidirectional motion information from mergeCandList.
[0086] Inter-prediction uses motion information to indicate "motion." Basic motion information includes reference frame (or reference picture) information and motion vector (MV) information. Commonly used bidirectional prediction uses two reference blocks to predict a current block. The two reference blocks may be a forward reference block and a backward reference block. Alternatively, two may be forward or backward. Forward refers to the time corresponding to the reference frame occurring before the current frame, while backward refers to the time corresponding to the reference frame occurring after the current frame. In other words, the picture order count (POC) of the forward reference frame is smaller than the POC of the current frame, and the POC of the backward reference frame is larger than the POC of the current frame. Naturally, bidirectional prediction requires two reference blocks, which requires two groups of reference frame information and motion vector information. Each of these groups is understood as unidirectional motion information, and combining these two groups forms bidirectional motion information. In a specific implementation, the unidirectional motion information and the bidirectional motion information may use the same data structure, but the reference frame information and motion vector information of two groups of the bidirectional motion information are both valid, and the reference frame information and motion vector information of one group of the unidirectional motion information are invalid.
[0087] 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, only RPL0 is used for P slices, and RPL0 and RPL1 are used for B slices. For one slice, each reference frame list contains several reference frames, 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. The above bidirectional motion information uses a reference frame index refIdxL0 corresponding to reference frame list 0, 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. Here, the reference frame index corresponding to reference frame list 0 and the reference frame index corresponding to reference frame list 1 are understood as the reference frame information described above. In some embodiments, two flag bits, designated as predFlagL0 and predFlagL1, are used to indicate whether the motion information corresponding to reference frame list 0 is to be used, and whether the motion information corresponding to reference frame list 1 is to be used. It should also be understood that predFlagL0 and predFlagL1 indicate whether the unidirectional motion information is "valid" or not. Although the data structure of the motion information is not explicitly stated, the motion information is represented using a reference frame index, a motion vector, and a "valid" or "not valid" flag bit corresponding to each reference frame list. In standard texts, the term "motion vector" is used, rather than the motion information. The reference frame index and the corresponding flag indicating whether to use the motion information may be considered to be ancillary to the motion vector. While the term "motion information" is used in this specification for convenience of explanation, it should be understood that the term "motion vector" may also be used.
[0088] The motion information used by the current block is saved. Subsequent coded / decoded blocks in the current frame may use motion information from previously coded / decoded blocks, such as neighboring blocks, based on their adjacent positional relationships. Because this utilizes spatial correlation, this coded / decoded motion information is called spatial-domain motion information. The motion information used by each block in the current frame is saved. Subsequent coded / decoded frames may use motion information from previously coded / decoded frames based on their reference relationships. Because this utilizes temporal correlation, this coded / decoded frame's motion information is called temporal-domain motion information. The motion information used by each block in the current frame is typically stored as a fixed-size matrix, such as a 4x4 matrix, with one group of motion information stored in each minimum unit. In this way, each time a block is coded / decoded, its motion information can be stored in the minimum unit corresponding to its position. In this way, when using spatial-domain motion information or temporal-domain motion information, the motion information corresponding to that position can be directly determined based on its position. For example, if a 16x16 block uses conventional unidirectional prediction, all 4x4 minimum units corresponding to this block store the motion information for this unidirectional prediction. If a block uses GPM or AWP, all minimum units corresponding to this block determine the motion information stored in each minimum unit based on the GPM or AWP mode, the first motion information, the second motion information, and the position of each minimum unit. In one method, if all 4x4 pixels corresponding to a minimum unit are derived from the first motion information, the minimum unit stores the first motion information. If all 4x4 pixels corresponding to a minimum unit are derived from the second motion information, the minimum unit stores the second motion information. If the 4x4 pixels corresponding to a minimum unit are derived from both the first motion information and the second motion information, the AWP selects and stores one of the motion information. For GPM, if the two motion information refer to different reference frame lists, they are combined and stored as bidirectional motion information; otherwise, only the second motion information is stored.
[0089] Alternatively, the mergeCandList may be configured based on air domain motion information, time domain motion information, historical motion information, and other motion information. For example, mergeCandList derives spatial domain motion information using positions 1 to 5 in FIG. 6A and temporal motion information using positions 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 encoded or decoded. The addition process may require several checks, such as checking for overlap with existing motion information. In this way, the motion information in the history-based list can be referenced when encoding and decoding the current block.
[0090] In some embodiments, a syntax description of the GPM is shown in Table 1.
[0091] [Table 1] [Table 1-2] [Table 1-3]
[0092] As shown in Table 1, in merge mode, if regulator_merge_flag is not 1, the current block may use CIIP or GPM. If the current block does not use CIIP, GPM is used. This is shown in Table 1 by the syntax "if(!ciip_flag[x0][y0])".
[0093] As can be seen from Table 1 above, 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. As explained above, this is the "simulation partition", and merge_gpm_partition_idx is the weight matrix derivation mode or weight matrix derivation mode index, or weight derivation mode or weight derivation mode index. 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 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. 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.
[0094] In some embodiments, the GPM decoding process includes the following steps.
[0095] The information input during the decoding process includes the luminance position (xCb, yCb) of the top left corner of the current block relative to the coordinates of 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, and luminance with 1 / 16 pixel accuracy, motion vectors mvA and mvB, chrominance motion vectors mvCA and mvCB, reference frame indices refIdxA and refIdxB, and prediction list flags predListFlagA and predListFlagB.
[0096] For example, motion information may be expressed by a combination of a motion vector, a reference frame index, and a prediction list flag. VVC supports two reference frame lists, and each reference frame list may 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. GPM in VVC uses two unidirectional predictions. In the above mvA and mvB, mvCA and mvCB, refIdxA and refIdxB, and predListFlagA and predListFlagB, A is understood to be the first prediction mode, and B is understood to be the 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, the motion vector, reference frame index, and prediction list flag are considered to combine to represent the motion information described herein.
[0097] The information output by the decoding process includes a luma prediction sample matrix predSamplesL of (cbWidth)X(cbHeight), and, if necessary, a Cb chrominance prediction sample matrix of (cbWidth / SubWidthC), and, if necessary, a Cr chrominance prediction sample matrix of (cbWidth / SubWidthC)X(cbHeight / SubHeightC).
[0098] For illustrative purposes, the following uses the luma component. The processing of the chroma component is similar to that of the luma component.
[0099] Assuming that the size of predSamplesLAL and predSamplesLBL is (cbWidth)X(cbHeight), this is a prediction sample matrix based on two prediction modes. predSamplesL is derived by a method of 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 the two prediction modes, and the detailed process will not be described further. Normally, GPM is a merge mode. It is considered that both of the two prediction modes of GPM are merge modes.
[0100] Based on merge_gpm_partition_idx[xCb][yCb], use Table 2 to determine the GPM partition angle index variable angleIdx and distance index variable distanceIdx.
[0101] [Table 2] [Table 2-2]
[0102] Note that because all three components (e.g., Y, Cb, and Cr) can use GPM, some standard textbooks separate the process of generating a GPM predicted sample matrix from the components into a subprocess, the GPM weighted sample prediction process for geometric partitioning mode. All three components call this process, but the calling parameters are different. Here, we will only use 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 from the GPM weighted prediction process. Here, nCbW is cbWidth, nCbH is cbHeight, and the inputs are the predicted sample matrices predSamplesLAL and predSamplesLBL for the two prediction modes, as well as angleIdx and distanceIdx.
[0103] In some embodiments, the weighted prediction derivation process of the GPM includes the following steps.
[0104] The inputs for this process include the width of the current block nCbW, the height of the current block nCbH, two (nCbW)X(nCbH) predicted sample matrices predSamplesLA and predSamplesLB, the GPM division angle index variable angleIdx, the GPM distance index variable distanceIdx, and the component index variable cIdx. Since luminance is used as an example in this example, cIdx above is set to 0, indicating the luminance component.
[0105] The output of this process includes the GPM predicted sample matrix pbSamples of (nCbW)X(nCbH).
[0106] Illustratively, the variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are derived as follows:
[0107]
number
number
number
[0108] The variables offsetX and offsetY are derived as follows:
[0109] When the value of ShiftHor is 0, it is shown in Equation 4.
number
[0110] When the value of ShiftHor is 1, it is shown in Equation 5.
number
[0111] The variables xL and yL are derived as follows:
[0112]
number
[0113] The distance matrix disLut is determined according to Table 3.
[0114] [Table 3]
number
number
[0115] Note that one weight value is derived for each position of the current block, and the predicted value pbSamples[x][y] of the GPM is calculated. Because of this method, the weight wValue does not need to be written in matrix form; however, storing the wValue for each position in a matrix makes it clear that it is a weight matrix. The predicted value of the GPM can be obtained by calculating and weighting each weight for each point, or by calculating and weighting all weights equally to obtain the predicted sample matrix of the GPM. The principle is the same. In this application, weight matrices are used in many explanations for the sake of easier understanding and more intuitive illustration. In practice, they may be described according to the weight of each position. For example, the weight matrix derivation mode can also be called the weight derivation mode.
[0116] In some embodiments, as shown in Figure 6B, the GPM decoding process can be described 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. The first prediction block is determined based on the first motion information, the second prediction block is determined based on the second motion information, the weight matrix is determined based on the weight matrix derivation mode, and the prediction block of the current block is determined based on the first prediction block, the second prediction block, and the weight matrix.
[0117] The intra prediction method predicts a current block using coded and decoded 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. The pixels in one row to the left and one column 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 be available, i.e., they may all have been coded and decoded. Some may not be available. For example, if the current block is the leftmost part of the entire frame, the reference pixels to the left of the current block may not be available. Or, when coding and decoding the current block, the lower left part of the current block has not yet been coded and decoded, so the lower left reference pixel is also not available. If reference pixels are not available, fill is performed using available reference pixels, specific values, or specific methods, or no fill is performed.
[0118] Figure 7B is a schematic diagram of intra prediction. As shown in Figure 7B, the multiple reference line (MRL) intra prediction method uses more reference pixels to improve coding and decoding efficiency. For example, four reference rows / columns are reference pixels for the current block.
[0119] Furthermore, intra prediction has multiple prediction modes. FIGS. 8A to 8I are schematic diagrams of intra prediction. As shown in FIGS. 8A to 8I, intra prediction for a 4x4 block in H.264 may mainly include nine modes. Here, mode 0 shown in FIG. 8A copies the pixel above the current block vertically as a predicted value to the current block. mode 1 shown in FIG. 8B copies the reference pixel to the left horizontally as a predicted value to the current block. mode 2 DC shown in FIG. 8C uses the average value of eight points A to D and I to L as the predicted value for all points. modes 3 to 8 shown in FIGS. 8D to 8I each copy the reference pixel at a certain angle to a corresponding position in the current block. Because a certain position in the current block cannot exactly correspond to the reference pixel, it may be necessary to use a weighted average value of the reference pixel or a subpixel of an interpolated reference pixel.
[0120] Furthermore, there are modes such as Plane and Planar, and with technological developments and block expansion, the number of angular prediction modes is increasing. FIG. 9 is a schematic diagram of intra prediction modes. As shown in FIG. 9, the intra prediction modes used by HEVC include Planar, DC, and 33 angular modes, for a total of 35 prediction modes. FIG. 10 is a schematic diagram of intra prediction modes. As shown in FIG. 10, the intra modes used by VVC include Planar, DC, and 65 angular modes, for a total of 67 prediction modes. FIG. 11 is a schematic diagram of intra prediction modes. As shown in FIG. 11, VS3 uses DC, Planar, Bilinear, PCM, and 62 angular modes, for a total of 66 prediction modes.
[0121] Additionally, there are techniques for improving prediction, such as improving subpixel interpolation of reference pixels and selecting predicted pixels. For example, the AVS3 multiple intraprediction filter (MIPF) generates predictions using different filters for different block sizes. For pixels at different positions within the same block, one filter is used to generate predictions for pixels close to the reference pixel, and another filter is used to generate predictions for pixels far from the reference pixel. Techniques for selecting predicted pixels, such as the AVS3 intraprediction filter (IPF), may also use reference pixels to filter the predicted values.
[0122] Intra prediction can improve encoding and decoding efficiency by using a Most Probable Modes List (MPM) intra-mode coding technique. The mode list is constructed using intra prediction modes derived based on the intra prediction modes of surrounding coded and decoded blocks, such as neighboring modes, and several commonly used or relatively highly probable intra prediction modes, such as DC, planar, and bilinear modes. Intra prediction modes that reference surrounding coded and decoded blocks exploit spatial correlation, since textures have a certain degree of spatial continuity. MPM may be used as a predictor for intra prediction modes. That is, the probability that the current block uses MPM is higher than the probability that MPM is not used. Therefore, fewer codewords are used for MPM during binarization, thereby saving overhead and improving encoding and decoding efficiency.
[0123] In some embodiments, intra prediction is performed using matrix-based intra prediction (MIP) (sometimes referred to as matrix-weighted 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. Matrix multiplication is the core of MIP. MIP can be thought of as a process of generating a predicted block from input pixels (reference pixels) using matrix multiplication. MIP provides various matrices. Differences in prediction methods are reflected in different matrices, and using different matrices for the same input pixels will produce different results. The reference pixel averaging and interpolation processes are a design compromise between performance and complexity. For large blocks, a similar effect to downsampling can be achieved by averaging reference pixels, allowing the input to fit into a smaller matrix, while interpolation achieves the upsampling effect. In this way, it is not necessary to provide MIP matrices for blocks of each size, but only matrices of one or more specific sizes. As compression performance demands increase and hardware capabilities improve, more complex MIPs may appear in future standards.
[0124] MIPs are somewhat similar to planar, but MIPs are obviously more complex and flexible than planar.
[0125] GPM uses a weight matrix to combine two inter-prediction blocks. In fact, it can be extended to combine any two prediction blocks, such as two inter-prediction blocks, two intra-prediction blocks, or one inter-prediction block and one intra-prediction block. In addition, IBC (intra block copy) or palette prediction blocks can be used as one or two prediction blocks in the coding of screen content.
[0126] 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 is understood as a prediction mode that a codec can generate a prediction block for a current block based on the prediction mode. 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, specific or some auxiliary information, such as an optimization method for intra reference pixels or an optimization method (such as selection) after generating a basic prediction block, may be superimposed. 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 unidirectional prediction, bidirectional prediction, or multi-hypothesis prediction is possible. When the 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, two pieces of motion information must be determined even in one prediction mode, and a prediction block can be determined based on the two pieces of motion information.
[0127] Thus, the information that the GPM needs to determine is described 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 prediction block or predicted value. The weight derivation mode is sometimes called a partitioning mode. However, since this is a simulated partitioning, this application refers to it as the weight derivation mode.
[0128] Optionally, the two prediction modes may come from the same or different prediction methods, including but not limited to intra prediction, inter prediction, IBC, and palette.
[0129] A specific example is when the current block uses GPM. This example is used for inter-coded blocks and enables the use of merge mode in intra prediction and inter prediction. As shown in Table 4, one syntax element, intra_mode_idx, is added to indicate which prediction mode is an intra prediction mode. For example, when intra_mode_idx is 0, it means that the two prediction modes are inter prediction modes, i.e., mode0IsInter is 1 and mode0IsInter is 1. When intra_mode_idx is 1, it means 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 means that the first prediction mode is inter prediction 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 means that the two prediction modes are intra prediction modes, mode0IsInter is 0, and mode0IsInter is 0.
[0130] [Table 4]
[0131] In some embodiments, as shown in Figure 13, the GPM decoding process can be described as analyzing a codestream, determining whether a 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), a first prediction mode, and a second prediction mode. The first prediction block is determined based on the first prediction mode, the second prediction block is determined based on the second prediction mode, the weight matrix is determined based on the weight matrix derivation mode, and the prediction of the current block is determined based on the first prediction block.
[0132] Template matching is the first method used in inter prediction. This method uses the correlation between neighboring pixels to use a region surrounding the current block as a template. When the current block is coded or decoded, its left and upper sides are coded or decoded in the same order. Of course, when using existing hardware decoders, it is not guaranteed that its left and upper sides have already been decoded when decoding of the current block begins. Of course, this refers to inter blocks. For example, HEVC inter-coded blocks do not require surrounding reconstructed pixels to generate predicted blocks, so the inter block prediction process can be performed in parallel. However, intra-coded blocks require reconstructed pixels on the left and upper sides as reference pixels. Theoretically, the left and upper sides are obtainable, and this can be achieved by making appropriate adjustments to the hardware design. Relatively speaking, the right and lower sides are not obtainable in the coding order of current standards such as VVC.
[0133] As shown in FIG. 14, rectangular regions to the left and top of the current block are set as templates. The height of a portion of the left template is approximately the same as the height of the current block, and the width of a portion of the upper template is usually the same as the width of the current block, but may differ. The best matching position of the template in the reference intra is found to determine the motion information or motion vector of the current block. This process can be roughly described as starting from a specific reference intra, starting position, and searching within a certain surrounding range. Search rules, such as the search range and search steps, may be preset. Each time a block is moved to a specific position, the matching degree between the template corresponding to that position and the templates surrounding the current block is calculated. The so-called matching degree can be measured using distortion costs such as SAD (sum of absolute difference) and SATD (sum of absolute transformed difference). Transforms used in SATD are generally Hadamard transform and MSE (mean-square error). The smaller the SAD, SATD, MSE, etc. values, the higher the 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 the entire pixel position, sub-pixel positions may be searched and the motion information of the current block may be determined based on the searched position with the best match. Using the correlation between adjacent pixels, motion information suitable for the template may also be suitable for the current block. Of course, the template matching method does not apply to all blocks, so several methods may be used to determine whether to use template matching for the current block, such as a control switch. One name for this template matching method is DMVD (decoder side motion vector derivation). Both the encoder and decoder may use a template to search 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; both the encoder and decoder perform searches according to the same rules to ensure consistency between encoding and decoding. Template matching can improve compression performance, but it requires a "search" at the decoder, which increases the decoder's complexity to a certain extent.
[0134] While the above describes a method for applying template matching intra-frame, it can also be used intraframe. For example, a template can be used to determine an intraframe prediction mode. For a current block, a certain range of regions above and to the left of the current block can be used as the template, such as the rectangular regions on the left and top as shown in the figure above. When encoding and decoding the current block, reconstructed pixels within the template are obtained. This process can be roughly described as determining a set of candidate intraframe prediction modes for the current block, where the candidate intraframe prediction modes constitute a subset of all available intraframe prediction modes. Of course, the candidate intraframe prediction modes can also be the complete set of all available intraframe prediction modes. This can also be determined based on a trade-off between performance and complexity. The set of candidate intraframe prediction modes can also be determined according to several rules, such as MPM or equal-interval selection. A cost is calculated for each candidate intraframe prediction mode on the template, such as SAD, SATD, or MSE. This mode is used to create a predicted block by predicting on the template, and the cost is calculated using the predicted block and the reconstructed block from the template. A low-cost mode may be more likely to match the template, and by utilizing the similarity between neighboring pixels, an intra-prediction mode that performs well on the template may also perform well on the current block. One or more low-cost modes are selected. Of course, the above two steps may be repeated. For example, after selecting one or more low-cost modes, a set of candidate intra-prediction modes may be determined again, costs may be recalculated for the newly determined set of candidate intra-prediction modes, and one or more low-cost modes may be selected. This may also be understood as coarse selection and fine selection. The one ultimately selected intra-prediction mode may be determined as the intra-prediction mode for the current block, or the multiple ultimately selected intra-prediction modes may be determined as candidate intra-prediction modes for the current block.Of course, the candidate intra-prediction mode set may be sorted solely by template matching, or, for example, by sorting the MPM list, i.e., for each mode in the MPM list, a prediction block is created on a template, a cost is determined, and the modes are sorted in ascending order according to cost. In a typical MPM list, the higher the mode, the smaller the overhead in the codestream, which can improve compression efficiency.
[0135] A template matching method may be used to determine the two prediction modes of the GPM. When the template matching method is used in the GPM, one control switch may be used to control whether the two prediction modes of the current block use template matching for the current block, or two control switches may be used to control whether each of the two prediction modes is used.
[0136] Another aspect is how to use template matching. For example, when a GPM such as a VVC GPM is used in merge mode, merge_gpm_idxX is used to determine motion information from mergeCandList, where capital X is 0 or 1. A possible method for optimizing the Xth motion information is to use a template matching method based on the motion information. That is, one piece of motion information is determined from mergeCandList based on merge_gpm_idxX, and when template matching is used for the motion information, optimization is performed based on the motion information using the template matching method. Another method is to determine the motion information by directly searching based on default motion information, rather than determining the motion information from mergeCandList using merge_gpm_idxX.
[0137] If the Xth prediction mode is an intra prediction mode and the Xth prediction mode of the current block uses a template matching method, the intra prediction mode may be determined using the template matching method without needing to indicate an index of the intra prediction mode in the codestream, or it is necessary to determine one candidate set or MPM list using the template matching method and indicate an index of the intra prediction mode in the codestream.
[0138] As can be seen from the above, a GPM has three elements: one weight matrix and two prediction modes. The advantage of a GPM is that it allows for more autonomous combinations through the weight matrix. On the other hand, because the GPM must determine more information, it incurs more overhead in the codestream. Take the VVC GPM as an example. The VVC GPM is used in merge mode. merge_gpm_partition_idx, merge_gpm_idx0, and merge_gpm_idx1 are used in the codestream to determine the weight matrix, first prediction mode, and second prediction mode, respectively. The weight matrix and the two prediction modes each have multiple options. For example, a VVC weight matrix has 64 options. merge_gpm_idx0 and merge_gpm_idx1 each allow up to six options in VVC. Of course, VVC specifies that merge_gpm_idx0 and merge_gpm_idx1 must not overlap. Such a GPM has a 65 x 6 x 5 option set. Also, optimizing two motion information (prediction modes) using MMVD may provide a variety of choices for each prediction mode, which is quite large.
[0139] Also, if GPM uses two intra prediction modes, each of which is different from VVC's 67 common intra prediction modes, there are 64 x 67 x 66 possible choices. Of course, to save overhead, each prediction mode could be restricted to using only a subset of all common intra prediction modes, but there are still many choices.
[0140] Currently, one weight derivation mode and two prediction modes of GPM must transmit the necessary information in the codestream according to their respective rules. For example, one weight derivation mode has its own one or more syntax elements, the first prediction mode has its own one or more syntax elements, and the second prediction mode has its own one or more syntax elements. Of course, depending on the standard, there may be restrictions such that the second prediction mode cannot be the same as the first prediction mode, or some optimization methods may be used simultaneously in the two prediction modes (this is understood to be used for the current block). However, the writing and analysis of the three syntax elements are relatively independent, that is, many codewords are required to indicate the weight derivation mode and prediction mode, resulting in large coding overhead.
[0141] To solve the above technical problem, the present application indicates the weight derivation mode and K prediction modes used by the current block in the codestream in a combined form, thereby saving codewords and improving coding efficiency. In an embodiment of the present application, a video decoding method is provided, the video decoding method comprising: decoding the codestream to obtain a first index, the first index being used to indicate a first combination, the first combination including one weight derivation mode and K prediction modes, where K is a positive integer greater than 1; determining a first weight derivation mode and K first prediction modes included in the first combination based on the first index; predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, determining the first weight derivation mode and the K first prediction modes included in the first combination based on the first index comprises: determining a first candidate combination list, the candidate combination list including a plurality of first candidate combinations, and any one of the plurality of first candidate combinations including one weight derivation mode and K prediction modes; and determining a weight derivation mode and K prediction modes included in a first candidate combination corresponding to the first index in the first candidate combination list as the first weight derivation mode and the K first prediction modes. In some embodiments, predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: determining a first blending parameter; predicting the current block based on the first blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, predicting the current block based on the first blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block includes: determining weights for the prediction values based on the first blending parameter and the first weight derivation mode; predicting the current block according to the K first prediction modes to obtain K predicted values; weighting the K predictors based on the weights of the predictors to obtain a predictor of the current block. In some embodiments, determining the first blending parameter comprises: decoding the codestream to obtain a second index, the second index being used to indicate the first blending parameter; and determining the first blending parameter based on the second index. In some embodiments, determining the first blending parameter based on the second index comprises: determining a candidate blending parameter list; determining the candidate blending parameter corresponding to the second index in the candidate blending parameter list as the first blending parameter. In some embodiments, determining the first blending parameter comprises: determining G preliminary blending parameters, where G is a positive integer; and determining the first blending parameter from the G preliminary blending parameters. In some embodiments, determining the first blending parameter from the G preliminary blending parameters comprises: For a gth preliminary blending parameter among the G preliminary blending parameters, determining a cost corresponding to the gth preliminary blending parameter, where g is a positive integer from 1 to G; determining the first blending parameter from the G preliminary blending parameters based on costs corresponding to the G preliminary blending parameters. In some embodiments, determining the cost corresponding to the gth preliminary blending parameter comprises: determining a weight of the template for the current block based on the first weight mode and the gth preliminary blending parameter; predicting the template based on the K first prediction modes to obtain K predicted values of the template; weighting the K predicted values of the template based on the weight of the template to obtain a predicted value of the template; and determining a cost corresponding to the gth preliminary blending parameter based on the predicted value of the template. In some embodiments, determining a weight of the template for the current block based on the first weight mode and the gth preliminary blending parameter comprises: determining a first weight corresponding to the template based on the first weight derivation mode and the template; adjusting the first weight using the gth preliminary blending parameter to obtain an adjusted first weight; and determining a weight for the template based on the adjusted first weight. In some embodiments, determining the first blending parameter from the G preliminary blending parameters based on costs corresponding to the G preliminary blending parameters comprises: The method includes determining the preliminary blending parameter having the smallest cost among the G preliminary blending parameters as the first blending parameter. In some embodiments, determining the G preliminary blending parameters comprises: determining image information of the current block; determining the G preliminary blending parameters from a plurality of preset preliminary blending parameters based on image information of the current block. In some embodiments, the image information includes image edge sharpness, and the step of determining the G preliminary blending parameters from a plurality of preset preliminary blending parameters based on the image information of the current block includes: determining at least one first preliminary blending parameter among the plurality of preset preliminary blending parameters as the G preliminary blending parameters when the image edge sharpness of the current block is less than a predetermined value; and determining at least one second preliminary blending parameter from among the plurality of preset preliminary blending parameters as the G preliminary blending parameters if the image edge sharpness of the current block is equal to or greater than the set value, wherein the second preliminary blending parameter is greater than the first preliminary blending parameter. In some embodiments, determining the G preliminary blending parameters comprises: The method includes determining the G preliminary blending parameters based on the size of the current block. In some embodiments, determining the first blending parameter comprises: The method includes determining the first blending parameter based on a size of the current block. In some embodiments, determining the first blending parameter based on the size of the current block comprises: If the size of the current block is smaller than a first set threshold, determining the first blending parameter as a first value; or If the size of the current block is equal to or greater than a first set threshold, determining the first blending parameter as a second value, where the second value is smaller than the first value. In some embodiments, determining the first blending parameter based on the size of the current block comprises: determining that the first blending parameter is within a first blending parameter value range if the size of the current block is smaller than a first set threshold; or If the size of the current block is equal to or greater than a first set threshold, determining that the first blending parameter is within a second blending parameter value range, wherein a minimum value of the second blending parameter value range is smaller than a minimum value of the first blending parameter value range. In some embodiments, the step of determining the first candidate combination list comprises: The method includes the step of constructing the first candidate combination list. In some embodiments, the step of constructing the first candidate combination list comprises: The method includes constructing the first candidate combination list based on a template of the current block. In some embodiments, the step of constructing the first candidate combination list based on the template of the current block includes: determining R second combinations, where any one of the R second combinations includes one weight derivation mode and K prediction modes, and the weight derivations and K prediction modes included in any two of the R second combinations are not identical, and R is a positive integer greater than 1; determining a template prediction value corresponding to any one of the R second combinations when predicting the template using a weight derivation mode in the second combination and K prediction modes; and constructing the candidate combination list based on a template prediction value corresponding to each second combination among the R second combinations. In some embodiments, the step of constructing the candidate combination list based on template prediction values corresponding to each second combination among the R second combinations includes: determining a cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination; and constructing the candidate combination list based on a cost corresponding to each of the R second combinations. In some embodiments, when the template prediction values corresponding to the second combination include template prediction values corresponding to K prediction modes in the second combination, determining a cost corresponding to the second combination based on the template prediction values corresponding to the second combination and the reconstruction values of the templates comprises: determining costs corresponding to the K prediction modes in the second combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the second combination; and determining a cost corresponding to the second combination based on the costs corresponding to the K prediction modes in the second combination. In some embodiments, determining the cost corresponding to the second combination based on the costs respectively corresponding to the K prediction modes in the second combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the second combination as the cost corresponding to the second combination. In some embodiments, determining the R second combinations comprises: determining P weight derivation modes and Q prediction modes, where P is a positive integer and Q is a positive integer equal to or greater than K; and configuring the R second combinations based on the P weight derivation modes and the Q prediction modes, wherein any one of the R second combinations includes one weight derivation mode from the P weight derivation modes and K prediction modes from the Q prediction modes. In some embodiments, determining the Q prediction modes comprises: determining at least one of a first candidate prediction mode list for the current block, a first preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the first candidate prediction mode list includes a plurality of first candidate prediction modes, and the first preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one first preliminary prediction mode; The method includes a step of determining the Q prediction modes based on at least one of the first candidate prediction mode list, a first preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, determining a first candidate prediction mode list corresponding to the current block comprises: The method includes determining the first candidate prediction mode list based on a prediction mode used by at least one block neighboring the current block. In some embodiments, the method further comprises determining a setting mode corresponding to the current block if the first candidate prediction mode list does not include a setting mode; adding the set mode to the first candidate prediction mode list. In some embodiments, determining a first candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the first candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining weights for the prediction values based on the first blending parameter and the first weight derivation mode comprises: determining a second weight corresponding to the current block based on the first weight derivation mode and the current block; adjusting the second weight using the first blending parameter to obtain an adjusted second weight; and weighting the predicted value based on the adjusted second weight. In some embodiments, the first combination further includes a second blending parameter, and the step of predicting the current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: The method includes predicting the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, determining a prediction value for the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes comprises: determining weights for the prediction values based on the first weight derivation mode and the second blending parameter; determining the K predicted values based on the K first prediction modes; weighting the K predictors based on the weights of the K predictors to obtain a predictor of the current block. In some embodiments, determining weights for the predictors based on the first weight derivation mode and the second blending parameter comprises: determining a fourth weight corresponding to the current block based on the first weight derivation mode and the current block; adjusting the fourth weight using the second blending parameter to obtain an adjusted fourth weight; and determining a weight for the predicted value based on the adjusted fourth weight. In some embodiments, determining the first weight derivation mode and the K first prediction modes included in the first combination based on the first index comprises: determining a second candidate combination list, the second candidate combination list including a plurality of second candidate combinations, and any one of the plurality of second candidate combinations including one weight derivation mode, K prediction modes, and one blending parameter; determining a weight derivation mode, K prediction modes, and blending parameters included in a second candidate combination corresponding to the first index in the second candidate combination list as the first weight derivation mode, the K prediction modes, and the second blending parameters. In some embodiments, the step of determining the second candidate combination list comprises: The step of constructing the second candidate combination list is included. In some embodiments, constructing the second candidate combination list comprises: and constructing the second candidate combination list based on a template of the current block. In some embodiments, the step of constructing the second candidate combination list based on the template of the current block includes: determining H third combinations, wherein any one of the H third combinations includes one weight derivation mode, K prediction modes, and one blending parameter, and the weight derivation modes, the K prediction modes, and the blending parameter included in any two of the H third combinations are not identical, and H is a positive integer greater than 2; determining a cost corresponding to any one of the H third combinations when predicting the template using the weight derivation mode, the K prediction modes, and a blending parameter; and configuring the second candidate combination list based on a cost corresponding to each of the H third combinations. In some embodiments, determining a cost corresponding to the third combination when predicting the template using the weight derivation mode, K prediction modes, and blending parameters in the third combination includes: determining weights for the templates based on weight derivation modes and blending parameters included in the third combination; predicting the template based on the K prediction modes in the third combination to obtain K predicted values of the template; weighting the K predicted values of the template according to the weight of the template to obtain a template predicted value corresponding to the third combination; and determining a cost corresponding to the third combination based on the template prediction value corresponding to the third combination and the reconstruction value of the template. In some embodiments, determining the weights of the templates based on the weight derivation mode and blending parameters included in the third combination comprises: determining a third weight corresponding to the template based on a weight derivation mode in the third combination and the template; adjusting the third weight using the blending parameters in the third combination to obtain the adjusted third weight; and determining a weight for the template based on the adjusted third weight. In some embodiments, determining a cost corresponding to the third combination when predicting the template using the weight derivation mode, K prediction modes, and blending parameters in the third combination includes: determining template prediction values corresponding to the K prediction modes of the third combination based on the weight derivation modes in the third combination and the blending parameters; determining costs corresponding to the K prediction modes in the third combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the third combination; and determining a cost corresponding to the third combination based on costs corresponding to the K prediction modes in the third combination. In some embodiments, determining the cost corresponding to the third combination based on the costs respectively corresponding to the K prediction modes in the third combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the third combination as the cost corresponding to the third combination. In some embodiments, the step of constructing the second candidate combination list based on a cost corresponding to each of the H third combinations includes: Sorting the H third combinations based on a cost corresponding to each third combination among the H third combinations; and determining the sorted H third combinations as the second candidate combination list. In some embodiments, the step of sorting the H third combinations based on a cost corresponding to each third combination among the H third combinations includes: The method includes a step of sorting the H third combinations in ascending order of cost. In some embodiments, the step of constructing the second candidate combination list based on a cost corresponding to each third combination among the H third combinations includes: selecting L third combinations from the H third combinations based on costs corresponding to the third combinations; and determining the list of the L third combinations as the second candidate combination list. In some embodiments, the L third combinations are the first L third combinations of the H third combinations that have the smallest costs. In some embodiments, determining the H third combinations includes: determining F weight derivation modes, J prediction modes, and W blending parameters, where F and W are positive integers, and Q is a positive integer equal to or greater than K; and configuring the H third combinations based on the F weight derivation modes, the J prediction modes, and the W blending parameters. In some embodiments, determining the J prediction modes comprises: determining at least one of a second candidate prediction mode list for the current block, a second preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the second candidate prediction mode list includes a plurality of second candidate prediction modes, and the second preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one second preliminary prediction mode; and determining the J prediction modes based on at least one of the second candidate prediction mode list, a second preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, the step of determining the second candidate prediction mode list comprises: The method includes determining a second candidate prediction mode list corresponding to the current block based on a prediction mode used by at least one block neighboring the current block. In some embodiments, the method further comprises determining a setting mode corresponding to the current block when the second candidate prediction mode list does not include a setting mode; adding the set mode to the second candidate prediction mode list. In some embodiments, determining a second candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the second candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining the F weight derivation modes comprises: The method includes a step of selecting the F weight derivation modes from Z preset weight derivation modes, where Z is a positive integer equal to or greater than F. In some embodiments, determining the W blending parameters comprises: The method includes determining the W blending parameters based on the size of the current block. In some embodiments, the step of configuring the H third combinations based on the F weight derivation modes, the J prediction modes, and the W blending parameters comprises: selecting E weight derivation modes from the F weight derivation modes, where E is a positive integer equal to or less than F; selecting V prediction modes from the J prediction modes, where V is a positive integer equal to or less than J; selecting O blending parameters from the W blending parameters, where O is a positive integer equal to or less than W; and configuring the H third combinations based on the E weight derivation modes, the V prediction modes, and the O blending parameters. In some embodiments, the step of selecting E weight derivation modes from the F weight derivation modes comprises: For an i-th weight derivation mode among the F weight derivation modes, determining weights on the template of K second prediction modes based on the i-th weight derivation mode and a third blending parameter, wherein the third blending parameter is any one blending parameter among the W blending gradients, and the K second prediction modes are any K prediction modes among the J prediction modes, where i is a positive value from 1 to F; If the weight on the template of any one of the K prediction modes is smaller than a first set value, deleting the i-th weight derivation mode from the F weight derivation modes to obtain the E weight derivation modes. In some embodiments, determining weights on the template of K second prediction modes based on the i-th weight derivation mode and a third blending parameter comprises: determining a fourth weight corresponding to the template based on the first weight derivation mode and the template; adjusting the fourth weight using the third blending parameter to obtain an adjusted fourth weight; determining weights on the template of the K second prediction modes based on the adjusted fourth weights. In some embodiments, the step of selecting O blending parameters from the W blending parameters includes: determining image information of the current block; determining the O blending parameters from the W blending parameters based on image information of the current block. In some embodiments, the image information includes image edge sharpness, and determining the O blending parameters from the W blending parameters based on the image information of the current block includes: If the image edge sharpness of the current block is less than a predetermined value, determining at least one first-type blending parameter among the W blending parameters as O blending parameters; If the image edge sharpness of the current block is equal to or greater than a set value, determining at least one second type blending parameter among the W blending parameters as the O blending parameters, wherein the second type blending parameter is greater than the first type blending parameter. In some embodiments, the step of selecting O blending parameters from the W blending parameters includes: The method includes selecting the O blending parameters from the W blending parameters based on a size of the current block. In some embodiments, selecting the O blending parameters from the W blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a second set threshold, a third or greater blending parameter among the W blending parameters is set as the O blending parameters; or If the size of the current block is equal to or greater than a second set threshold, a blending parameter that is equal to or less than a fourth value among the W blending parameters is set as the O blending parameters, and the fourth value is smaller than the third value. In some embodiments, selecting the O blending parameters from the W blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a second set threshold, determining the O blending parameters as one or more blending parameters within a value range of a third blending parameter among the W blending parameters; or If the size of the current block is equal to or greater than a second set threshold, determining the O blending parameters as one or more blending parameters within a value range of a fourth blending parameter among the W blending parameters, wherein the minimum value of the value range of the fourth blending parameter is smaller than the minimum value of the value range of the third blending parameter. In some embodiments, the first weight derivation mode includes a fourth blending parameter, and the step of predicting the current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: The method includes predicting the current block based on the fourth blending parameter and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, predicting the current block based on the fourth blending parameter and the K first prediction modes to obtain a predicted value of the current block includes: determining weights for the predicted values based on the fourth blending parameter; determining the K predicted values based on the K first prediction modes; weighting the K predictors based on the weights of the K predictors to obtain a predictor of the current block. In some embodiments, determining the first weight derivation mode and the K first prediction modes included in the first combination based on the first index comprises: determining a third candidate combination list, the third candidate combination list including a plurality of third candidate combinations, any one of the plurality of third candidate combinations including one weight derivation mode and K prediction modes, the one weight derivation mode including one blending parameter; determining a weight derivation mode and K prediction modes included in a third candidate combination corresponding to the first index in the third candidate combination list as the first weight derivation mode and the K first prediction modes. In some embodiments, the step of determining the third candidate combination list comprises: The method includes the step of constructing the third candidate combination list. In some embodiments, the step of constructing the third candidate combination list comprises: and constructing the third candidate combination list based on a template of the current block. In some embodiments, the step of constructing the third candidate combination list based on the template of the current block includes: determining A fourth combinations, wherein any one of the A fourth combinations includes one weight derivation mode and K prediction modes, the weight derivation mode includes one blending parameter, and the weight derivation mode and the K prediction modes included in any two of the A fourth combinations are not identical, and A is a positive integer greater than 1; determining a cost corresponding to any one of the A fourth combinations when predicting the template using a weight derivation mode in the fourth combination and K prediction modes; and constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations. In some embodiments, determining a cost corresponding to the fourth combination when predicting the template using the weight derivation mode in the fourth combination and the K prediction modes includes: determining template prediction values corresponding to the K prediction modes in the fourth combination based on the weight derivation modes in the fourth combination; determining costs corresponding to the K prediction modes in the fourth combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the fourth combination; and determining a cost corresponding to the fourth combination based on the costs corresponding to the K prediction modes in the fourth combination. In some embodiments, determining the cost corresponding to the fourth combination based on the costs respectively corresponding to the K prediction modes in the fourth combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the fourth combination as the cost corresponding to the fourth combination. In some embodiments, the step of constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations includes: sorting the A fourth combinations based on a cost corresponding to each fourth combination among the A fourth combinations; and determining the sorted A fourth combinations as the third candidate combination list. In some embodiments, the step of sorting the A fourth combinations based on a cost corresponding to each fourth combination among the A fourth combinations includes: The method includes a step of sorting the A fourth combinations in ascending order of cost. In some embodiments, the step of constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations includes: selecting B fourth combinations from the A fourth combinations based on costs corresponding to the fourth combinations; and determining the list of the B fourth combinations as the third candidate combination list. In some embodiments, the B fourth combinations are the first B fourth combinations among the A fourth combinations that have the smallest cost. In some embodiments, determining the A fourth combinations includes: determining C weight derivation modes and D prediction modes, where C is a positive integer and D is a positive integer equal to or greater than K; and configuring the A fourth combinations based on the C weight derivation modes and the D prediction modes. In some embodiments, determining the D prediction modes comprises: determining at least one of a third candidate prediction mode list for the current block, a third preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the third candidate prediction mode list includes a plurality of third candidate prediction modes, and the third preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one third preliminary prediction mode; and determining the D prediction modes based on at least one of the third candidate prediction mode list, a third preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, the step of determining the third candidate prediction mode list comprises: The method includes determining a third candidate prediction mode list corresponding to the current block based on a prediction mode used by at least one block neighboring the current block. In some embodiments, if the third candidate prediction mode list does not include a setting mode, determining a setting mode corresponding to the current block; adding the set mode to the third candidate prediction mode list. In some embodiments, determining a third candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the third candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining the C weight derivation modes comprises: determining X blending parameters, where X is a positive integer; determining the C weight derivation modes based on the X blending parameters. In some embodiments, determining the X blending parameters comprises: determining image information of the current block; and determining X blending parameters based on the image information of the current block. In some embodiments, the image information includes image edge sharpness, and determining X blending parameters based on the image information of the current block includes: If the image edge sharpness of the current block is less than a predetermined value, determining at least one third type blending parameter among Y preset blending parameters as the X blending parameters, where Y is a positive integer greater than X; or If the image edge sharpness of the current block is equal to or greater than the set value, determining at least one fourth type blending parameter among the Y blending parameters as the X blending parameters, wherein the fourth type blending parameter is greater than the third type blending parameter. In some embodiments, determining the X blending parameters comprises: The method includes determining the X blending parameters based on the size of the current block. In some embodiments, determining the X blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a third threshold, a blending parameter having a fifth value or more among at least one preset blending parameter is set as the X blending parameters; or If the size of the current block is equal to or greater than a third set threshold, a blending parameter of the at least one blending parameter that is equal to or less than a sixth value is set as the X blending parameters, and the sixth value is smaller than the fifth value. In some embodiments, determining the X blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a third set threshold, determining the X blending parameters as one or more blending parameters within a value range of a fifth blending parameter among at least one preset blending parameter; or If the size of the current block is equal to or greater than a third set threshold, determining the X blending parameters as one or more blending parameters within a value range of a sixth blending parameter among the at least one blending parameter, wherein the minimum value of the value range of the sixth blending parameter is smaller than the minimum value of the value range of the fifth blending parameter. In some embodiments, the method further comprises decoding the codestream to obtain at least one flag, the at least one flag being used to indicate whether to decode using a first combination; The step of decoding the codestream and obtaining a first index includes: If the at least one flag indicates decoding using the first combination, decoding the codestream and obtaining the first index. In some embodiments, the at least one flag includes at least one of a sequence-level flag, a picture-level flag, a slice-level flag, a unit-level flag, and a block-level flag. In some embodiments, if the at least one flag comprises a block-level flag, decoding the codestream to obtain the at least one flag comprises: If it is determined that the size of the current block satisfies the set condition, the method includes the step of decoding the codestream and determining the block level flag. In some embodiments, the step of decoding the codestream to obtain a first index comprises: If it is determined that the current block has not been decoded using a first technique, the method includes decoding the codestream and obtaining the first index. In some embodiments, determining the configuration mode corresponding to the current block comprises: determining an image type corresponding to the current block; determining a setting mode corresponding to the current block based on an image type corresponding to the current block; In some embodiments, the setting mode includes at least one of a DC, a horizontal mode, a vertical mode, and an angle mode. In some embodiments, determining the image type corresponding to the current block comprises: The method includes determining an image type corresponding to the current block based on an image type of a current image to which the current block belongs or an image type of a current slice to which the current block belongs. In an embodiment of the present application, a video encoding method is provided, the video encoding method comprising: determining a first combination, the first combination including a first weight derivation mode and K first prediction modes; predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block; and obtaining a codestream based on the predicted value of the current block, the codestream including a first index, the first index being used to indicate the first combination. In some embodiments, determining the first combination comprises: determining a first candidate combination list, the first candidate combination list including a plurality of first candidate combinations, and any one of the plurality of first candidate combinations including one weight derivation mode and K prediction modes; determining the first combination from the first candidate combination list. In some embodiments, predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: determining a first blending parameter; predicting the current block based on the first blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, predicting the current block based on the first blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block includes: determining weights for the prediction values based on the first blending parameter and the first weight derivation mode; predicting the current block according to the K first prediction modes to obtain K predicted values; weighting the K predictors based on the weights of the predictors to obtain a predictor of the current block. In some embodiments, determining the first blending parameter comprises: determining a candidate blending parameter list; determining one candidate blending parameter from the list of candidate blending parameters as the first blending parameter. In some embodiments, determining one candidate blending parameter from the list of candidate blending parameters as the first blending parameter comprises: For a candidate blending parameter in the candidate blending parameter list, determining a cost corresponding to the candidate blending parameter; selecting one candidate blending parameter from the list of candidate blending parameters as the first blending parameter based on a cost corresponding to each candidate blending parameter in the list of candidate blending parameters. In some embodiments, determining costs corresponding to the candidate blending parameters comprises: determining a weight of a template for the current block based on the candidate blending parameters and the first weight derivation mode; predicting the template based on the K first prediction modes to obtain K predicted values of the template; weighting the K predicted values of the template based on the weight of the template to obtain a predicted value of the template; determining a cost corresponding to the candidate blending parameter based on the predicted and reconstructed values of the template. In some embodiments, determining weights of the template for the current block based on the candidate blending parameters and the first weight derivation mode comprises: determining first template weights based on the first weight derivation mode; and adjusting weights of the first template using the candidate blending parameters to obtain weights of the template. In some embodiments, selecting one candidate blending parameter from the list of candidate blending parameters as the first blending parameter based on a cost corresponding to each candidate blending parameter in the list of candidate blending parameters comprises: The method includes determining a candidate blending parameter from the list of candidate blending parameters that has the smallest cost as the first blending parameter. In some embodiments, the method includes writing a second index into the codestream, the second index being used to indicate the first blending parameter. In some embodiments, determining the first blending parameter comprises: determining G preliminary blending parameters, where G is a positive integer; and determining the first blending parameter from the G preliminary blending parameters. In some embodiments, determining the first blending parameter from the G preliminary blending parameters comprises: For a gth preliminary blending parameter among the G preliminary blending parameters, determining a cost corresponding to the gth preliminary blending parameter, where g is a positive integer from 1 to G; determining the first blending parameter from the G preliminary blending parameters based on costs corresponding to the G preliminary blending parameters. In some embodiments, determining the cost corresponding to the gth preliminary blending parameter comprises: determining a weight of the template for the current block based on the first weight mode and the gth preliminary blending parameter; predicting the template based on the K first prediction modes to obtain K predicted values of the template; weighting the K predicted values of the template based on the weight of the template to obtain a predicted value of the template; and determining a cost corresponding to the gth preliminary blending parameter based on the predicted value of the template. In some embodiments, determining a weight of the template for the current block based on the first weight mode and the gth preliminary blending parameter comprises: determining a first weight corresponding to the template based on the first weight derivation mode and the template; adjusting the first weight using the gth preliminary blending parameter to obtain an adjusted first weight; and determining a weight for the template based on the adjusted first weight. In some embodiments, determining the first blending parameter from the G preliminary blending parameters based on costs corresponding to the G preliminary blending parameters comprises: The method includes determining the preliminary blending parameter having the smallest cost among the G preliminary blending parameters as the first blending parameter. In some embodiments, determining the G preliminary blending parameters comprises: determining image information of the current block; determining the G preliminary blending parameters from a plurality of preset preliminary blending parameters based on image information of the current block. In some embodiments, the image information includes image edge sharpness, and the step of determining the G preliminary blending parameters from a plurality of preset preliminary blending parameters based on the image information of the current block includes: determining at least one first preliminary blending parameter among the plurality of preset preliminary blending parameters as the G preliminary blending parameters when the image edge sharpness of the current block is less than a predetermined value; and determining at least one second preliminary blending parameter from the plurality of preset preliminary blending parameters as G preliminary blending parameters if the image edge sharpness of the current block is equal to or greater than a set value, wherein the second preliminary blending parameter is greater than the first preliminary blending parameter. In some embodiments, determining the G preliminary blending parameters comprises: The method includes determining G preliminary blending parameters based on the size of the current block. In some embodiments, determining the first blending parameter comprises: The method includes determining the first blending parameter based on a size of the current block. In some embodiments, determining the first blending parameter based on the size of the current block comprises: If the size of the current block is smaller than a first set threshold, determining the first blending parameter as a first value; or If the size of the current block is equal to or greater than a first set threshold, determining the first blending parameter as a second value, where the second value is smaller than the first value. In some embodiments, determining the first blending parameter based on the size of the current block comprises: determining that the first blending parameter is within a first blending parameter value range if the size of the current block is smaller than a first set threshold; or If the size of the current block is equal to or greater than a first set threshold, determining that the first blending parameter is within a second blending parameter value range, wherein a minimum value of the second blending parameter value range is smaller than a minimum value of the first blending parameter value range. In some embodiments, the step of determining the first candidate combination list comprises: The method includes the step of constructing the first candidate combination list. In some embodiments, the step of constructing the first candidate combination list comprises: The method includes constructing the first candidate combination list based on a template of the current block. In some embodiments, the step of constructing the first candidate combination list based on the template of the current block includes: determining R second combinations, where any one of the R second combinations includes one weight derivation mode and K prediction modes, and the weight derivations and K prediction modes included in any two of the R second combinations are not identical, and R is a positive integer greater than 1; determining a template prediction value corresponding to any one of the R second combinations when predicting the template using a weight derivation mode in the second combination and K prediction modes; and configuring the candidate combination list based on a template prediction value corresponding to each second combination among the R second combinations. In some embodiments, the step of constructing the candidate combination list based on template prediction values corresponding to each second combination among the R second combinations includes: determining a cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination; and constructing the candidate combination list based on a cost corresponding to each of the R second combinations. In some embodiments, when the template prediction values corresponding to the second combination include template prediction values corresponding to K prediction modes in the second combination, determining a cost corresponding to the second combination based on the template prediction values corresponding to the second combination and the reconstruction values of the templates comprises: determining costs corresponding to the K prediction modes in the second combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the second combination; and determining a cost corresponding to the second combination based on the costs corresponding to the K prediction modes in the second combination. In some embodiments, determining the cost corresponding to the second combination based on the costs respectively corresponding to the K prediction modes in the second combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the second combination as the cost corresponding to the second combination. In some embodiments, determining the R second combinations comprises: determining P weight derivation modes and Q prediction modes, where P is a positive integer and Q is a positive integer equal to or greater than K; and configuring the R second combinations based on the P weight derivation modes and the Q prediction modes, wherein any one of the R second combinations includes one weight derivation mode from the P weight derivation modes and K prediction modes from the Q prediction modes. In some embodiments, determining the Q prediction modes comprises: determining at least one of a first candidate prediction mode list for the current block, a first preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the first candidate prediction mode list includes a plurality of first candidate prediction modes, and the first preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one first preliminary prediction mode; The method includes a step of determining the Q prediction modes based on at least one of the first candidate prediction mode list, a first preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, determining a first candidate prediction mode list corresponding to the current block comprises: The method includes determining the first candidate prediction mode list based on a prediction mode used by at least one block neighboring the current block. In some embodiments, the method further comprises determining a setting mode corresponding to the current block if the first candidate prediction mode list does not include a setting mode; adding the set mode to the first candidate prediction mode list. In some embodiments, determining a first candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the first candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining weights for the prediction values based on the first blending parameter and the first weight derivation mode comprises: determining a second weight corresponding to the current block based on the first weight derivation mode and the current block; adjusting the second weight using the first blending parameter to obtain an adjusted second weight; and weighting the predicted value based on the adjusted second weight. In some embodiments, the first combination further includes a second blending parameter, and the step of predicting the current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: The method includes predicting the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, determining a prediction value for the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes comprises: determining weights for the prediction values based on the first weight derivation mode and the second blending parameter; determining the K predicted values based on the K first prediction modes; weighting the K predictors based on the weights of the K predictors to obtain a predictor of the current block. In some embodiments, determining weights for the predictors based on the first weight derivation mode and the second blending parameter comprises: determining a fourth weight corresponding to the current block based on the first weight derivation mode and the current block; adjusting the fourth weight using the second blending parameter to obtain an adjusted fourth weight; and determining a weight for the predicted value based on the adjusted fourth weight. In some embodiments, determining the first combination comprises: determining a second candidate combination list, the second candidate combination list including a plurality of second candidate combinations, and any one of the plurality of second candidate combinations including one weight derivation mode, K prediction modes, and one blending parameter; determining the first combination from the second candidate combination list. In some embodiments, the step of determining the second candidate combination list comprises: The step of constructing the second candidate combination list is included. In some embodiments, constructing the second candidate combination list comprises: and constructing the second candidate combination list based on a template of the current block. In some embodiments, the step of constructing the second candidate combination list based on the template of the current block includes: determining H third combinations, wherein any one of the H third combinations includes one weight derivation mode, K prediction modes, and one blending parameter, and the weight derivation modes, the K prediction modes, and the blending parameter included in any two of the H third combinations are not identical, and H is a positive integer greater than 2; determining a cost corresponding to any one of the H third combinations when predicting the template using the weight derivation mode, the K prediction modes, and a blending parameter; and configuring the second candidate combination list based on a cost corresponding to each of the H third combinations. In some embodiments, determining a cost corresponding to the third combination when predicting the template using the weight derivation mode, K prediction modes, and blending parameters in the third combination includes: determining weights for the templates based on weight derivation modes and blending parameters included in the third combination; predicting the template based on the K prediction modes in the third combination to obtain K predicted values of the template; weighting the K predicted values of the template according to the weight of the template to obtain a template predicted value corresponding to the third combination; and determining a cost corresponding to the third combination based on the template prediction value corresponding to the third combination and the reconstruction value of the template. In some embodiments, determining the weights of the templates based on the weight derivation mode and blending parameters included in the third combination comprises: determining a third weight corresponding to the template based on a weight derivation mode in the third combination and the template; adjusting the third weight using the blending parameters in the third combination to obtain the adjusted third weight; and determining a weight for the template based on the adjusted third weight. In some embodiments, determining a cost corresponding to the third combination when predicting the template using the weight derivation mode, K prediction modes, and blending parameters in the third combination includes: determining template prediction values corresponding to the K prediction modes of the third combination based on the weight derivation modes in the third combination and the blending parameters; determining costs corresponding to the K prediction modes in the third combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the third combination; and determining a cost corresponding to the third combination based on costs corresponding to the K prediction modes in the third combination. In some embodiments, determining the cost corresponding to the third combination based on the costs respectively corresponding to the K prediction modes in the third combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the third combination as the cost corresponding to the third combination. In some embodiments, the step of constructing the second candidate combination list based on a cost corresponding to each of the H third combinations includes: Sorting the H third combinations based on a cost corresponding to each third combination among the H third combinations; and determining the sorted H third combinations as the second candidate combination list. In some embodiments, the step of sorting the H third combinations based on a cost corresponding to each third combination among the H third combinations includes: The method includes a step of sorting the H third combinations in ascending order of cost. In some embodiments, the step of constructing the second candidate combination list based on a cost corresponding to each third combination among the H third combinations includes: selecting L third combinations from the H third combinations based on costs corresponding to the third combinations; and determining the list of the L third combinations as the second candidate combination list. In some embodiments, the L third combinations are the first L third combinations of the H third combinations that have the smallest costs. In some embodiments, determining the H third combinations includes: determining F weight derivation modes, J prediction modes, and W blending parameters, where F and W are positive integers, and Q is a positive integer equal to or greater than K; and configuring the H third combinations based on the F weight derivation modes, the J prediction modes, and the W blending parameters. In some embodiments, determining the J prediction modes comprises: determining at least one of a second candidate prediction mode list for the current block, a second preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the second candidate prediction mode list includes a plurality of second candidate prediction modes, and the second preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one second preliminary prediction mode; and determining the J prediction modes based on at least one of the second candidate prediction mode list, a second preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, the step of determining the second candidate prediction mode list comprises: The method includes determining a second candidate prediction mode list corresponding to the current block based on a prediction mode used by at least one block neighboring the current block. In some embodiments, the method further comprises determining a setting mode corresponding to the current block when the second candidate prediction mode list does not include a setting mode; adding the set mode to the second candidate prediction mode list. In some embodiments, determining a second candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the second candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining the F weight derivation modes comprises: The method includes a step of selecting the F weight derivation modes from Z preset weight derivation modes, where Z is a positive integer equal to or greater than F. In some embodiments, determining the W blending parameters comprises: The method includes determining the W blending parameters based on the size of the current block. In some embodiments, the step of configuring the H third combinations based on the F weight derivation modes, the J prediction modes, and the W blending parameters comprises: selecting E weight derivation modes from the F weight derivation modes, where E is a positive integer equal to or less than F; selecting V prediction modes from the J prediction modes, where V is a positive integer equal to or less than J; selecting O blending parameters from the W blending parameters, where O is a positive integer less than or equal to W; and configuring the H third combinations based on the E weight derivation modes, the V prediction modes, and the O blending parameters. In some embodiments, the step of selecting E weight derivation modes from the F weight derivation modes comprises: For an i-th weight derivation mode among the F weight derivation modes, determining weights on the template of K second prediction modes based on the i-th weight derivation mode and a third blending parameter, wherein the third blending parameter is any one blending parameter among the W blending gradients, and the K second prediction modes are any K prediction modes among the J prediction modes, where i is a positive value from 1 to F; If the weight on the template of any one of the K prediction modes is smaller than a first set value, deleting the i-th weight derivation mode from the F weight derivation modes to obtain the E weight derivation modes. In some embodiments, the step of determining weights on the template of K second prediction modes based on the i-th weight derivation mode and a third blending parameter comprises: determining a fourth weight corresponding to the template based on the first weight derivation mode and the template; adjusting the fourth weight using the third blending parameter to obtain an adjusted fourth weight; determining weights on the template of the K second prediction modes based on the adjusted fourth weights. In some embodiments, the step of selecting O blending parameters from the W blending parameters includes: determining image information of the current block; determining the O blending parameters from the W blending parameters based on image information of the current block. In some embodiments, the image information includes image edge sharpness, and determining the O blending parameters from the W blending parameters based on the image information of the current block includes: If the image edge sharpness of the current block is less than a predetermined value, determining at least one first-type blending parameter among the W blending parameters as O blending parameters; If the image edge sharpness of the current block is equal to or greater than a set value, determining at least one second type blending parameter among the W blending parameters as the O blending parameters, wherein the second type blending parameter is greater than the first type blending parameter. In some embodiments, the step of selecting O blending parameters from the W blending parameters includes: The method includes selecting the O blending parameters from the W blending parameters based on a size of the current block. In some embodiments, selecting the O blending parameters from the W blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a second set threshold, a third or greater blending parameter among the W blending parameters is set as the O blending parameters; or If the size of the current block is equal to or greater than a second set threshold, a blending parameter that is equal to or less than a fourth value among the W blending parameters is set as the O blending parameters, and the fourth value is smaller than the third value. In some embodiments, selecting the O blending parameters from the W blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a second set threshold, determining the O blending parameters as one or more blending parameters within a value range of a third blending parameter among the W blending parameters; or If the size of the current block is equal to or greater than a second set threshold, determining the O blending parameters as one or more blending parameters within a value range of a fourth blending parameter among the W blending parameters, wherein the minimum value of the value range of the fourth blending parameter is smaller than the minimum value of the value range of the third blending parameter. In some embodiments, the first weight derivation mode includes a fourth blending parameter, and predicting the current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: The method includes predicting a current block based on the fourth blending parameter and the K first prediction modes to obtain a predicted value of the current block. In some embodiments, predicting the current block based on the fourth blending parameter and the K first prediction modes to obtain a predicted value of the current block includes: determining weights for the predicted values based on the fourth blending parameter; determining the K predicted values based on the K first prediction modes; weighting the K predictors based on the weights of the K predictors to obtain a predictor of the current block. In some embodiments, determining the first weight derivation mode and the K first prediction modes included in the first combination based on the first index comprises: determining a third candidate combination list, the third candidate combination list including a plurality of third candidate combinations, any one of the plurality of third candidate combinations including one weight derivation mode and K prediction modes, the one weight derivation mode including one blending parameter; determining a weight derivation mode and K prediction modes included in a third candidate combination corresponding to the first index in the third candidate combination list as the first weight derivation mode and the K first prediction modes. In some embodiments, the step of determining the third candidate combination list comprises: The method includes the step of constructing the third candidate combination list. In some embodiments, the step of constructing the third candidate combination list comprises: and constructing the third candidate combination list based on a template of the current block. In some embodiments, the step of constructing the third candidate combination list based on the template of the current block includes: determining A fourth combinations, wherein any one of the A fourth combinations includes one weight derivation mode and K prediction modes, the weight derivation mode includes one blending parameter, and the weight derivation mode and the K prediction modes included in any two of the A fourth combinations are not identical, and A is a positive integer greater than 1; determining a cost corresponding to any one of the A fourth combinations when predicting the template using a weight derivation mode in the fourth combination and K prediction modes; and constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations. In some embodiments, determining a cost corresponding to the fourth combination when predicting the template using the weight derivation mode in the fourth combination and the K prediction modes includes: determining template prediction values corresponding to the K prediction modes in the fourth combination based on the weight derivation modes in the fourth combination; determining costs corresponding to the K prediction modes in the fourth combination based on template prediction values and template reconstruction values corresponding to the K prediction modes in the fourth combination; and determining a cost corresponding to the fourth combination based on the costs corresponding to the K prediction modes in the fourth combination. In some embodiments, determining the cost corresponding to the fourth combination based on the costs respectively corresponding to the K prediction modes in the fourth combination comprises: The method includes determining the sum of the costs corresponding to the K prediction modes in the fourth combination as the cost corresponding to the fourth combination. In some embodiments, the step of constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations includes: sorting the A fourth combinations based on a cost corresponding to each fourth combination among the A fourth combinations; and determining the sorted A fourth combinations as the third candidate combination list. In some embodiments, the step of sorting the A fourth combinations based on a cost corresponding to each fourth combination among the A fourth combinations includes: The method includes a step of sorting the A fourth combinations in ascending order of cost. In some embodiments, the step of constructing the third candidate combination list based on a cost corresponding to each fourth combination among the A fourth combinations includes: selecting B fourth combinations from the A fourth combinations based on costs corresponding to the fourth combinations; and determining the list of the B fourth combinations as the third candidate combination list. In some embodiments, the B fourth combinations are the first B fourth combinations among the A fourth combinations that have the smallest costs. In some embodiments, determining the A fourth combinations includes: determining C weight derivation modes and D prediction modes, where C is a positive integer and D is a positive integer equal to or greater than K; and configuring the A fourth combinations based on the C weight derivation modes and the D prediction modes. In some embodiments, determining the D prediction modes comprises: determining at least one of a third candidate prediction mode list for the current block, a third preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to a weight derivation mode, wherein the third candidate prediction mode list includes a plurality of third candidate prediction modes, and the third preliminary prediction mode list corresponding to any one of the K prediction modes includes at least one third preliminary prediction mode; and determining the D prediction modes based on at least one of the third candidate prediction mode list, a third preliminary prediction mode list corresponding to each of the K prediction modes, and a prediction mode corresponding to the weight derivation mode. In some embodiments, the step of determining the third candidate prediction mode list comprises: The method includes determining a third candidate prediction mode list corresponding to the current block based on a prediction mode used by at least one block neighboring the current block. In some embodiments, the method further comprises determining a setting mode corresponding to the current block if the third candidate prediction mode list does not include a setting mode; adding the set mode to the third candidate prediction mode list. In some embodiments, determining a third candidate prediction mode list corresponding to the current block comprises: determining an image type corresponding to the current block; determining the third candidate prediction mode list based on an image type corresponding to the current block. In some embodiments, determining the C weight derivation modes comprises: determining X blending parameters, where X is a positive integer; determining the C weight derivation modes based on the X blending parameters. In some embodiments, determining the X blending parameters comprises: determining image information of the current block; and determining X blending parameters based on the image information of the current block. In some embodiments, the image information includes image edge sharpness, and determining X blending parameters based on the image information of the current block includes: If the image edge sharpness of the current block is less than a predetermined value, determining at least one third type blending parameter among Y preset blending parameters as the X blending parameters, where Y is a positive integer greater than X; or If the image edge sharpness of the current block is equal to or greater than the set value, determining at least one fourth type blending parameter among the Y blending parameters as the X blending parameters, wherein the fourth type blending parameter is greater than the third type blending parameter. In some embodiments, determining the X blending parameters comprises: The method includes determining the X blending parameters based on the size of the current block. In some embodiments, determining the X blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a third threshold, a blending parameter having a fifth value or more among at least one preset blending parameter is set as the X blending parameters; or If the size of the current block is equal to or greater than a third set threshold, a blending parameter of the at least one blending parameter that is equal to or less than a sixth value is set as the X blending parameters, and the sixth value is smaller than the fifth value. In some embodiments, determining the X blending parameters based on the size of the current block comprises: If the size of the current block is smaller than a third set threshold, determining the X blending parameters as one or more blending parameters within a value range of a fifth blending parameter among at least one preset blending parameter; or If the size of the current block is equal to or greater than a third set threshold, determining the X blending parameters as one or more blending parameters within a value range of a sixth blending parameter among the at least one blending parameter, wherein the minimum value of the value range of the sixth blending parameter is smaller than the minimum value of the value range of the fifth blending parameter. In some embodiments, the method further comprises determining at least one flag, the at least one flag being used to indicate whether to encode using the first combination; The step of determining the first combination includes: If the at least one flag indicates that the first combination is to be used for encoding, the method includes determining the first combination. In some embodiments, the at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag, and a block level flag. In some embodiments, if the at least one flag includes a block level flag, determining the first combination comprises: If it is determined that the size of the current block satisfies a set condition, the method includes determining the first combination. In some embodiments, determining the first combination comprises: If it is determined that the current block is not coded using a first technique, the method includes determining the first combination. In some embodiments, determining the configuration mode corresponding to the current block comprises: determining an image type corresponding to the current block; determining a setting mode corresponding to the current block based on an image type corresponding to the current block; In some embodiments, the setting mode includes at least one of a DC, a horizontal mode, a vertical mode, and an angle mode. In some embodiments, determining the image type corresponding to the current block comprises: The method includes determining an image type corresponding to the current block based on an image type of a current image to which the current block belongs or an image type of a current slice to which the current block belongs.
[0142] Hereinafter, a video decoding method according to an embodiment of the present application will be described with reference to FIG. 15, taking the decoding side as an example.
[0143] 15 is a schematic flowchart of a video decoding method according to an embodiment of the present application, which is applied to the video decoder shown in FIG. 1 and FIG. 3. As shown in FIG. 15, the method in the embodiment of the present application includes the following steps:
[0144] S101. The codestream is decoded to obtain the first index.
[0145] The first index is used to indicate a first combination, where the first combination includes one first weight derivation mode and K first prediction modes, where K is a positive integer greater than 1.
[0146] As can be seen from the above, one weight derivation mode and K prediction modes together generate a predicted block, which is a current block, i.e., weights are determined based on the weight derivation mode, the current block is predicted based on the K prediction modes to obtain K predicted values, and a weighting process is performed on the K predicted values based on the weights to obtain a predicted value of the current block. As can be seen from this, the one weight derivation mode and the K prediction modes act together on the current block as a combination and are related to each other.
[0147] The embodiments of the present application do not limit the specific expression format or included contents of the weight derivation mode, which is used to derive weights, such as weights of predicted values and weights of templates.
[0148] For example, the current block contains the edges of K objects in relative motion, which is an ideal scenario for inter-GPM. Theoretically, this split should occur at the edge of the object, but in reality, the split possibilities are limited and it is impossible to cover every edge. In some cases, a close split is selected, and there may be multiple close splits. The choice depends on which split produces the best result when combined with the K prediction modes. Similarly, the choice of prediction mode may depend on which combination produces the best result. This is because, even for parts where this prediction mode is used, it is difficult for natural video to perfectly match this part with the current block. Therefore, the final selection is likely to be the one with the highest coding efficiency. Another scenario where GPM is more commonly used is when the current block contains parts of a single object in relative motion. For example, if distortion or deformation occurs due to arm swinging, such splitting may be even more blurred, and the final result may depend on which combination produces the best result. 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 by a simple direction. Therefore, intra GPM may provide more complex prediction blocks, and intra-coded blocks usually have larger residuals than inter-coded blocks under the same quantization. Therefore, the choice of which prediction mode to use may ultimately depend on which combination results are optimal.
[0149] Based on the above description, one weight derivation mode and K prediction modes can function on the current block as a combination. In order to save codewords and reduce encoding costs, in the embodiment of the present application, the weight derivation mode and K prediction modes corresponding to the current block are combined as a combination, i.e., as a first combination, and a first index is used to indicate the first combination. Compared with individually indicating the weight derivation mode and the K prediction modes, the embodiment of the present application uses fewer codewords and further reduces encoding costs.
[0150] Specifically, the encoding side determines a first combination corresponding to the current block, where the first combination consists of one weight derivation mode and K prediction modes. For convenience of explanation, the weight derivation mode included in the first combination is entered as a first weight, and the K prediction modes included in the first combination are determined as K first prediction modes. The encoding side 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. For example, the encoding side derives weights using the first weight derivation mode, predicts the current block using the K prediction modes respectively to obtain K predicted values, and performs a weighting operation on the K predicted values based on the derived weights to obtain a predicted value of the current block.
[0151] At the same time, to maintain consistency between the encoding side and the decoding side, the encoding side indicates the first combination to the decoding side through a first index. That is, the encoding side writes the first index into the codestream. The decoding side obtains the first index by decoding the codestream, determines a first combination corresponding to the current block based on the first index, and predicts the current block using the first weight derivation mode and K first prediction modes included in the first combination to obtain a predicted value of the current block.
[0152] The embodiment of the present application does not limit the specific format of the syntax element of the first index.
[0153] In a possible embodiment, if the current block is predicted using the GPM technique, gpm_cand_idx is used to represent the first index.
[0154] Since the first index mentioned above is used to indicate the first combination, in some embodiments, the first index may be referred to as a first combination index or an index of the first combination.
[0155] As an example, after adding the first index to the codestream, the syntax is as shown in Table 5.
[0156] [Table 5]
[0157] Here, gpm_cand_idx is the first index.
[0158] In some embodiments, before decoding the first index, the decoding side must first determine whether the current block performs weighted prediction processing using K different prediction modes. If the decoding side determines that the current block performs weighted prediction processing using K different prediction modes, it performs the above-mentioned S101 to decode the codestream and obtain the first index. If the decoding side determines that the current block does not perform weighted prediction processing using K different prediction modes, it skips the above-mentioned step S101.
[0159] In a possible embodiment, the decoding side may determine whether the current block undergoes weighted prediction processing using K different prediction modes by determining a prediction mode parameter of the current block.
[0160] 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 perform prediction processing using K different prediction modes.
[0161] It is understood that in the present embodiment, the prediction mode parameter can be understood as a flag indicating whether the GPM mode or the AWP mode is used. Specifically, the encoder may set the prediction mode parameter by using a variable as the prediction mode parameter and setting the value of the variable. For example, in the present 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. For example, in the present 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 the present 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 parse the codestream to obtain the prediction mode.
[0162] Based on this, the decoding side decodes the codestream, obtains the prediction mode parameter, and 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 the weight derivation mode for the current block.
[0163] In some embodiments, the present application may conditionally restrict the use of the GPM mode or the AWP mode for the current block, as shown in Table 5. That is, if it is determined that the current block satisfies the set condition, the current block may perform weighted prediction using K prediction modes, so that the decoding side decodes the codestream and obtains the first index.
[0164] For example, when the GPM mode or the AWP mode is applied, the size of the current block may be limited.
[0165] It is understood that the prediction method according to the embodiment of the present application requires generating K prediction values using K different prediction modes, and weighting the K prediction values based on the weights to obtain a prediction value for the current block. To reduce complexity while considering the trade-off between compression performance and complexity, the embodiment of the present application may limit the size of blocks that do not use the GPM mode or the AWP mode. Therefore, in the present application, the decoder may 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.
[0166] In an embodiment of the present application, the size parameters of the current block may include the height and width of the current block, and therefore the decoder may determine whether to use GPM mode or AWP mode based on the height and width of the current block.
[0167] For example, in this application, if the width is greater than a first threshold and the height is greater than a second threshold, it is determined that the current block can use the GPM mode or the AWP mode. Therefore, one possible restriction is to use the GPM mode or the AWP mode only when the width of the block is greater than (or equal to) the first threshold and the height of the block is greater than (or equal to) the second threshold. Here, the values of the first threshold and the second threshold may be 4, 8, 16, 32, 128, 256, etc., and the first threshold may be equal to the second threshold.
[0168] For example, in this application, if the width is smaller than the third threshold and the height is larger than the fourth threshold, it is determined that the current block can use the GPM mode or the AWP mode. Therefore, one possible restriction is to use the GPM mode or the AWP mode only when the width of the block is smaller than (or smaller than) the third threshold and the height of the block is larger than (or larger than) the fourth threshold. Here, the values of the third threshold and the fourth threshold may be 4, 8, 16, 32, 128, 256, etc., and the third threshold and the fourth threshold may be equal.
[0169] Furthermore, in embodiments of the present application, pixel parameters may be limited to restrict the size of blocks in which GPM mode or AWP mode can be used.
[0170] For example, in this application, the decoder may first determine pixel parameters of the current block, and then further determine whether the current block uses GPM mode or AWP mode based on the pixel parameters and the fifth threshold. Thus, one possible restriction is to use GPM mode or AWP mode only if the number of pixels of the block is greater than (or equal to) the fifth threshold, where the value of the fifth threshold is 4, 8, 16, 32, 128, 256, 1024, etc.
[0171] That is, in this application, the current block uses the GPM mode or the AWP mode only if the size parameter of the current block meets the size requirement.
[0172] For example, in the present application, a frame-level flag may exist to determine whether the currently decoded frame uses the present application. An intra frame (e.g., an I frame) may be configured to use the present application, and an inter frame (e.g., a B frame, a P frame) may not. Alternatively, an intra frame may not use the present application, and an inter frame may use the present application. Alternatively, some inter frames may use the present application, and some inter frames may not. Since inter frames may also use intra prediction, there is a possibility that inter frames may also use the present application.
[0173] In some embodiments, there may be a flag below the frame level, above the CU level (tile, slice, patch, LCU, etc.) to determine whether the present application is used in this area.
[0174] S102. Determine a first weight derivation mode and K first prediction modes included in a first combination based on a first index.
[0175] The decoding side decodes the codestream to obtain the first index, and then determines the first weight derivation mode and the K first prediction modes included in the first combination based on the first index.
[0176] In this application, a weight derivation mode is used to determine the weights used in the current block. Specifically, a weight derivation mode may be a mode for deriving weights. For a block of a specified length and width, each weight derivation mode may derive one weight matrix. For blocks of the same size, the weight matrices derived in different weight derivation modes are different.
[0177] Illustratively, in this application, there are 56 weight derivation modes in the AWP and 64 weight derivation modes in the GPM.
[0178] Examples of the K different first prediction modes included in the above first combination include the following.
[0179] In example 1, the above K different first prediction modes are all intra prediction modes, for example, the current block is an intra coded block, and picture content coding is not applicable.
[0180] Example 2: The above K different first prediction modes are all inter prediction modes, for example, the current block is an inter coded block.
[0181] Example 3: Among the K different first prediction modes, at least one is an intra prediction mode and at least one is an inter prediction mode.
[0182] Example 4: Among the above K different first prediction modes, at least one is an intra prediction mode, and at least one is a non-inter and non-intra prediction mode, such as an intra-block replication IBC prediction mode or a palette prediction mode.
[0183] Example 5: Among the K different first prediction modes, at least one is an inter prediction mode, and at least one is a non-inter and non-intra prediction mode, such as an IBC prediction mode or a palette prediction mode.
[0184] Example 6: None of the above K different first prediction modes are intra prediction modes or inter prediction modes. For example, one is an IBC prediction mode and one is a palette prediction mode.
[0185] Note that the embodiments of the present application do not limit the specific types of the K different first prediction modes included in the first combination.
[0186] In one embodiment of the present application, the first combination includes a first weight derivation mode and K first prediction modes, where the first weight derivation mode does not include a blending parameter. In another case, the first combination includes a first weight derivation mode, K first prediction modes, and a second blending parameter. In yet another case, the first combination includes a first weight derivation mode and K first prediction modes, where the first weight derivation mode includes a blending parameter. Here, the blending parameter is used together with the K first prediction modes to determine a predicted value of the current block.
[0187] Next, the process of implementing S102 when the first combination includes different contents will be described.
[0188] In case 1, when the first combination includes a first weight derivation mode and K first prediction modes, the embodiments of the above S102 include, but are not limited to, the following:
[0189] Method 1: The encoding side and the decoding side determine a first combination corresponding to a first index from a plurality of preset first candidate combinations. For example, the plurality of preset first candidate combinations may include any number of first candidate combinations, such as 2, 3, 4, 5, 6, 7, 8, 9, etc. Assuming there are eight first candidate combinations, each first candidate combination includes a weight derivation mode and K prediction modes, and these eight first candidate combinations have different identifiers (or indexes). In this way, after obtaining a first index, the decoding side queries the plurality of first candidate combinations to find a first candidate combination corresponding to the first index, and determines the first candidate combination corresponding to the first index as the first combination. As a result, the weight derivation mode included in the first candidate combination is determined as the first weight derivation mode, and the K prediction modes included in the first candidate combination are determined as the K first prediction modes.
[0190] Method 2: Both the decoding side and the encoding side determine one list, which includes a plurality of first candidate combinations, and therefore the list is also called a first candidate combination list, and a first combination corresponding to a first index is determined from the first candidate combination list. In this case, the above S102 includes the following steps:
[0191] S102-A. Determine the first candidate combination list.
[0192] S102-B. The weight derivation mode and K prediction modes included in the first candidate combination corresponding to the first index in the first candidate combination list are determined as the first weight derivation mode and K first prediction modes.
[0193] Here, the above-mentioned first candidate combination list includes a plurality of first candidate combinations, and any one of the plurality of first candidate combinations includes one weight derivation mode and K prediction modes.
[0194] For example, the first candidate combination list is shown in Table 6.
[0195] [Table 6]
[0196] As shown in Table 6, the first candidate combination list includes a plurality of first candidate combinations. Any two of the plurality of first candidate combinations are not completely identical, that is, the weight derivation modes and K prediction modes included in any two first candidate combinations are different. For example, the weight derivation modes of first candidate combination 1 and first candidate combination 2 are different, or the weight derivation modes of first candidate combination 1 and first candidate combination 2 are the same and at least one prediction mode of the K prediction modes is different, or the weight derivation modes of first candidate group 1 and first candidate group 2 are different and at least one prediction mode of the K prediction modes is different.
[0197] For example, in the above Table 6, the order of the first candidate combination in the first candidate combination list is used as an index, but alternatively, the index of the first candidate combination in the first candidate combination list may be reflected in other ways, and the embodiment of the present application is not limited thereto.
[0198] In this method 2, the decoding side decodes the codestream to obtain a first index, determines the first candidate combination list shown in Table 6 above, queries the first candidate combination list based on the first index, and obtains the first weight derivation mode and K prediction modes included in the first combination indicated by the first index.
[0199] For example, the first index is index 1. In the first candidate combination list shown in Table 6, the first candidate combination corresponding to index 1 is first candidate combination 2. That is, the first combination indicated by the first index is first candidate combination 2. In this way, the decoding side determines the weight derivation mode and K prediction modes included in first candidate combination 1 as the first weight derivation mode and K first prediction modes included in the first combination, predicts the current block using the first weight derivation mode and K first prediction modes, and obtains a predicted value of the current block.
[0200] In this method 2, the encoding side and the decoding side may each determine the same first candidate combination list. For example, both the encoding side and the decoding side determine a list including N first candidate combinations, each of which includes one weight derivation mode and K prediction modes. In the codestream, the encoding side only needs to write one finally selected first candidate combination, for example, the first combination. The decoding side analyzes the first combination finally selected by the encoding side. Specifically, the decoding side decodes the codestream, obtains a first index, and determines the first combination in the first candidate combination list determined by the decoding side through the first index.
[0201] The embodiment of the present application does not limit the specific method by which the decoding side determines the first candidate combination list.
[0202] In some embodiments, the above-mentioned first candidate combination list already exists, and the decoding side decodes the codestream to obtain the first index, and then obtains or reads the first candidate combination list based on the first index, thereby querying the first candidate combination corresponding to the first index in the first candidate combination list based on the first index.
[0203] In some embodiments, the first candidate combination list is transmitted by the encoding side to the decoding side, for example, the encoding side transmits it to the decoding side before encoding the current block.
[0204] In some embodiments, the first candidate combination list is uploaded to the cloud by the encoding side, and the decoding side reads the first candidate combination list from the cloud after decoding the codestream and obtaining the first index.
[0205] In some embodiments, the first candidate combination list is configured by the decoding side, for example, the decoding side decodes the codestream to obtain a first index, and then configures the first candidate combination list in response to the first index.
[0206] The embodiments of the present application do not limit the manner in which the decoding side constructs the first candidate combination list, for example, by analyzing the occurrence probability of each combination of different weight derivation modes and different prediction modes using information related to the current block, and constructing the first candidate combination list based on the occurrence probability of each combination.
[0207] Optionally, the information related to the current block includes mode information of surrounding blocks of the current block, reconstructed pixels of the current block, and so on.
[0208] In some embodiments, the decoding side constructs the first candidate combination list by the following step S102-A1.
[0209] S102-A1. Compose a first candidate combination list based on the template of the current block.
[0210] Template matching uses the correlation between neighboring pixels to use a portion of the area surrounding the current block as a template. When the current block is coded or decoded, its left and top sides are coded according to the coding order. Inter prediction finds the best matching position of the template in the reference intra and determines the motion information or motion vector of the current block. In intra prediction, the template is used to determine the intra prediction mode of the current block.
[0211] The template of the current block is composed of a reconstructed region around the current block and is correlated with the current block, and according to the embodiment of the present application, a first candidate compositing list is constructed based on the template of the current block.
[0212] The present application does not limit the specific shape of the template of the current block.
[0213] In some embodiments, the template includes at least one of the top coding region, the left coding region, and the top-left coding region of the current block.
[0214] Optionally, the width of the upper coded area is the same as the width of the current block. The height of the left coded area is the same as the height of the current block. The width of the upper left coded area is the same as the width of the left coded area. The height of the upper left coded area is the same as the height of the upper coded area.
[0215] For example, for each combination, the combination is used to predict a template of the current block, and a predicted value of the template under each combination is obtained, and a first candidate combination list is constructed based on the predicted value of the template under each combination.
[0216] For example, for each combination, the template of the current block is predicted using the combination to obtain a predicted value of the template for each combination. For example, the weight derivation mode included in the combination is used to derive the weight of the template, and the K prediction modes included in the combination are used to predict the template respectively to obtain K predicted values of the template. The K predicted values of the template are weighted based on the derived template weights to obtain a predicted value of the template for this combination. Finally, a first candidate combination list is constructed based on the predicted value of the template for each combination.
[0217] The weights derived based on the weight derivation mode can be understood as weights corresponding to each pixel point in the derived template, or as a weight matrix corresponding to the derived template. When determining the template prediction value based on the weights, K prediction values corresponding to each pixel point in the template are determined, and K prediction values corresponding to each pixel are determined based on the K prediction values corresponding to each pixel point and the weights, whereby the prediction values corresponding to each pixel point in the template constitute the template prediction value. Alternatively, determining the template prediction value based on the weights can be performed on a block-by-block basis. For example, the template prediction value is determined, and the K prediction values are weighted based on the template weight matrix to obtain the template prediction value.
[0218] In some embodiments, S102-A1 includes the following steps S102-A11 to S102-A13.
[0219] S102-A11. Determine R second combinations, where any of the R second combinations includes one weight derivation mode and K prediction modes, and the weight derivations and K prediction modes included in any two of the R second combinations are not completely the same, and R is a positive integer greater than 1.
[0220] S102-A12: For any one of the R second combinations, predict a template using the weight derivation mode in the second combination and the K prediction modes, and obtain a template prediction value corresponding to the second combination.
[0221] S102 to A13: A first candidate combination list is constructed based on the template predicted values corresponding to each of the R second combinations.
[0222] In this embodiment, when the decoding side constructs a first candidate combination list, it first determines R second combinations, but the specific values of the R second combinations are not limited to 8, 16, 32, etc. Each of the R second combinations includes one weight derivation mode and K prediction modes, and the weight derivation modes and the K prediction modes included in any two of the R second combinations are not identical. Next, for each of the R second combinations, the weight derivation mode and the K prediction modes included in the second combination are used to predict the template of the current block, and a predicted value of the template under the second combination value is obtained. Finally, a first candidate combination list is constructed based on the template predicted values corresponding to each of the R second combinations.
[0223] In the above steps S102 to A13, the method of configuring the first candidate combination list based on the template predicted values corresponding to each of the R second combinations includes, but is not limited to, the following.
[0224] Method 1: A first candidate combination list is constructed based on the size of the template prediction value corresponding to each of the R second combinations.
[0225] For example, the R second combinations are sorted based on the magnitude of the template prediction value corresponding to each of the R second combinations, and the R second combinations are sorted and determined as a first candidate combination list, in which the R first candidate combinations are included in the first candidate combination list.
[0226] As another example, the R second combinations are sorted based on the size of the template prediction value corresponding to each of the R second combinations, and N second combinations are selected from the sorted R second combinations, in which case the first candidate combination list includes the N first candidate combinations.
[0227] Method 2: S102 to A13 above include the following steps.
[0228] S102-A13-1. Determine a cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination.
[0229] S102-A13-2. Compose a first candidate combination list based on the costs corresponding to each of the R second combinations.
[0230] Since the template of the current block is a reconstructed region, the decoding side may obtain the reconstructed value of the template, and determine the predicted distortion cost corresponding to each of the R second combinations based on the predicted value of the template under the second combination and the reconstructed value of the template. Here, the method for determining the cost corresponding to the second combination includes, but is not limited to, SAD, SATD, SEE, etc. Then, a first candidate combination list is constructed based on the cost corresponding to each of the R second combinations.
[0231] In the present embodiment, the template prediction value corresponding to the second combination includes at least two cases.
[0232] In the first case, 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 by the template weights to obtain weighted prediction values, and determines the weighted prediction values as the template prediction value corresponding to the second combination.
[0233] In the second case, the template predicted values corresponding to the second combination include template predicted values corresponding to the K prediction modes included in the second combination. In this case, the above step S102-A13-1 includes the following steps.
[0234] S102-A13-11. Determine costs corresponding to the K prediction modes in the second combination according to the template prediction values and template reconstruction values corresponding to the K prediction modes in the second combination.
[0235] S102-A13-12: A cost corresponding to the second combination is determined based on the costs corresponding to the K prediction modes in the second combination. For example, the sum of the costs corresponding to the K prediction modes in the second combination is determined as the cost corresponding to the second combination.
[0236] In an embodiment of the present application, for example, K=2, the weights of the template may be simplified to only two values, 0 and 1. In this case, for each pixel position, the pixel value is derived only from the prediction block of the first prediction mode or the prediction block of the second prediction mode. Therefore, for a certain prediction mode, the cost of the template when used as the first prediction mode of a certain weight derivation mode may be calculated, i.e., only the cost of a partial pixel with a weight of 1 occurring on the template when the prediction mode is the first prediction mode for that weight derivation mode may be calculated. As an example, the cost may be represented as cost[pred_mode_idx][gpm_idx][0], where pred_mode_idx represents the index of the prediction mode, gpm_idx represents the index of the weight derivation mode, and 0 represents the first prediction mode.
[0237] Then, the cost of the template when the prediction mode is used as the second prediction mode of a specific weight derivation mode may be calculated, that is, only the cost of partial pixels with a weight of 1 occurring on the template when the prediction mode is used as the second prediction mode in the case of that weight derivation mode may be calculated. As an example, the cost may be represented as cost[pred_mode_idx][gpm_idx][1], where pred_mode_idx represents the index of the prediction mode, gpm_idx represents the index of the weight derivation mode, and 1 represents the second prediction mode.
[0238] Then, when calculating the cost of one combination, the above two corresponding costs may be directly added. For example, the costs of prediction modes pred_mode_idx0 and pred_mode_idx1 in weight derivation mode gpm_idx are required. Here, pred_mode_idx0 is the first prediction mode, and pred_mode_idx1 is the second prediction mode. If the cost is denoted as costTemp, then costTemp=cost[pred_mode_idx0][gpm_idx][0]+cost[pred_mode_idx1][gpm_idx][1]. When the costs of prediction modes pred_mode_idx0 and pred_mode_idx1 are required in weight derivation mode gpm_idx, pred_mode_idx1 is used as the first prediction mode and pred_mode_idx0 is used as the second prediction mode, and the cost is denoted as costTemp, where costTemp = cost[pred_mode_idx1][gpm_idx][0] + cost[pred_mode_idx0][gpm_idx][1].
[0239] One advantage of doing this is that the cost is calculated after first weighting and combining the prediction block, simplifying the process to directly calculating the cost of the two parts and then adding the cost of the combination. Although one prediction mode may be combined with multiple other prediction modes, for the same weight derivation mode, the prediction mode is fixed as the cost of the first prediction mode and the second prediction mode parts, so 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.
[0240] In the above manner, the costs corresponding to each of the R second combinations are determined, and S102-A13-2 is executed.
[0241] Here, in S102-A13-2, the method of configuring the first candidate combination list based on the costs corresponding to each of the R second combinations may be, but is not limited to, the following examples.
[0242] Example 1: R second combinations are sorted based on the costs corresponding to each of the R second combinations, and the sorted R second combinations are determined as a first candidate combination list.
[0243] The first candidate combination list generated in this example 1 includes R first candidate combinations.
[0244] Optionally, the R first candidate combinations in the first candidate combination list are sorted in ascending order according to cost, that is, the costs corresponding to the R first candidate combinations in the first candidate combination list increase in order.
[0245] Here, sorting the R second combinations based on the costs corresponding to each of the R second combinations may involve sorting the R second combinations in ascending order of costs.
[0246] Example 2: N second combinations are selected from R second combinations based on the costs corresponding to the second combinations, and a list of these N second combinations is determined as a first candidate combination list.
[0247] Optionally, the N second combinations are the first N second combinations with the smallest costs among the R second combinations. For example, based on the costs corresponding to each of the R second combinations, N second smallest combinations with the smallest costs are selected from the R second combinations to form a first smallest candidate list. In this case, the first smallest candidate list includes the N first smallest candidates.
[0248] Optionally, the N first candidate combinations in the first candidate combination list are sorted in ascending order according to cost, that is, the costs corresponding to the N first candidate combinations in the first candidate combination list increase in order.
[0249] The process of determining the R second combinations in S102-A11 above will be described below.
[0250] In some embodiments, the R second combinations are preset, and the R second combinations are used to predict a template for the current block, obtain template prediction values corresponding to each second combination, and determine costs corresponding to each second combination based on the template prediction values corresponding to each second combination and the reconstruction values of the template, sort the R second combinations based on the costs corresponding to each second combination, and use the sorted R second combinations as a first candidate combination list, or select the second combination with the smallest cost from the sorted R second combinations to form the first candidate combination list.
[0251] In some embodiments, S102 to A11 include the following steps:
[0252] S102-A11-1. P weight derivation modes and Q prediction modes are determined, where P is a positive integer and Q is a positive integer equal to or greater than K.
[0253] S102-A11-2. R second combinations are configured based on the P weight derivation modes and the Q prediction modes. Any one of the R second combinations includes one weight derivation mode of the P weight derivation modes and K prediction modes of the Q prediction modes, where P is a positive integer and Q is a positive integer equal to or greater than K.
[0254] In this embodiment, the decoding side first determines P weight derivation modes and Q prediction modes, and then configures R second combinations according to the determined P weight derivation modes and Q prediction modes.
[0255] For example, if the second combination includes one weight derivation mode and two prediction modes, and the P weight derivation modes are weight derivation mode 1 and weight derivation mode 2, and the Q prediction modes are prediction mode 1, prediction mode 2, and prediction mode 3, then these two weight derivation modes and three prediction modes are combined to create 2 x 3 x 2, or a total of 12 second combinations.
[0256] The embodiments of the present application do not limit the specific numbers of the P weight derivation modes and Q prediction modes described above.
[0257] In a possible embodiment, assuming that the current block is an intra-coded block, there are 64 possible weight derivation modes for the GPM, and 67 possible intra prediction modes for the GPM. These can be found in the VVC standard. However, the GPM is not limited to only 64 possible weights or to any particular 64 possible weights. It is not that the GPM is limited to only 64 possible weights or to any particular 64 possible weights; the VVC GPM's selection of 64 possible weights is a trade-off between improved prediction performance and increased overhead in the codestream. On the other hand, since the present application does not encode weight derivation modes using a fixed logic, theoretically, the present application can use a wider variety of weights and be more flexible in use. Similarly, it is not that the GPM is limited to 67 possible intra prediction modes or to any particular 67 possible weights or to any particular 64 possible weights. Any theoretically possible intra prediction mode may be used in the GPM. For example, if the intra angular prediction modes are made more detailed and more intra angular prediction modes are generated, the GPM can also use more intra angular prediction modes. For example, the MIP (matrix-based intra prediction) mode of VVC can also be used in this application, but considering that MIP still has multiple submodes that can be selected, MIP is not included in this embodiment for ease of understanding.In addition, there are also several wide-angle modes, which can also be used in this application, and this embodiment will not be further described.
[0258] Assuming that K=2, the above-mentioned K prediction modes include a first prediction mode and a second prediction mode, and there are 67 possible prediction modes (i.e., Q=67), there are 67 possible first prediction modes, and since the second prediction mode is different from the first prediction mode, there are 66 possible second prediction modes, and there are 64 possible weight derivation modes (i.e., P=64). The present application uses any two different prediction modes and any one weight derivation mode to form one second combination, and there are a total of 64×67×66 possible second combinations.
[0259] In this embodiment, the P weight derivation modes are all possible weight derivation modes, for example, 64 weight derivation modes of GPM, and the Q prediction modes are all possible weight derivation modes, for example, all possible prediction modes, such as 67 intra prediction modes of GPM. By using an exhaustive method, all possible second combinations are obtained, for example, 64×67×66 possible second combinations are obtained, and each of these 64×67×66 possible second combinations is used to predict the template of the current block, and the distortion cost of each second combination is calculated. Then, a first candidate combination list corresponding to the current block is obtained based on the distortion cost of each second combination.
[0260] In some embodiments, in order to reduce the amount of data and improve the speed of constructing the first candidate combination list, not every prediction mode may be tried, but several prediction modes may be selected and tried.
[0261] In this case, the embodiments for determining the Q prediction modes in the above S102-A11-1 include, but are not limited to, the following methods.
[0262] In the first method, the Q prediction modes are preset prediction modes.
[0263] Method 2: Determine at least one of a first candidate prediction mode list for the current block, a first preliminary prediction mode list corresponding to K prediction modes, and a prediction mode corresponding to a weight derivation mode; and determine Q prediction modes based on the first candidate prediction mode list, the first preliminary prediction mode list corresponding to the K prediction modes, and at least one prediction mode corresponding to the weight derivation mode.
[0264] The first candidate prediction mode list includes a plurality of first candidate prediction modes, and the first auxiliary prediction mode list corresponding to any one of the K prediction modes includes at least one first auxiliary prediction mode.
[0265] For example, Q prediction modes are determined based on the candidate prediction mode list of the current block.
[0266] As another example, Q prediction modes are determined based on a first preliminary prediction mode list corresponding to K prediction modes, respectively.
[0267] As another example, the Q prediction modes are determined based on the prediction mode corresponding to the weight derivation mode.
[0268] As another example, Q prediction modes are determined based on the first candidate prediction mode list of the current block and the first preliminary prediction mode list corresponding to K prediction modes, respectively.
[0269] As another example, Q prediction modes are determined based on the prediction mode corresponding to the first candidate prediction mode list and the weight derivation mode of the current block.
[0270] As another example, Q prediction modes are determined based on the first preliminary prediction mode list corresponding to the K prediction modes respectively and the prediction modes corresponding to the weight derivation mode.
[0271] As another example, Q prediction modes are determined based on the first candidate prediction mode list, the first preliminary prediction mode list corresponding to the K prediction modes, and the prediction mode corresponding to the weight derivation mode.
[0272] Here, it should be understood that determining lists of first preliminary prediction modes corresponding to K prediction modes means determining one list of first preliminary prediction modes for each of the K prediction modes, and when subsequently configuring a second combination, one prediction mode of the second combination is selected from the list of first preliminary prediction modes corresponding to that prediction mode. For example, when K=2, the K prediction modes include a first prediction mode and a second prediction mode, and the decoding side configures first preliminary prediction mode list 1 for the first prediction mode and first preliminary prediction mode list 2 for the second prediction mode. When subsequently configuring a different second combination, the decoding side selects one first preliminary prediction mode from first preliminary prediction mode list 1 as the first preliminary prediction mode and selects another first preliminary prediction mode from first preliminary prediction mode list 2 as the second prediction mode, and the one weight derivation mode and the currently selected first and second prediction modes configure the second combination.
[0273] The embodiment of the present application does not limit the method for determining the first candidate prediction mode list corresponding to each prediction mode among the K prediction modes.
[0274] In a possible embodiment, for any one of the K prediction modes, a first candidate prediction mode list corresponding to that prediction mode and at least one of the prediction modes corresponding to the weight derivation modes are determined, and a first preliminary prediction mode list corresponding to that prediction mode is determined based on the first candidate prediction mode list and at least one of the prediction modes corresponding to the weight derivation modes.
[0275] In the embodiment of the present application, determining the first candidate prediction mode list corresponding to any one of the K prediction modes is basically the same as the process of determining the first candidate prediction mode list corresponding to the current block, see the following description.
[0276] In some embodiments, the first candidate prediction mode list includes one or more inter prediction modes, such as at least one of skip, merge, common inter prediction mode, unidirectional prediction, bidirectional prediction, multi-hypothesis prediction, etc.
[0277] In some embodiments, the first candidate prediction mode list includes one or more intra prediction modes, such as at least one of a direct current (DC) mode, a planar mode, an angular mode, etc. Optionally, the first candidate prediction mode list includes at least one intra prediction mode in the MPM list.
[0278] In some embodiments, the first candidate prediction mode list may also include modes such as IBC and palette.
[0279] The present application does not limit the types or number of prediction modes included in the first candidate prediction mode list.
[0280] In some embodiments, the first candidate prediction mode list is determined by at least one of the following ways:
[0281] Method 1: The first candidate prediction mode list includes the setting mode.
[0282] Method 2: The first candidate prediction mode list includes the modes in the MPM list.
[0283] In some embodiments, the first candidate intra-prediction mode list may be the MPM list of the current block, for example, in VVC, the current block may obtain an MPM list of length 6. Furthermore, in subsequent technological advances, there may be a secondary MPM scheme that derives an MPM list of length 22, and the combined length of the first and second MPM lists may be said to be 22. In other words, in embodiments of the present application, an MPM may be used to select an intra-prediction mode.
[0284] In some embodiments, if the candidate prediction mode list determined above does not include the set mode, the set mode is added to the candidate prediction mode list.
[0285] In one example, the set mode is a number of pre-set prediction modes. Optionally, the set mode includes at least one of a DC mode, a horizontal mode, and a vertical mode.
[0286] In another example, an image type corresponding to the current block is determined, and a setting mode is determined based on the image type corresponding to the current block.
[0287] Currently, commonly used image types include I images, B images, and P images. Commonly used slice types include I slices, B slices, and P slices. Taking slice types as an example, the same holds true for image types. I slices can only have intra-coded blocks, while B slices and P slices can have both intra-coded blocks and inter-coded blocks. That is, in I slices, all blocks surrounding the current block are intra-coded blocks, while in B slices and P slices, blocks surrounding the current block can be intra-coded or inter-coded blocks. Therefore, for some intra GPM methods in the present application, more relevant information can be obtained from I slices, such as the intra prediction modes of neighboring blocks. Relevant information obtained from B slices and P slices is relatively limited. Therefore, different rules may be set for different image types.
[0288] For example, when configuring the first candidate prediction mode list, if the image type corresponding to the current block is B type or P type, more setting modes are added, for example, in addition to DC, horizontal mode, and vertical mode, other angle modes such as upper right lateral (mode 2 in VVC), lower left lateral (mode 66 in VVC), and upper left lateral (mode 34 in VVC) are added. Alternatively, different number restrictions on the number of first candidate prediction mode lists are used for blocks of different image types.
[0289] The above method for determining the image type corresponding to the current block may be to determine the image type corresponding to the current block based on the image type of the current image to which the current block belongs or the image type of the current slice to which the current block belongs. For example, the image type of the target image to which the current block belongs or the image type of the current slice to which the current block belongs is determined as the image type corresponding to the current block.
[0290] Optionally, a set mode is added under certain conditions, for example, when the number of candidate prediction modes is equal to or less than a threshold, such as 3, 4, 5, 6, etc.
[0291] Method 3: The first candidate prediction mode list includes a set of first candidate prediction modes determined according to some rule such as equal interval selection.
[0292] Method 4: The first candidate prediction mode list is determined based on the prediction mode used by at least one block adjacent to the current block.
[0293] For example, the first candidate prediction mode list for the current block may be obtained by adding prediction modes used by one or more blocks neighboring the current block to the first candidate prediction mode list, or the first candidate prediction mode list corresponding to the kth prediction mode among the K prediction modes may be obtained, where the kth prediction mode is any one of the K prediction modes.
[0294] Furthermore, for example, a prediction mode corresponding to the k-th prediction mode among prediction modes used by one or more blocks neighboring the current block is added to the first candidate prediction mode list corresponding to the k-th prediction mode. For example, assuming K=2, the k-th prediction mode is the first prediction mode, and two blocks neighboring the current block also perform weighted prediction using two prediction modes. Here, the two prediction modes used by the first neighboring block are prediction mode 1 and prediction mode 3, respectively, and the two prediction modes used by the second neighboring block are prediction mode 4 and prediction mode 5, respectively. Thus, prediction mode 1 and prediction mode 4 can be added to the first candidate prediction mode list corresponding to the first prediction mode.
[0295] Method 5: Determine the image type corresponding to the current block, and determine a first candidate prediction mode list based on the image type corresponding to the current block. For example, if the image type corresponding to the current block is B type or P type, at least one of DC, horizontal mode, vertical mode, and several angle modes may be added to the first candidate prediction mode list. Also, for example, if the image type corresponding to the current block is I type, at least one of DC, horizontal mode, and vertical mode may be added to the first candidate prediction mode list.
[0296] As a method for determining the first candidate prediction mode list, the above methods 1 to 5 may be used alone or in any combination.
[0297] In some embodiments, the first candidate prediction mode list includes at least one of a candidate intra-prediction mode list and a candidate inter-prediction mode list, where the candidate intra-prediction mode list includes at least one candidate intra-prediction mode and the candidate inter-prediction mode list includes at least one candidate inter-prediction mode.
[0298] According to the above method, after obtaining the candidate prediction mode list for the current block, Q prediction modes are determined based on the first candidate prediction mode list, for example, all or some of the Q prediction modes are determined based on all or some of the first candidate prediction modes included in the first candidate prediction mode list.
[0299] The process of determining a prediction mode corresponding to a weight derivation mode will now be described.
[0300] In the embodiments of the present application, the prediction mode corresponding to the weight derivation mode has a general meaning, and may be, for example, a prediction mode corresponding to one preset weight derivation mode or a prediction mode corresponding to multiple preset weight derivation modes. In some embodiments, the prediction mode corresponding to the weight derivation mode may be understood as a prediction mode list corresponding to the weight derivation mode, and the prediction mode list includes at least one prediction mode.
[0301] In some embodiments, the prediction modes corresponding to the weight derivation modes include prediction modes corresponding to at least one weight derivation mode of P weight derivation modes, in which determining the prediction modes corresponding to the weight derivation modes includes determining, for a p-th weight derivation mode of P weight derivation modes, a prediction mode corresponding to the p-th weight derivation mode, and determining the prediction modes corresponding to the weight derivation modes based on the prediction modes corresponding to the at least one weight derivation mode of P weight derivation modes, where p is a positive integer.
[0302] In the embodiment of the present application, the process of determining a prediction mode corresponding to each of the P weight derivation modes is basically the same. For convenience of explanation, the following description will be given taking the p-th weight derivation mode of the P weight derivation modes as an example.
[0303] Here, there are two methods for determining the prediction mode corresponding to the p-th weight derivation mode.
[0304] Method 1: When at least one of the prediction modes corresponding to the p-th weight derivation mode is an intra prediction mode, determine an angle index based on the p-th weight derivation mode, and determine the intra prediction mode corresponding to the angle index as at least one of the prediction modes corresponding to the p-th weight derivation mode.
[0305] The angle index is used to indicate the boundary angle index of the weight.
[0306] In some embodiments, the angle index is represented by the field angleIdx.
[0307] The above Table 2 shows the correspondence between merge_gpm_partition_idx and angleIdx. Referring to the above Table 2, the angle index may be derived based on the p-th weight derivation mode.
[0308] In this application, the angle index has a corresponding relationship with the intra prediction mode, that is, different angle indexes correspond to different intra prediction modes.
[0309] For example, there is a correspondence relationship between the angle index and the intra prediction mode as shown in Table 7.
[0310] [Table 7]
[0311] In method 1, taking K=2 as an example, when the first prediction mode or the second prediction mode is an intra prediction mode, an angle index is determined based on the p-th weight derivation mode, for example, an angle index corresponding to the p-th weight derivation mode is derived in Table 2 above. Then, an intra prediction mode corresponding to the angle index is determined in Table 7 above. For example, when the angle index is 2 and the corresponding intra prediction mode is 42, the intra prediction mode 42 is determined as the first prediction mode or the second prediction mode.
[0312] Method 2: If at least one of the prediction modes corresponding to the p-th weight derivation mode is an intra-prediction mode, determine the intra-prediction mode corresponding to the p-th weight derivation mode, and determine the intra-prediction mode corresponding to the p-th weight derivation mode as at least one of the prediction modes corresponding to the p-th weight derivation mode.
[0313] Here, the intra prediction mode corresponding to the p-th weight derivation mode includes at least one of an intra prediction mode whose prediction direction is parallel to the weight boundary line, an intra prediction mode whose prediction direction is perpendicular to the weight boundary line, and a planar mode.
[0314] Note that the intra prediction modes whose prediction directions are parallel to the weight boundary lines include one or more intra prediction modes whose prediction directions are parallel or nearly parallel to the weight boundary lines, and the intra prediction modes whose prediction directions are perpendicular to the weight boundary lines include one or more intra prediction modes whose prediction directions are perpendicular or nearly perpendicular to the weight boundary lines.
[0315] In this method 2, taking K=2 as an example, when the first prediction mode and / or the second prediction mode are intra prediction modes, the first prediction mode and / or the second prediction mode are determined from the intra prediction mode corresponding to the weight derivation mode. For example, the first prediction mode and / or the second prediction mode may be an intra prediction mode that is collinear or approximately collinear with the weight boundary line (also referred to as the boundary line). Alternatively, the first prediction mode and / or the second prediction mode may be an intra prediction mode whose prediction direction is orthogonal or approximately orthogonal to the weight boundary line. For example, the weight division line is horizontal, and the first prediction mode and / or the second prediction mode are horizontal mode 18 or vertical mode 50, such as the modes with GPM indexes 18, 19, 50, and 51 in FIG. 4.
[0316] The decoding side determines a prediction mode corresponding to at least one of the P weight derivation modes according to the above steps, and thereby determines a prediction mode corresponding to the weight derivation mode based on the prediction mode corresponding to at least one of the P weight derivation modes. For example, all or part of the prediction mode corresponding to at least one of the P weight derivation modes is used as the prediction mode corresponding to the weight derivation mode.
[0317] Furthermore, if there are overlapping prediction modes among the prediction modes corresponding to the P weight derivation modes, the overlapping prediction modes are removed, and the remaining different prediction modes are determined as prediction modes corresponding to the weight derivation modes.
[0318] In the embodiment of the present application, in order to reduce the number of the R second combinations, the prediction modes are selected, specifically, the Q prediction modes are determined according to the above method.
[0319] In some embodiments, the number of the Q prediction modes is limited to reduce the complexity of the decoding side. For example, Q is equal to or less than a first threshold. The present application does not limit the specific value of the first threshold. The value of the first threshold may be determined according to actual needs. For example, the first threshold is 6, and R second combinations are configured by selecting six prediction modes, thereby controlling the number of second combinations.
[0320] In some embodiments, the size of Q may be understood to be related to the size and / or shape of the current block, where the shape of the current block is determined by the aspect ratio of the current block.
[0321] In the case of prediction, when the block is small, similar prediction modes have little difference in the impact on the prediction result, but when the block is large, similar prediction modes have more obvious difference in the impact on the prediction result. Based on this, in the embodiment of the present application, different Q values are set for blocks of different sizes, that is, the larger the block, the larger the Q value is set, and the smaller the block, the smaller the Q value is set.
[0322] In this case, the Q value corresponding to the current block is determined based on the size of the current block. For example, if the size of the current block is greater than the first value, Q is greater than or equal to the second set threshold. Also, for example, if the size of the current block is equal to or less than the first value, Q is less than the third set threshold. The embodiments of the present application do not limit the specific values of the first value, the second predicted threshold, and the third set threshold, and the third set threshold is smaller than the second set threshold.
[0323] The process of determining the P weight derivation modes in S102-A11-1 will be described below.
[0324] In the embodiment of the present application, the method for determining the P weight derivation modes includes at least the following method.
[0325] Method 1: P weight derivation modes are selected from M preset weight derivation modes, where M is a positive integer greater than or equal to P.
[0326] The embodiment of the present application is not limited to the above-mentioned M preset weight derivation modes.
[0327] In some embodiments, the GPM includes 64 weight derivation modes and the AWP includes 56 weight derivation modes. In this embodiment, the M preset weight derivation modes include at least one weight derivation mode among the 64 weight derivation modes included in the GPM or at least one weight derivation mode among the 56 weight derivation modes included in the AWP.
[0328] In some embodiments, the M weight derivation mode of the present application may support more angleIdx or a different angleIdx than VVC. Also, for example, the M weight derivation mode of the present application may support more distanceIdx or a different distanceIdx than VVC.
[0329] In some embodiments, the above M preset weight derivation modes are derived via preset weight derivation modes.
[0330] For example, the embodiment of the present application uses the weight derivation mode corresponding to AWP to determine the M weight derivation modes. Alternatively, the embodiment of the present application may use other methods to derive the M weight derivation modes.
[0331] In some embodiments, if M is equal to P, the M weight derivation modes are determined as the P weight derivation modes.
[0332] In some embodiments, when M is greater than P, in order to further reduce the number of R second combinations, M preset weight derivation modes may be screened, thereby selecting P weight derivation modes from the M preset weight derivation modes to construct the R second combinations.
[0333] In some embodiments, P weight derivation modes are obtained by removing weight derivation modes corresponding to preset division angles and / or preset offset amounts from the M weight derivation modes. In weight derivation modes, the same division angle corresponds to multiple offset amounts. Therefore, as shown in FIG. 16A , weight derivation modes 10, 11, 12, and 13 have the same division angle but different offset amounts. Therefore, some weight derivation modes corresponding to preset offset amounts and / or some weight derivation modes corresponding to preset division angles can be removed. This reduces the total number of possible second combinations and also clarifies the differences between the possible second combinations.
[0334] In some embodiments, the selection conditions corresponding to different blocks may be different. Thus, when determining the P weight derivation modes corresponding to the current block, the selection condition corresponding to the current block is first determined, and the P weight derivation modes are selected from the M weight derivation modes according to the selection condition corresponding to the current block.
[0335] In some embodiments, the selection criteria corresponding to the current block include selection criteria corresponding to the size of the current block and / or selection criteria corresponding to the shape of the current block. When predicting, if the block is small, similar prediction modes have little difference in their impact on the prediction result, but if the block is large, similar prediction modes have more obvious difference in their impact on the prediction result. Based on this, in embodiments of the present application, different P values are set for blocks of different sizes, i.e., a larger P value is set for larger blocks and a smaller P value is set for smaller blocks.
[0336] In some embodiments, the selection condition includes an array including M elements, where the M elements correspond one-to-one to the M weight derivation modes, and an element corresponding to each weight derivation mode is used to indicate whether the weight derivation mode is available. Whether a weight derivation mode is available may be understood as whether the weight derivation mode is available for performing a subsequent second combination test by configuring one of the P weight derivation modes.
[0337] The above array may be one-digit or two-digit values.
[0338] For example, in the case of GPM, there are 64 weight derivation modes, so an array containing 64 elements is set, and the value of each element indicates whether the corresponding weight derivation mode is available. Taking a single-digit value as an example, a specific example of setting the g_sgpm_splitDir array is as follows:
[0339]
number
[0340] However, if the value of g_sgpm_splitDir[x] is 1, it means that the weight derivation mode for index x is available, and if the value of g_sgpm_splitDir[x] is 0, it means that the weight derivation mode for index x is not available.
[0341] In some embodiments, when 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, for the same weight derivation mode, if the filtering condition corresponding to the size of the current block and the filter condition corresponding to the shape of the current block indicate that both of the weight derivation modes are available, the weight derivation mode is determined to be one of the P weight derivation modes, and if at least one of the filter condition corresponding to the size of the current block and the filter condition corresponding to the shape of the current block indicates that the weight derivation mode is unavailable, the weight derivation mode is determined not to constitute the P weight derivation modes.
[0342] In some embodiments, filter conditions corresponding to different block sizes and filter conditions corresponding to different block shapes may be implemented using multiple arrays, respectively.
[0343] In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes may be implemented using a two-digit array, i.e., the two-digit array includes a filter condition corresponding to the block size and a filter condition corresponding to the block shape.
[0344] For example, the sorting conditions corresponding to a block having a size of A and a shape of B are as follows: The sorting conditions are expressed as a two-digit sequence.
[0345]
number
[0346] However, when all values of g_sgpm_splitDir[x] are 1, it indicates that the weight derivation mode for index x is available, and when one of the values of g_sgpm_splitDir[x] is 0, it indicates that the weight derivation mode for index x is unavailable. For example, g_sgpm_splitDir[4]=(1,0) means that weight derivation mode 4 is available for block size A but unavailable for blocks of shape B. Therefore, if the block size is A and the shape is B, the weight derivation mode is unavailable.
[0347] In the above, an example is 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.
[0348] After the decoding side determines Q prediction modes and P weight derivation modes according to the above steps, it forms R different second combinations based on the Q prediction modes and P weight derivation modes, and then determines a first candidate combination list based on the R second combinations, thereby determining a first weight derivation mode and K first prediction modes from the first candidate combination list.
[0349] In some embodiments, to further improve the speed of constructing the first candidate combination list, the decoding side selects the determined Q prediction modes and P weight derivation modes again. In this case, in the above S102-A11-2, R second combinations are constructed based on the determined P weight derivation modes and Q prediction modes, and includes the following steps from S102-A11-21 to S102-A11-23.
[0350] S102-A11-21. Select S weight derivation modes from P weight derivation modes, where S is a positive integer less than or equal to P.
[0351] Specifically, weight derivation modes with low occurrence probability are removed from the P weight derivation modes determined above, and S selected weight derivation modes are obtained.
[0352] Here, the method for selecting S weight derivation modes from P weight derivation modes in the above S102-A11-21 includes, but is not limited to, the following.
[0353] Method 1: For an ith weight derivation mode among the P weight derivation modes, weights on the template of K second prediction modes are determined based on the ith weight derivation mode, where the K second prediction modes are any K prediction modes among the Q prediction modes, where i is a positive integer from 1 to P. If the weight on the template of any one of the K prediction modes is smaller than a first set value, the ith weight derivation mode is removed from the P weight derivation modes, and S weight derivation modes are obtained.
[0354] In this method 1, if the weight of the template derived by a weight derivation mode has little or no effect on the template of a certain prediction mode, that weight derivation mode is not used. For example, weight derivation mode 52 in FIG. 4 (square blocks) reduces the weight on the template of the second prediction mode. Also, for example, weight derivation mode 54 reduces the weight on the template of the second prediction mode to 0. That is, in weight derivation mode 54, the second prediction mode has no effect on the template, and the predicted value of the template is considered to be determined by the first prediction mode. In this case, since the second prediction mode has no effect, such a weight derivation mode needs to be excluded from the P weight derivation modes.
[0355] Note that the same weight derivation mode for blocks of different shapes may have different effects on the two prediction modes. Because the current block may be square or rectangular, its length may be greater than its width, or its width may be greater than its length, and the ratio may be 1:2, 1:4, etc. FIGS. 16A and 16B show weight derivation modes for GPM in 32x64 blocks and 64x32 blocks. It can be seen that the intersection points between the boundary of the same weight derivation mode and the block boundary are different for different shapes. This is because the shape of the block changes, but the angle of the boundary does not change with the change in block shape. As shown in FIG. 16A, in a 32x64 block, the weight derivation mode with index 52 intersects with the template region when the boundary of the weight derivation mode with index 52 is delayed toward the template region of the current block, causing the weight of the second prediction mode in the template to exceed a set value, i.e., indicating that the second prediction mode has an effect on the template. However, as shown in Figure 16B, in a 64x32 block, when the boundary of the weight derivation mode with index 52 is delayed toward the template region of the current block, it does not intersect with the template region, causing the weight in the template of the second prediction mode to become 0, which indicates that the second prediction mode has no effect on the template.
[0356] In the above method 1, among the P weight derivation modes, a weight derivation mode in which the weight in the template of any one of the K prediction modes is less than a first set value is eliminated, and S weight derivation modes are obtained.
[0357] The embodiment of the present application does not limit the specific values that the first setting value can take, and may be, for example, a small value equal to or greater than 0.
[0358] Method 2: For the i-th weight derivation mode among the P weight derivation modes, determine the cost of predicting a template using the i-th weight derivation mode, where i is a positive integer from 1 to P. Based on the cost corresponding to the i-th weight derivation mode, select S weight derivation modes from the P weight derivation modes.
[0359] In the method 2, S weight derivation modes are selected from the P weight derivation modes by calculating the cost corresponding to each weight derivation mode among the P weight derivation modes.
[0360] In the embodiment of the present application, the cost is calculated by combining a weight derivation mode and K prediction modes. For the sake of convenience, the costs of P weight derivation modes are calculated based on the given K prediction modes. That is, the P weight derivation modes are combined with the set K prediction modes to obtain P combinations, and the costs corresponding to each combination in the P combinations are calculated to obtain the costs of the P weight derivation modes.
[0361] For example, if the K given prediction modes are prediction mode 1 and prediction mode 2, for the i-th weight derivation mode among the P weight derivation modes, one combination is formed by the i-th weight derivation mode, prediction mode 1, and prediction mode, and is denoted as combination i. A template for the current block is predicted using combination i to obtain a predicted value of the template for combination i. A prediction distortion cost corresponding to combination i is determined based on the predicted value of the template and the reconstructed value of the template for combination i. The prediction distortion cost corresponding to combination i is determined to be the cost corresponding to the i-th weight derivation mode. In this way, a cost corresponding to any one of the P weight derivation modes can be determined.
[0362] Based on the above method, a cost corresponding to the i-th weight derivation mode among the P weight derivation modes is determined, and then S weight derivation modes are selected from the P weight derivation modes based on the cost corresponding to the i-th weight derivation mode.
[0363] In the method 2, the decoding side selects S weight derivation modes from P weight derivation modes based on the cost corresponding to the i-th weight derivation mode, including the following method.
[0364] In the first method, if the cost corresponding to the i-th weight derivation mode is smaller than a second preset value, a weight derivation mode similar to the i-th weight derivation mode is selected from the P weight derivation modes. S weight derivation modes are determined based on the i-th weight derivation mode and weight derivation modes similar to the i-th weight derivation mode. A weight derivation mode similar to the i-th weight derivation mode is understood to mean a weight derivation mode whose prediction result is similar to the prediction result of the i-th weight derivation mode. For example, a weight derivation mode similar to the i-th weight derivation mode includes a division angle that is close to the division angle of the i-th weight derivation mode and / or an offset amount that is close to the offset amount of the i-th weight derivation mode, where the offset amount of a weight derivation mode is understood to be the intercept of the boundary line of the weight derivation mode in the current block.
[0365] For example, the close division angles may include the division angles being the same and the offset amounts being different, such as in weight derivation mode 11 and weight derivation mode 13 in FIG. 4. For example, the division angles may include the division angles being the same and the offset amounts being similar, such as in derivation mode 11 and weight derivation mode 12 in FIG. 4. For example, the division angles may include the division angles being similar and the offset amounts being different, such as in weight derivation mode 9 and weight derivation mode 11 in FIG. 4. For example, the division angles may include the division angles being similar and the offset amounts being similar, such as in weight derivation mode 9 and weight derivation mode 12 in FIG. 4.
[0366] For example, the close offset amounts include those in which the offset amounts are close and the division angles are the same, as in weight derivation mode 29 and weight derivation mode 30 in FIG. 4, and those in which the offset amounts are the same or close and the division angles are similar, as in weight derivation mode 2 and weight derivation mode 38 in FIG.
[0367] In some embodiments, a weight derivation mode similar to the i-th weight derivation mode is understood as a weight derivation mode whose index approaches the index of the i-th weight derivation mode.
[0368] In the first method, if the cost corresponding to the i-th weight derivation mode is smaller than the second preset value, it means that predicting the current block using the i-th weight derivation mode may achieve a better prediction effect. At this time, the i-th weight derivation mode is selected from the P weight derivation modes and used as the subsequent R second combination. In addition, since a weight derivation mode similar to the i-th weight derivation mode has similar characteristics to the i-th weight derivation mode, the weight derivation mode similar to the i-th weight derivation mode is selected from the P weight derivation modes and used as the subsequent R combination. Next, one weight derivation mode is selected from the remaining weight derivation modes of the P weight derivation modes as a new i-th weight derivation mode, and the above steps are repeated to obtain S weight derivation modes.
[0369] The embodiment of the present application does not limit the magnitude of the second preset value, and it can be specifically determined based on actual needs.
[0370] In some embodiments, the decoding side may also select S weight derivation modes from P weight derivation modes based on the following second scheme.
[0371] In the second method, if the cost corresponding to the i-th weight derivation mode is greater than a third preset value, the i-th weight derivation mode and weight derivation modes similar to the i-th weight derivation mode are eliminated from the P weight derivation modes, and S weight derivation modes are determined based on at least one weight derivation mode after elimination.
[0372] In the second method, if the cost corresponding to the i-th weight derivation mode is smaller than the third preset value, it means that a good prediction effect may not be obtained when predicting the current block using the i-th weight derivation mode. In this case, the i-th weight derivation mode is removed from the P weight derivation modes. Furthermore, since weight derivation modes similar to the i-th weight derivation mode have similar characteristics to the i-th weight derivation mode, the weight derivation modes similar to the i-th weight derivation mode are also removed from the P weight derivation modes. A set of weight derivation modes after the removal is obtained. Next, one weight derivation mode is selected from the set of weight derivation modes after the removal as a new i-th weight derivation mode, and the above steps are repeated to determine S weight derivation modes as the weight derivation modes included in the finally obtained weight derivation mode set.
[0373] The embodiment of the present application does not limit the magnitude of the third preset value, which can be determined based on actual needs.
[0374] Through the above steps, the decoding side selects S weight derivation modes from P weight derivation modes, and then executes the following step S102-A11-22.
[0375] S102-A11-22 selects T prediction modes from the Q prediction modes, where T is a positive integer equal to or less than Q.
[0376] The embodiment of the present application does not limit the method of selecting T prediction modes from Q prediction modes.
[0377] In some embodiments, T pre-set prediction modes are selected from the Q prediction modes.
[0378] In some embodiments, for an i-th prediction mode among the Q prediction modes, the decoding side determines a cost of predicting a template using the i-th prediction mode, where i is a positive integer from 1 to Q. Based on the cost corresponding to the i-th prediction mode, the decoding side selects T prediction modes from the Q prediction modes.
[0379] In the embodiment of the present application, a weight derivation mode and K prediction modes are combined to calculate the cost.Therefore, for the convenience of calculation, the weight derivation mode and other K-1 prediction modes are given, and the costs of Q weight derivation modes are calculated.That is, Q prediction modes are combined with the set weight derivation mode and K-1 prediction modes to obtain Q combinations, and the costs corresponding to each combination in the Q combinations are calculated to obtain the costs of the Q prediction modes.
[0380] For example, suppose that the given K−1 prediction modes are prediction mode 1 and the given weight derivation mode is weight derivation mode 1. For the i-th prediction mode among the Q prediction modes, weight derivation mode 1, the i-th prediction mode, and prediction mode 1 form one combination, which is denoted as combination i. A template for the current block is predicted using combination i to obtain a predicted value of the template for combination i. A prediction distortion cost corresponding to combination i is determined based on the predicted value of the template and the reconstructed value of the template for combination i. The prediction distortion cost corresponding to combination i is determined as the cost corresponding to the i-th prediction mode. In this way, a cost corresponding to any one of the Q prediction modes can be determined.
[0381] Based on the above method, after the cost corresponding to the i-th prediction mode among the Q prediction modes is determined, T prediction modes are selected from the Q prediction modes based on the cost corresponding to the i-th prediction mode.
[0382] The decoding side selects T prediction modes from Q prediction modes based on the cost corresponding to the i-th prediction mode, including the following method.
[0383] In the first method, if the cost corresponding to the i-th prediction mode is smaller than a fourth preset value, a prediction mode similar to the i-th prediction mode is selected from the Q prediction modes. A prediction mode similar to the i-th prediction mode refers to a prediction mode whose prediction result is similar (or close) to the prediction result of the i-th prediction mode. For example, a prediction mode whose prediction direction (or angle) is close to that of the i-th prediction mode, or whose prediction mode index is close to that of the i-th prediction mode. For example, a prediction mode whose index is larger than that of the i-th prediction mode, such as 1 or 2, or a prediction mode whose index is smaller than that of the i-th prediction mode, such as 1 or 2.
[0384] In the first method, if the cost corresponding to the i-th prediction mode is smaller than the fourth preset value, it means that a better prediction effect may be achieved when predicting a current block using the i-th prediction mode. In this case, the i-th prediction mode is selected from the Q prediction modes and used as the subsequent R second combinations. Furthermore, a prediction mode similar to the i-th prediction mode has similar characteristics to the i-th prediction mode, so the prediction mode similar to the i-th prediction mode is selected from the Q prediction modes and used as the subsequent R second combinations. Then, one prediction mode is selected from the remaining Q prediction modes as a new i-th prediction mode, and the above steps are repeated to obtain T prediction modes.
[0385] The embodiment of the present application does not limit the size of the fourth preset value, and it can be determined based on actual needs.
[0386] In a second method, if the cost corresponding to the i-th prediction mode is greater than a fifth preset value, the i-th prediction mode and prediction modes similar to the i-th prediction mode are removed from the Q prediction modes to obtain at least one prediction mode after the removal, and T prediction modes are determined based on the at least one prediction mode after the removal.
[0387] In the second method, if the cost corresponding to the i-th prediction mode is greater than a fifth preset value, it means that a good prediction effect may not be achieved when predicting the current block using the i-th prediction mode. In this case, the i-th prediction mode is removed from the Q prediction modes. Furthermore, since prediction modes similar to the i-th prediction mode have similar characteristics to the i-th prediction mode, the prediction modes similar to the i-th prediction mode are also removed from the Q prediction modes to obtain a set of prediction models after removal. Then, one prediction mode is selected as a new i-th prediction mode from the removed prediction mode set, and the above steps are repeated to determine T prediction modes as the prediction modes included in the finally obtained prediction mode set.
[0388] The embodiment of the present application does not limit the magnitude of the fifth preset value, which can be determined based on actual needs.
[0389] Through the above steps, S weight derivation modes are selected from P weight derivation modes, T prediction modes are selected from Q prediction modes, and the following steps S102-A11-23 are executed.
[0390] S102-A11-23, forming R second combinations based on the S weight derivation modes and the T prediction modes.
[0391] Specifically, one weight derivation mode is selected from S weight derivation modes, K prediction modes are selected from T prediction modes, and the one weight derivation mode and the K prediction modes are used as a second combination. The steps are repeated to obtain R second combinations.
[0392] As can be seen from the above, one second combination includes one weight derivation mode and K prediction modes. In this way, when selecting a prediction mode, if K elements in the combination are fixed, the possible selection of other elements can be limited. For example, when K=2, using two elements in combination can limit the possible selection of one other element.
[0393] When the weight derivation mode and one prediction mode are fixed, the execution process of the above S102-A11-2 will be described below by taking the selection process of another prediction mode as an example.
[0394] In some embodiments, the above step S102-A11-2 includes: for an ith weight derivation mode among the P weight derivation modes, determining a cost of template prediction using the ith weight derivation mode and a jth prediction mode among the Q prediction modes; if the cost corresponding to the combination of the ith weight derivation mode and the jth prediction mode is greater than a sixth preset value, removing the jth prediction mode and a prediction mode similar to the jth prediction mode from the Q prediction modes to obtain at least one prediction mode after the removal, and deriving R second combinations based on the ith weight derivation mode and the at least one prediction mode after the removal.
[0395] In this embodiment, when a weight derivation mode and one prediction mode are fixed, another prediction mode is selected. For example, if a certain intra prediction mode in a certain weight derivation mode cannot obtain a relatively small cost as the first prediction mode, the process of selecting an intra prediction mode similar to the intra prediction mode in the weight derivation mode as the first prediction mode is not attempted.
[0396] Specifically, for the i-th weight derivation mode among the P weight derivation modes, when K=2, the combination includes the i-th weight derivation mode, the first prediction mode, and the second prediction mode. If the second prediction mode is set to prediction mode 1, the prediction mode 1 may be one of the Q prediction modes or a prediction mode other than the Q prediction modes. As a selection that can determine the first prediction mode from the Q prediction modes, specifically, the j-th prediction mode among the Q prediction modes is determined as the first prediction mode. At this time, when the combination j consisting of the i-th weight derivation mode, the j-th prediction mode, and prediction mode 1 predicts the template, a predicted value of the template is determined, and a cost corresponding to the combination j is obtained based on the predicted value, and the cost corresponding to the combination j is determined as the cost corresponding to the j-th prediction mode. Next, it is determined whether the cost corresponding to the j-th prediction mode is greater than a sixth preset value. The combination consisting of the i-th weight derivation mode, the j-th prediction mode, and prediction mode 1 cannot accurately predict the template. At this time, the j-th prediction mode is removed from the Q prediction modes. Since the prediction modes similar to the j-th prediction mode have similar characteristics to the j-th prediction mode, the prediction modes similar to the j-th prediction mode are removed from the Q prediction modes to obtain a set of removed prediction modes. A new prediction mode is selected from the removed prediction mode set as a new j-th prediction mode, and the above steps are repeated to obtain a final removed prediction mode set corresponding to the i-th weight derivation mode.
[0397] The above steps allow the set of prediction modes after final removal corresponding to each of the P weight derivation modes to be determined, so that R second combinations can be constructed based on the P weight derivation modes and their corresponding sets of prediction modes after final removal.
[0398] It should be noted that the above embodiment illustrates a method for selecting prediction modes in a combined manner. Optionally, any one of the weight derivation modes and prediction modes may be selected in a combined manner to form R second combinations.
[0399] After the decoding side determines the R second combinations based on the above method, for any one of the R second combinations, it predicts a template using the weight derivation mode in the second combination and the K prediction modes to obtain a template prediction value corresponding to the second combination.
[0400] The following describes a process of predicting a template for a current block using any second combination to obtain a predicted value of the template.
[0401] First, the weights of the templates are determined using the weight derivation modes included in the second combination.
[0402] Currently, as shown in FIG. 13 above, the template of the current block is the coded area above the current block, or the coded area to the left of the current block, or the coded areas to the left and above the current block.
[0403] In some embodiments, the weight matrix can be extended toward the template region, for example, to the left and top, and the weight matrix is applied to the template to determine the template weight. For example, as shown in FIG. 17, a small rectangular region in the upper left region of the current block can be added to the template, and the template and the current block can be combined to form a rectangle. Of course, only the left and top regions can be used as the template. Take the example of adding the upper left region as shown in FIG. 17. If the regions in the inverted L-shaped frame on the left, upper left, and upper sides are the template region, and the rectangular region on the lower right is the current block, the weight matrix extended to the upper left becomes the weight matrix of the template.
[0404] In some embodiments, the process of deriving the template weight and the process of deriving the predictor weight are combined based on the weight derivation mode, for example, the template weight and the predictor weight are simultaneously derived. For example, the predictor weight is determined by obtaining a first predicted value using a first prediction mode, obtaining a second predicted value using a second prediction mode, determining a weight for the first predicted value based on the weight derivation mode, and determining a second weight for the second predicted value based on the weight derivation mode. The sum of the product of the first predicted value and the first weight and the product of the second predicted value and the second weight is determined as the predicted value of the current block.
[0405] In this application, the first and second weights are referred to as predictor weights to distinguish them from template weights.
[0406] In some embodiments, determining the weights of the templates based on the weight derivation mode includes the following steps.
[0407] Step 1: Determine the angle index and distance index based on the weight derivation mode.
[0408] Step 2: Determine the weight of the template based on the angle index, distance index, and size of the template.
[0409] The present application can derive template weights in the same manner as deriving predictor weights. For example, first, an angle index and a distance index are determined based on a weight derivation mode. The angle index can be understood as the dividing line angle index of each weight derived by the weight derivation mode. For example, the angle index and distance index corresponding to the weight derivation mode can be determined based on Table 2 above. For example, if the weight derivation mode is 27, the corresponding angle index is 12 and the distance index is 3. Next, the template weights are determined based on the angle index, distance index, and template size.
[0410] In the above step 2, the method for determining the weight of the template based on the angle index, distance index, and size of the template includes, but is not limited to, the following methods.
[0411] Method 1: Determine the weight of the template directly based on the angle index, distance index, and template size. At this time, the above step 2 includes the following steps 21 to 23.
[0412] Step 21: Determine a first parameter of a pixel point in the template based on the angle index, distance index and size of the template.
[0413] Step 22: Determine a weight for the pixel point in the template based on the first parameter of the pixel point in the template.
[0414] Step 23: Determine the weight of the template based on the weight of the pixel points in the template.
[0415] In this implementation, weights of pixel points in the template are determined based on the angle index, distance index, template size, and current block size, and a weight matrix composed of the weights of each point in the template is determined as the weight of the template.
[0416] The first parameter herein is used to determine the weight, and in some embodiments, the first parameter is also referred to as a weight index.
[0417] In a possible implementation, the offset amount and the first parameter can be determined as follows.
[0418] The template weight derivation process receives inputs including the width nCbW of the current block, the height nCbH of the current block, the width nTmW of the left template, the height nTmH of the upper template, the GPM "division" angle index variable angleId, the GPM distance index variable distanceIdx, and the component index variable cIdx, as shown in Figure 17. For illustrative purposes, since the present application uses the luminance component as an example, cIdx is set to 0, indicating the luminance component.
[0419] The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor can be derived as follows:
number
number
number
number
number
number
number
number
number
number
number
number
[0420] The template weight matrix wTemplateValue[x][y] (x=-nTmW..nCbw-1, y=-nTmH..nCbH-1, and cases where both x and y are 0 or greater are excluded) is derived using the following method, assuming that the coordinates of the upper left corner of the current block are (0,0). The variables xL and yL are derived as follows:
number
number
number
[0421] In the present application, the method of determining the weight of the pixel point in the template based on the first parameter of the pixel point in the template in step 22 includes, but is not limited to:
[0422] Method 1: Determine a second parameter of the pixel point in the template based on a first parameter of the pixel point in the template, and determine a weight of the pixel point in the template based on the second parameter of the pixel point in the template.
[0423] The second parameter is also used to determine the weight, which in some embodiments is also referred to as a weight index on the first component, which may be a luminance component, a chrominance component, etc.
[0424] For example, the weights of the pixel points in the template are determined based on the following formula:
number
number
[0425] Method 2: Determine the weight of the pixel point in the template based on the first parameter, the first threshold, and the second threshold of the pixel point in the template.
[0426] In order to reduce the complexity of calculating the weights of the template, in Method 2, the weights of pixel points in the template are limited to either the first threshold or the second threshold, thereby reducing the complexity of calculating the weights of the template by limiting the weights of pixel points in the template to either the first threshold or the second threshold.
[0427] The present application does not limit the specific values that the first threshold value and the second threshold value can take.
[0428] Optionally, the first threshold is one.
[0429] Optionally, the second threshold is zero.
[0430] In one example, the weight of a pixel point in a template can be determined by the following formula:
number
[0431] The first method determines the weight of each point in the template using the weight derivation mode, and the weight matrix formed by the weights of each point in the template is used as the weight of the template.
[0432] Method 2 determines the weights of the current block and the template based on the weight derivation mode. That is, in Method 2, 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. Based on this, the above step 2 includes the following steps 2-1 and 2-2.
[0433] Step 2-1: Determine the weights of the 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.
[0434] Step 2-2: Determine the weight of the template based on the size of the template and the weight of the pixel points in the merged region.
[0435] In Method 2, the current block and the template are treated as a whole, and the weights of the 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 the current block. Then, the weights corresponding to the template in the merged region are determined as the template weights based on the template size. For example, as shown in Figure 17, the weights corresponding to the L-shaped template region in the merged region are determined as the template weights.
[0436] In the second method, the weight determination process not only determines the weight of the template, but also determines the weight of the remaining predicted value after removing the weight of the template from the weight corresponding to the merged region. By performing the subsequent prediction process based on the weight of the predicted value, it is not necessary to re-determine the weight of the predicted value, reducing the number of prediction steps and improving prediction efficiency.
[0437] The present application does not limit the specific implementation method for determining the weight 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.
[0438] In some embodiments, determining the weights of the pixel points in the merged region in step 2-1 above includes steps 2-11 to 2-12 below.
[0439] Step 2-11: Determine a first parameter of the pixel point in the merged region based on the angle index, the distance index, and the size of the merged region.
[0440] Step 2-12: Determine weights of the pixel points in the merged region based on the first parameters of the pixel points in the merged region.
[0441] In this implementation, the weights of the pixel points in the merged region and the weight matrix consisting of the weights of each point in the merged region are determined based on the angle index, distance index, and size of the merged region.
[0442] In a possible implementation, the offset amount and the first parameter can be determined as follows.
[0443] The inputs for the merge region weight derivation process are as follows: width nCbW of the current block, height nCbH of the current block, width nTmW of the left template, height nTmH of the upper template, "split" angle index variable angleId of the GFM, distance index variable distanceIdx of the GPM, and component index variable cIdx, as shown in Figure 17. For example, taking the luminance component as an example in this application, cIdx is 0, which indicates the luminance component.
[0444] The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor can be derived as follows:
number
number
number
number
number
number
number
number
number
number
number
number
number
number
[0445] The first parameter weightIdx is derived in the following manner.
number
[0446] In the present application, in the above step 2-12, the method for determining the weight of the pixel point in the merged region based on the first parameter of the pixel point in the merged region includes, but is not limited to:
[0447] Method 1: Determine the second parameters of the pixel points in the merged region based on the first parameters of the pixel points in the merged region, and determine the weights of the pixel points in the merged region based on the second parameters of the pixel points in the merged region.
[0448] For example, the weights of the pixel points in the merged region are determined based on the following formula:
number
number
number
[0449] Method 2: Determine the weight of the pixel point in the merged region based on the first parameter, the first threshold value, and the second threshold value of the pixel point in the merged region.
[0450] Illustratively, the weight of the pixel point in the merged region is the first threshold or the second threshold.
[0451] In order to reduce the complexity of calculating the weight of the merged region, in Method 2, the weight of the pixel point in the merged region is limited to the first threshold or the second threshold. In other words, the merged region is either the first threshold or the second threshold, so the complexity of calculating the weight of the merged region is reduced.
[0452] The present application does not limit the specific values that the first threshold value and the second threshold value can take.
[0453] Optionally, the first threshold is one.
[0454] Optionally, the second threshold is zero.
[0455] In one example, the weight of a pixel point in the merged region can be determined by the following formula:
number
[0456] In the second method, the weight of each point in the merged region formed by the current block and the template is determined by the weight derivation mode, and the weight corresponding to the template in the merged region is determined as the template weight according to the size of the template. In the second method, the weight of the predicted value is also determined at the same time, eliminating the need to perform a subsequent step of determining the weight of the predicted value, thereby reducing the prediction step and improving prediction efficiency.
[0457] Based on the above method, the weights of the templates corresponding to the weight derivation modes included in the second combination are determined, and then the K prediction modes of the second combination are used to predict the templates to obtain K predicted values, and the K predicted values are weighted based on the weights of the templates to obtain predicted values of the templates.
[0458] However, the predicted values of a template can be understood as a matrix made up of predicted values of pixel points within the template.
[0459] In some embodiments, the predicted values are also referred to as predicted samples.
[0460] Next, a cost for the second combination is determined based on the predicted and reconstructed values of the template.
[0461] Such methods for determining the cost of the second combination include, but are not limited to, the following:
[0462] Method 1: Determine the cost of the second combination in the form of a matrix. Specifically, a loss is determined based on the predicted value and reconstructed value of the template, and this loss is represented as the first loss. Because the predicted value and reconstructed value of the template are matrices, the first loss is also a matrix. For example, the absolute value of the difference between the predicted value and reconstructed value of the template is determined as the first loss, and the first loss is determined as the cost of the second combination.
[0463] Method two is to use a point-by-point calculation to determine the cost of the second combination.
[0464] Specifically, for the i-th pixel point of the template, when each prediction mode of the K prediction modes of the second combination determines a prediction for the i-th pixel point, a template weight corresponding to the i-th pixel point in the template weights is determined. A predicted value for the i-th pixel point is obtained based on the template weight for the i-th pixel point and the K predicted values for the i-th pixel point. A cost of the second combination for the i-th pixel point is obtained based on the predicted value and reconstructed value for the i-th pixel point. Using this method, a predicted distortion cost of the second combination for each pixel point in the template can be determined. Finally, the cost of the second combination is determined as the cumulative sum of the predicted distortion costs of the second combination for each pixel point in the template.
[0465] Based on the above method, the cost of each second combination among the R second combinations can be determined.
[0466] Next, a first candidate combination list is constructed based on the cost of each second combination among the R second combinations.
[0467] For example, the R second combinations are sorted in ascending order based on the magnitude of the cost of the second combination, and the sorted R second combinations are determined as the first candidate combination list.
[0468] As another example, based on the magnitude of the cost of the second combination, N second combinations with the smallest cost are selected from the R second combinations to form a first candidate combination list.
[0469] Optionally, N is 8, 16, or 32, etc.
[0470] According to the above method, each first candidate combination list in the first candidate combination list is sorted in ascending order based on the magnitude of the cost. Illustratively, the first candidate combination list is shown in Table 6 above.
[0471] In this way, the decoding side checks the first candidate combination corresponding to the first index in the first candidate combination list shown in Table 6 based on the first index, and determines the first candidate combination corresponding to the first index as the first combination. That is, the weight derivation mode included in the first candidate combination is determined as the first weight derivation mode, and the K prediction modes included in the first candidate combination are determined as the K first prediction modes.
[0472] In the above case 1, the first combination including the first weight derivation mode and K first prediction modes is taken as an example to introduce the implementation process of the above S102.
[0473] In Case 2, the first combination includes a first weight derivation mode, K first prediction modes, and a second blending parameter.
[0474] As shown in FIGS. 4 and 5, there is a blending region near the weight division line, i.e., the gray region in FIGS. 4 and 5. The blending region corresponds to a blending parameter. That is, the blending parameter represents the blending region in the weight diagram. In some cases, the blending parameter may affect the weight. Therefore, in this embodiment, a predicted value of the current block is determined based on a second blending parameter, a first weight derivation mode, and K first prediction modes. In this case, the first combination in this embodiment includes a first weight derivation mode, K first prediction modes, and a second blending parameter.
[0475] In the case 2, the method for realizing the above S102 includes, but is not limited to, the following methods.
[0476] In Scheme 1, the encoding side and the decoding side determine a first combination corresponding to a first index from a plurality of preset second candidate combinations. For example, the preset plurality of second candidate combinations may include any number of second candidate combinations, such as two, three, four, five, six, seven, eight, or nine. If eight second candidate combinations are included, each second candidate combination includes one weight derivation mode, K prediction modes, and one blending parameter, and these eight second candidate combinations have different identifiers (or indexes). Thus, after obtaining a first index, the decoding side collates the second candidate combination corresponding to the first index from the plurality of second candidate combinations, determines the second candidate combination corresponding to the first index as the first combination, determines the K prediction modes included in the second candidate combination as the K first prediction modes, and determines the blending parameters included in the second candidate combination as the second blending parameters.
[0477] In method 2, both the decoding side and the encoding side determine a list containing multiple second candidate combinations. Therefore, this list is also called a second candidate combination list, and a first combination corresponding to a first index is determined from the second candidate combination list. At this time, the above step S102 includes the following steps:
[0478] S102-C, determining a second candidate combination list.
[0479] S102-D: The weight derivation mode, K prediction modes, and blending parameters included in the second candidate combination corresponding to the first index of the second candidate combination list are determined as a first weight derivation mode, K first prediction modes, and second blending parameters, respectively.
[0480] The second candidate combination list includes a plurality of second candidate combinations, and any one of the plurality of second candidate combinations includes one weight derivation mode, K prediction modes, and one blending parameter.
[0481] For example, the second candidate combination list is shown in Table 8.
[0482] [Table 8]
[0483] As shown in Table 8, the second candidate combination list includes a plurality of second candidate combinations. Any two of the plurality of second candidate combinations are not completely identical, that is, at least one of the weight derivation mode, the K prediction modes, and the blending parameter included in any two second candidate combinations is different.
[0484] For example, in Table 8 above, the order of the second candidate combination in the second candidate combination list is used as the index. Optionally, the index of the second candidate combination in the second candidate combination list can be reflected in other ways. However, the embodiment of the present application is not limited thereto.
[0485] In Scheme 2, the decoding side decodes the codestream to obtain a first index, determines the second candidate combination list shown in Table 8, and checks the second candidate combination list based on the first index to obtain the first weight derivation mode, K prediction modes, and one blending parameter included in the first combination indicated by the first index.
[0486] For example, the first index is index 1. In the second candidate combination list shown in Table 8, the second candidate combination corresponding to index 1 is second candidate combination 2. The decoding side determines the weight derivation mode, K prediction modes, and blending parameters included in second candidate combination 2 as the first weight derivation mode, K first prediction modes, and second blending parameters included in the first combination. The current block is predicted using the first weight derivation mode, the second blending parameter, and the K first prediction modes to obtain a predicted value of the current block.
[0487] In this method, the encoding side and the decoding side can each determine the same second candidate combination list. For example, the encoding side and the decoding side each determine a list including L second candidate combinations, each including one weight derivation mode, K prediction modes, and one blending parameter. In the codestream, the encoding side only needs to write one finally selected second candidate combination, for example, the first combination. The decoding side analyzes the finally selected first combination, specifically, decodes the codestream to obtain a first index, and determines the first combination according to the first index in the second candidate combination list determined by the decoding side.
[0488] The embodiment of the present application does not limit the specific method by which the decoding side determines the second candidate combination list.
[0489] In some embodiments, the second candidate combination list is pre-existing, and after decoding the codestream to obtain the first index, the decoding side can obtain or read the second candidate combination list based on the first index, and then match the second candidate combination corresponding to the first index in the second candidate combination list based on the first index.
[0490] In some embodiments, the second candidate combination list is transmitted by the encoding side to the decoding side, for example, the encoding side transmits it to the decoding side before encoding the current block.
[0491] In some embodiments, the second candidate combination list is uploaded to the cloud by the encoding side, and the decoding side reads the second candidate combination list from the cloud after decoding the codestream to obtain the first index.
[0492] In some embodiments, the second candidate combination list is configured by a decoding side, for example, the decoding side decodes the codestream to obtain the first index, and then configures the second candidate combination list in response to the first index.
[0493] The embodiment of the present application does not limit the method by which the decoding side constructs the second candidate combination list, for example, by analyzing the occurrence probability of each combination formed by different weight derivation modes, different prediction modes, and different blending parameters using information related to the current block, and constructing the second candidate combination list based on the magnitude of the occurrence probability of each combination.
[0494] Optionally, the information related to the current block includes mode information of the blocks surrounding the current block, reconstructed pixel points of the current block, and so on.
[0495] In some embodiments, the decoding side constructs the second candidate combination list by the following steps S102-C1.
[0496] S102-C1, constructing a second candidate combination list based on the template of the current block.
[0497] Template matching uses the correlation between neighboring pixel points to select a region surrounding the current block as a template. When the current block is coded or decoded, its left and upper sides are already coded based on the coding order. Inter prediction finds the best matching position of the template in the reference frame and determines the motion information or motion vector of the current block. In intra prediction, the template is used to determine the intra prediction mode of the current block.
[0498] The template of the current block is configured by the reconstructed area around the current block and has a relationship with the current block. Based on this, the embodiment of the present application configures a second candidate combination list based on the template of the current block.
[0499] The present application does not limit the specific shape of the block template.
[0500] In some embodiments, the template includes at least one of the top coded region, the left coded region, and the top left coded region of the current block.
[0501] Optionally, the width of the top coded region is the same as the width of the current block. The height of the left coded region is the same as the height of the current block. The width of the top-left coded region is the same as the width of the left coded region. The height of the top-left coded region is the same as the height of the top coded region.
[0502] For example, for each combination, the combination is used to predict the template of the current block, and the predicted value of the template of each combination is obtained, and a second candidate combination list is constructed based on the predicted value of the template of each combination.
[0503] For each combination, the template of the current block is predicted using the combination, a cost corresponding to each combination is obtained, and a second candidate combination list is constructed based on the cost corresponding to each combination. Exemplarily, a template is predicted based on one weight derivation mode, one blending parameter, and K prediction modes included in the combination, and a template prediction value corresponding to the combination is obtained. For example, the weight derivation mode included in the combination is used to derive the template weight, and the blending parameter in the combination is used to adjust the template weight to obtain the adjusted template weight. The template is predicted using the K prediction modes included in the combination to obtain K prediction values of the template. The K prediction values of the template are weighted based on the adjusted template weight to obtain a prediction value of the template for the combination. Finally, a cost corresponding to the combination is determined based on the prediction value of the template for the combination and the reconstruction value of the template.
[0504] The weights derived based on the weight derivation mode may be understood as weights corresponding to each pixel point in the derived template or as a weight matrix corresponding to the derived template. Adjusting the weights of the template using the blending parameters can be understood as adjusting the weights corresponding to each pixel point in the template or adjusting the weight matrix of the template. When determining a predicted value of the template based on the adjusted weights of the template, K predicted values corresponding to each pixel point in the template can be determined, and a predicted value corresponding to each pixel point can be obtained based on the K predicted values corresponding to each pixel point, whereby the predicted value of the template constitutes the predicted value of the template. Optionally, determining a predicted value of the template based on the adjusted weights can be performed on a block-by-block basis. For example, a predicted value of the template is determined, and the K predicted values of the template are weighted based on the adjusted weights of the template to obtain the predicted value of the template.
[0505] In some embodiments, S102-C1 includes the following steps S102-C11-S102-C13.
[0506] S102-C11 determines H third combinations, where any one of the H third combinations includes one weight derivation mode, K prediction modes, and one blending parameter, where at least one of the weight derivation mode, the K prediction modes, and the blending parameter included in any two of the H third combinations are not completely identical, and H is a positive integer greater than 1.
[0507] S102-C12, for any one of the H third combinations, determine a cost corresponding to the third combination when predicting a template using one weight derivation mode, K prediction modes, and one blending parameter in the third combination.
[0508] S102-C13, constructing a second candidate combination list based on the cost corresponding to each third combination among the H third combinations.
[0509] In this embodiment, when constructing a second candidate combination list, the decoding side first determines H third combinations. However, the present application does not limit the specific values of the H third combinations, such as 8, 16, and 32. Each third combination includes one weight derivation mode, K prediction modes, and one blending parameter. The weight derivation modes included in any two of the H third combinations are not completely identical to at least one of the K prediction modes and blending parameters. Next, for each third combination among the H third combinations, a cost corresponding to the third combination is determined when predicting a template for a current block using the weight derivation mode, K prediction modes, and blending parameters included in the third combination. Finally, a second candidate combination list is constructed based on the costs corresponding to each combination among the H third combinations.
[0510] In some embodiments, in the above S102-C12, determining a cost corresponding to the third combination when predicting a template using one weight derivation mode, K prediction modes, and one blending parameter in the third combination includes at least the following method:
[0511] Method 1, S102-C12 includes the following S102-C12-11 to S102-C12-14.
[0512] S102-C12-11, determining the weight of the template based on the weight derivation mode and blending parameters included in the third combination.
[0513] S102-C12-12, predicting a template according to the K prediction modes in the third combination, and obtaining K predicted values of the template.
[0514] S102-C12-13, weighting the K predicted values of the templates according to the weights of the templates to obtain a template predicted value corresponding to a third combination.
[0515] S102-C12-14, determining a cost corresponding to the third combination based on the template prediction value and the template reconstruction value corresponding to the third combination.
[0516] In the embodiment of the present application, the process of determining the cost corresponding to each combination in the H third combinations is the same. For convenience of explanation, one third combination among the H third combinations will be taken as an example.
[0517] In an embodiment of the present application, the third combination includes one weight derivation mode, one blending parameter, and K prediction modes. When predicting a template using the third combination, the weights of the template are determined based on the weight derivation mode and blending parameter included in the third combination, and K predicted values of the template are obtained based on the K prediction modes included in the third combination. Next, the K predicted values of the template are weighted using the template weights to obtain K predicted values of the template corresponding to the third combination. Finally, a cost corresponding to the third combination is determined based on the template predicted values and the reconstructed values of the template corresponding to the third combination.
[0518] In the embodiment of the present application, the blending parameter is used to adjust the weight derived from the weight derivation mode. Therefore, in the embodiment of the present application, in the above S102-C12-11, determining the weight of the template based on the weight derivation mode and blending parameter included in the third combination includes at least the following ways:
[0519] Example 1: When deriving template weights using the first weight derivation mode, multiple intermediate variables must be determined. Blending parameters are used to adjust one or more of the intermediate variables, and the adjusted variables are used to derive a template. For example, blending parameters are used to adjust one or more of displacementX, displacementY, partFlip, shiftHor, offsetX, offsetY, xL, yL, and other variables to obtain template weights.
[0520] Example 2: Determine a third weight corresponding to the template based on the weight derivation mode of the third combination and the template, adjust the third weight using the blending parameters in the third combination to obtain the adjusted third weight, and determine the weight of the template based on the adjusted third weight.
[0521] For example, based on the weight derivation mode and the template in the third combination, determine that the third weight corresponding to the template is weightIdx, then use the blending parameter to adjust weightIdx to obtain the adjusted weightIdx, and then determine the weight wVemplateValue of the template based on the adjusted weightIdx.
[0522] In one example, the blending parameters can be used to adjust weightIdx based on the following formula to obtain the adjusted weightIdx:
[0523] weightIdx=weightIdx×blendingCoeff
[0524] Here, blendingCoeff is a blending parameter included in the third combination.
[0525] As another example, based on the weight mode and template of the third combination, a third weight corresponding to the template is determined as wVemplateValue, and then the blending parameter is used to adjust the wVemplateValue to obtain an adjusted wVemplateValue, and the adjusted wVemplateValue is determined as the weight of the template.
[0526] In one example, the blending parameters can be used to adjust the wVemplateValue based on the following equation to obtain an adjusted wVemplateValue:
[0527] wVemplateValue=wVemplateValue×blendingCoeff
[0528] Based on the above method, a template weight corresponding to each combination in the H third combinations can be determined. Next, for each third combination, a template is predicted using the K prediction modes included in the third combination to obtain K predicted values of the template. The template weight corresponding to the third combination is used to weight the K predicted values of the template corresponding to the combination to obtain a template predicted value corresponding to the third combination. A cost corresponding to the third combination is determined based on the template predicted value corresponding to the third combination and the reconstructed template value. Methods for determining the cost corresponding to the third combination include, but are not limited to, SAD, SATD, SEE, etc. Using this method, a template predicted value corresponding to each combination in the H third combinations can be determined. Next, a second candidate combination list is constructed based on the template predicted values corresponding to each combination in the H third combinations.
[0529] Method 2, S102-C12 includes the following S102-C12-11 to S102-C12-14.
[0530] S102-C12-21, determining template prediction values corresponding to the K prediction modes in the third combination according to the weight derivation modes and blending parameters in the third combination.
[0531] S102-C12-22, determining costs corresponding to the K prediction modes in the third combination according to the template prediction values and template reconstruction values corresponding to the K prediction modes in the third combination.
[0532] S102-C12-23: Determine a cost corresponding to the third combination based on the costs corresponding to the K prediction modes in the third combination, for example, determine the total of the costs corresponding to the K prediction modes in the third combination as the cost corresponding to the third combination.
[0533] For example, if K=2, the two prediction modes included in the third combination are represented as prediction mode 1 and prediction mode 2, respectively. First, a combination of template weights and predicted values corresponding to prediction mode 1 is determined based on the weight derivation mode and blending parameters included in the third combination. The template weights corresponding to prediction mode 1 are used to process the predicted values corresponding to prediction mode 1. For example, for each pixel point in the template corresponding to prediction mode 1, the predicted value of the pixel point in the template corresponding to prediction mode 1 is multiplied by the weight of the template corresponding to the pixel point to obtain the predicted value of the pixel point. This allows the template predicted value corresponding to prediction mode 1 to be determined, and then a cost corresponding to prediction mode 1 is determined based on the template predicted value and template reconstruction value corresponding to prediction mode 1. Here, methods for determining the cost corresponding to prediction mode 1 include, but are not limited to, SAD, SATD, SEE, etc. Similarly, a cost corresponding to prediction mode 2 can be determined. Then, a cost corresponding to the third combination is determined based on the cost corresponding to prediction mode 1 and the cost corresponding to prediction mode 2. For example, the cost corresponding to prediction mode 1 and the cost corresponding to prediction mode 2 are added together to determine the cost corresponding to the third combination.
[0534] In the above S102-C13, the method of constructing the second candidate combination list based on the cost corresponding to each combination in the H third combinations includes, but is not limited to:
[0535] Example 1: The H third combinations are sorted based on the costs corresponding to each combination in the H third combinations, and the sorted H third combinations are determined as a second candidate combination list.
[0536] The second candidate combination list generated in Example 1 includes H second candidate combinations.
[0537] Optionally, the H second candidate combinations in the second candidate combination list are sorted in ascending order based on cost, that is, the costs corresponding to the H second candidate combinations in the second candidate combination list increase sequentially according to order.
[0538] Sorting the H third combinations based on the cost corresponding to each third combination within the H third combinations may involve sorting the H third combinations in order of decreasing cost.
[0539] Example 2: Based on the costs corresponding to the third combinations, L third combinations are selected from H third combinations, and a list consisting of these L third combinations is determined as a second candidate combination list.
[0540] Optionally, the L third combinations are, for example, the L third combinations that have the smallest costs among the H third combinations based on the costs corresponding to each combination in the H third combinations, and the second candidate combination list includes the L second candidate combinations.
[0541] Optionally, the L second candidate combinations in the second candidate combination list are sorted in ascending order based on cost, that is, the costs corresponding to the L second candidate combinations in the second candidate combination list increase sequentially according to order.
[0542] The process of determining the H third combinations in S102-C11 above will be described below.
[0543] In some embodiments, the H third combinations are preset. Accordingly, a template for the current block is predicted using each combination in the preset H third combinations to obtain a template prediction value corresponding to each third combination. Then, the template prediction value corresponding to each third combination is obtained, and a cost corresponding to each third combination is determined according to the template reconstruction value. The H third combinations are sorted according to the cost corresponding to each third combination, and the sorted H third combinations are used as a second candidate combination list. Alternatively, the L combinations with the smallest costs are selected from the sorted H third combinations to form the second candidate combination list.
[0544] In some embodiments, S102-C11 includes the following steps:
[0545] S102-C11-1 determines F weight derivation modes, J prediction modes, and W blending parameters, where F and W are both positive integers, and J is a positive integer greater than or equal to K.
[0546] S102-C11-2, H third combinations are determined based on the F weight derivation modes, the J prediction modes, and the W blending parameters, where any one of the H third combinations includes one weight derivation mode of the F weight derivation modes, K prediction modes of the J prediction modes, and one blending parameter of the W blending parameters.
[0547] In this embodiment, the decoding side first determines F weight derivation modes, J prediction modes, and W blending parameters, and then configures a third blending parameter according to the determined F weight derivation modes, J prediction modes, and W weight derivation modes.
[0548] The embodiments of the present application are not limited to a specific number of the F weight derivation modes, J prediction modes, and W blending parameters.
[0549] If K=2, the K prediction modes include the first prediction mode and the second prediction mode, and if all possible prediction modes are J types, the first prediction mode has J types, and the second prediction mode is different from the first prediction...
Claims
1. 1. A video decoding method comprising: decoding the codestream to obtain a first index, the first index being used to indicate a first combination, the first combination including one first weight derivation mode and K first prediction modes, where K is a positive integer greater than 1; determining a first weight derivation mode and K first prediction modes included in the first combination based on the first index; predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block; 10. A video decoding method comprising:
2. The step of determining a first weight derivation mode and K first prediction modes included in the first combination based on the first index includes: determining a first candidate combination list, the first candidate combination list including a plurality of first candidate combinations, and any one of the plurality of first candidate combinations including one weight derivation mode and K prediction modes; determining a weight derivation mode and K prediction modes included in a first candidate combination corresponding to the first index in the first candidate combination list as the first weight derivation mode and the K first prediction modes, 2. The method of claim 1 .
3. The step of determining the first candidate combination list includes: constructing the first candidate combination list; 3. The method of claim 2.
4. The step of constructing the first candidate combination list includes: constructing the first candidate combination list based on a template of the current block; 4. The method of claim 3.
5. The step of constructing the first candidate combination list based on the template of the current block includes: determining R second combinations, where any one of the R second combinations includes one weight derivation mode and K prediction modes, and the weight derivations and K prediction modes included in any two of the R second combinations are not identical, and R is a positive integer greater than 1; determining a template prediction value corresponding to any one of the R second combinations when predicting the template using a weight derivation mode in the second combination and K prediction modes; and configuring the first candidate combination list based on template prediction values corresponding to each second combination among the R second combinations.
5. The method of claim 4.
6. The step of constructing the first candidate combination list based on template prediction values corresponding to each second combination among the R second combinations includes: determining a cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination; and configuring the first candidate combination list based on a cost corresponding to each of the R second combinations.
6. The method of claim 5.
7. When the template predicted values corresponding to the second combination include template predicted values corresponding to K prediction modes in the second combination, determining a cost corresponding to the second combination based on the template predicted values corresponding to the second combination and the reconstructed values of the template includes: determining costs corresponding to the K prediction modes in the second combination based on template predicted values and template reconstructed values corresponding to the K prediction modes in the second combination; determining a cost corresponding to the second combination based on costs corresponding to the K prediction modes in the second combination, 7. The method of claim 6.
8. The step of determining a cost corresponding to the second combination based on costs respectively corresponding to the K prediction modes in the second combination includes: determining a sum of costs corresponding to the K prediction modes in the second combination as a cost corresponding to the second combination, 8. The method of claim 7.
9. The first combination further includes a second blending parameter, and the step of predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block includes: predicting the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block; 2. The method of claim 1 .
10. predicting the current block based on the second blending parameter, the first weight derivation mode, and the K first prediction modes to obtain a predicted value of the current block, determining weights for the prediction values based on the first weight derivation mode and the second blending parameter; determining K predicted values based on the K first prediction modes; weighting the K predicted values based on the weights of the K predicted values to obtain a predicted value of the current block; 10. The method of claim 9.
11. 1. A video encoding method comprising: determining a first combination, the first combination including a first weight derivation mode and K first prediction modes; predicting a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block; obtaining a codestream based on the predicted value of the current block, the codestream including a first index, the first index being used to indicate the first combination; 10. A video encoding method comprising:
12. 1. A video decoding device, comprising: a decoding unit for decoding the codestream and obtaining a first index, the first index being used to indicate a first combination, the first combination including one first weight derivation mode and K first prediction modes, where K is a positive integer greater than 1; a determining unit for determining a first weight derivation mode and K first prediction modes included in the first combination based on the first index; a prediction unit configured to predict a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block; A video decoding device comprising:
13. 1. A video encoding device, comprising: a determining unit for determining a first combination, the first combination including a first weight derivation mode and K first prediction modes; a prediction unit that predicts a current block based on the first weight derivation mode and the K first prediction modes to obtain a predicted value of the current block; a coding unit for obtaining a codestream based on the predicted value of the current block, the codestream including a first index, the first index being used to indicate the first combination; 1. A video encoding device comprising:
14. A computer-readable storage medium, comprising: The computer-readable storage medium has stored thereon a computer program and a codestream, the computer program, when executed by a processor, performing the steps of the video encoding method of claim 11 to generate the codestream. A computer-readable storage medium comprising:
Citation Information
Patent Citations
Image encoding / decoding method and device
JP2019535211A
Geometric partition mode with simplified motion field storage and motion compensation in video coding
US20210092392A1
Method and apparatus for motion information storage
WO2021037337A1