Video coding and decoding method, device, equipment, system and storage medium

CN119032568APending Publication Date: 2024-11-26GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280094792.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

When existing video encoding and decoding technology uses multiple prediction modes, the encoding cost is high, and the decoding complexity increases, making it difficult to effectively reduce it.

Method used

The weight derivation mode and K prediction modes are used as a combination, and the mode used by the current block is indicated in the code stream in the form of combination, and the first index is used to instruct the decoder to determine the weight derivation mode and prediction mode, thereby simplifying the syntax and reducing code characters to improve coding efficiency.

Benefits of technology

It reduces the encoding cost, simplifies the decoding process, improves encoding efficiency, reduces the amount of information in the code stream, and improves the overall performance of video encoding and decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119032568A_ABST
    Figure CN119032568A_ABST
Patent Text Reader

Abstract

The invention provides a video encoding and decoding method, device, equipment, system and storage medium, a weight export mode and K prediction modes are used as a combination, so that the weight export mode and the K prediction modes used by a current block are indicated in a code stream in a combination form, at the moment, a decoding end obtains a first index by decoding the code stream, and the first index is used for decoding the current block. The first index is used for indicating a first combination composed of a weight derivation mode and K prediction modes, determining a first weight derivation mode and K first prediction modes included in the first combination according to the first index, and predicting the current block according to the first weight derivation mode and the K first prediction modes, according to the method, the first weight export mode and the K first prediction modes corresponding to the current block are indicated in a combined mode, so that grammar becomes simpler, code words are saved, judgment of various conditions is not needed, and then the coding efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Video encoding and decoding methods, devices, equipment, systems, and storage media Technical Field This application relates to the field of video encoding and decoding technology, and in particular to a video encoding and decoding method, apparatus, device, system, and storage medium. Background Technology Digital video technology can be integrated into various video devices, such as digital televisions, smartphones, computers, e-readers, and video players. With the development of video technology, the amount of data contained in video data has become increasingly large. To facilitate the transmission of video data, video devices implement video compression technology to enable more efficient transmission or storage of video data. Because video contains temporal or spatial redundancy, prediction can eliminate or reduce this redundancy, improving compression efficiency. Currently, to improve prediction performance, multiple prediction modes can be used to predict the current block. However, using multiple prediction modes for the current block requires transmitting more information in the bitstream, thus increasing encoding costs. Summary of the Invention This application provides a video encoding / decoding method, apparatus, device, system, and storage medium that can reduce encoding costs. In a first aspect, this application provides a video decoding method applied to a decoder, comprising: Decode the bitstream to obtain a first index, which indicates a first combination consisting of a weighted derived mode and K prediction modes, where K is a positive integer greater than 1; Based on the first index, determine the first weighted derived pattern and K first prediction patterns included in the first combination; The current block is predicted based on the first weighted derivation pattern and the K first prediction patterns to obtain the predicted value of the current block. Secondly, embodiments of this application provide a video encoding method, including: Determine a first combination, which includes a first weighted derived pattern and K first prediction patterns; The current block is predicted based on the first weighted derivation mode and the K first prediction modes to obtain the predicted value of the current block; A bitstream is obtained based on the predicted value of the current block, and the bitstream includes a first index, which is used to indicate the first combination. Thirdly, this application provides a video decoding apparatus for performing the methods described in the first aspect or its various implementations. Specifically, the apparatus includes functional units for performing the methods described in the first aspect or its various implementations. Fourthly, this application provides a video encoding apparatus for performing the methods described in the second aspect or its various implementations. Specifically, the apparatus includes functional units for performing the methods described in the second aspect or its various implementations. Fifthly, a video decoder is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to perform the methods in the first aspect or its implementations described above. In a sixth aspect, a video encoder is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to perform the methods in the second aspect or its implementations described above. In a seventh aspect, a video encoding and decoding system is provided, including a video encoder and a video decoder. The video decoder is used to execute the methods in the first aspect or its implementations described above, and the video encoder is used to execute the methods in the second aspect or its implementations described above. Eighthly, a chip is provided for implementing the methods of any one of the first to second aspects or their respective implementations. Specifically, the chip includes a processor for calling and running a computer program from a memory, causing a device on which the chip is mounted to perform the methods of any one of the first to second aspects or their respective implementations. Ninthly, a computer-readable storage medium is provided for storing a computer program that causes a computer to perform the methods of any one of the first to second aspects or their respective implementations. In a tenth aspect, a computer program product is provided, including computer program instructions that cause a computer to perform the methods of any one of the first to second aspects or their respective implementations. Eleventhly, a computer program is provided that, when run on a computer, causes the computer to perform the methods of any one of the first to second aspects or their respective implementations. In the twelfth aspect, a bitstream is provided, which is generated based on the method of the second aspect above. Optionally, the bitstream includes a first index, which indicates a first combination consisting of a weighted derived mode and K prediction modes, where K is a positive integer greater than 1. Based on the above technical solutions, this application combines the weighted derived mode and K prediction modes as a single combination. This combination indicates the weighted derived mode and K prediction modes used by the current block in the bitstream. The decoding end obtains a first index by decoding the bitstream. This first index indicates a first combination consisting of one weighted derived mode and K prediction modes. Based on this first index, the first weighted derived mode and K first prediction modes included in the first combination are determined. The current block is then predicted based on the first weighted derived mode and K first prediction modes to obtain the predicted value of the current block. This application uses a combination to indicate the first weighted derived mode and K first prediction modes corresponding to the current block, simplifying the syntax, saving codewords, and eliminating the need for various case judgments, thereby improving encoding efficiency. Attached Figure Description Figure 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application; Figure 2 is a schematic block diagram of a video encoder involved in an embodiment of this application; Figure 3 is a schematic block diagram of a video decoder involved in an embodiment of this application; Figure 4 is a schematic diagram of weight allocation; Figure 5 is a schematic diagram of weight allocation; Figure 6A is a schematic diagram of inter-frame prediction; Figure 6B is a schematic diagram of weighted inter-frame prediction; Figure 7A is a schematic diagram of intra-frame prediction; Figure 7B is a schematic diagram of intra-frame prediction; Figures 8A-8I are schematic diagrams of intra-frame prediction; Figure 9 is a schematic diagram of the intra-frame prediction mode; Figure 10 is a schematic diagram of the intra-frame prediction mode; Figure 11 is a schematic diagram of the intra-frame prediction mode; Figure 12 is a schematic diagram of MIP; Figure 13 is a schematic diagram of weighted prediction; Figure 14 is a schematic diagram of template matching; Figure 15 is a schematic flowchart of a video decoding method provided in an embodiment of this application; Figure 16A is a schematic diagram of a weight allocation; Figure 16B is a schematic diagram of another weight allocation; Figure 17 is a schematic diagram of the derivation of template weights; Figure 18 is a schematic diagram of a template; Figure 19 is a schematic diagram of the video coding method provided in an embodiment of this application; Figure 20 is a schematic block diagram of a video decoding apparatus provided in an embodiment of this application; Figure 21 is a schematic block diagram of a video encoding apparatus provided in an embodiment of this application; Figure 22 is a schematic block diagram of an electronic device provided in an embodiment of this application; Figure 23 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of this application. Detailed Implementation This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, and real-time video encoding and decoding. For example, the solution of this application can be combined with audio video coding standards (AVS), such as H.264 / Audio Video Coding (AVC) standard, H.265 / High Efficiency Video Coding (HEVC) standard, and H.266 / Versatile Video Coding (VVC) standard. Alternatively, the solution of this application can be combined 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, ITU-TH.264 (also known as ISO / IEC MPEG-4 AVC), which include Scalable Video Coding (SVC) and Multi-View Video Coding (MVC) extensions. It should be understood that the technology in this application is not limited to any particular codec standard or technology. For ease of understanding, the video encoding and decoding system involved in the embodiments of this application will be introduced first with reference to Figure 1. Figure 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application. It should be noted that Figure 1 is only an example, and the video encoding and decoding system of this application includes, but is not limited to, the one shown in Figure 1. As shown in Figure 1, the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120. The encoding device is used to encode (can be understood as compressing) video data to generate a bitstream, and transmits the bitstream to the decoding device. The decoding device decodes the bitstream generated by the encoding device to obtain decoded video data. The encoding device 110 in this application embodiment can be understood as a device with video encoding function, and the decoding device 120 can be understood as a device with video decoding function. That is, the encoding device 110 and the decoding device 120 in this application embodiment include a wider range of devices, such as smartphones, desktop computers, mobile computing devices, laptops (e.g., laptop computers), tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, etc. In some embodiments, encoding device 110 may transmit encoded video data (such as a bitstream) to decoding device 120 via channel 130. Channel 130 may include one or more media and / or means capable of transmitting encoded video data from encoding device 110 to decoding device 120. In one example, channel 130 includes one or more communication media that enable encoding device 110 to transmit encoded video data directly to decoding device 120 in real time. In this example, encoding device 110 can modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding device 120. The communication media includes wireless communication media, such as radio frequency spectrum; optionally, the communication media may also include wired communication media, such as one or more physical transmission lines. In another example, channel 130 includes a storage medium that can store video data encoded by encoding device 110. The storage medium includes various local access data storage media, such as optical discs, DVDs, flash memory, etc. In this example, decoding device 120 can retrieve the encoded video data from the storage medium. In another example, channel 130 may include a storage server that can store the video data encoded by encoding device 110. In this example, decoding device 120 can download the stored encoded video data from the storage server. Optionally, the storage server can store and transmit the encoded video data to decoding device 120, such as a web server (e.g., for a website), a file transfer protocol (FTP) server, etc. In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter. In some embodiments, the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113. The video source 111 may include at least one of a video capture device (e.g., a video camera), a video archive, a video input interface, and a computer graphics system, wherein 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. Video encoder 112 encodes video data from video source 111 to generate a bitstream. The video data may include one or more pictures or a sequence of pictures. The bitstream contains the encoding information of the pictures or picture sequences in the form of a bitstream. The encoding information may include encoded picture data and associated data. The associated data may include a sequence parameter set (SPS), a picture parameter set (PPS), and other syntax structures. The SPS may contain parameters applied to one or more sequences. The PPS may contain parameters applied 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 bitstream. The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113. The encoded video data can also be stored on a storage medium or a storage server for subsequent retrieval by the decoding device 120. In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122. In some embodiments, in addition to the input interface 121 and the video decoder 122, the decoding device 120 may also include a display device 123. The input interface 121 includes a receiver and / or a modem. The input interface 121 can receive encoded video data through channel 130. The video decoder 122 is used to decode the encoded video data to obtain the decoded video data, and transmit the decoded video data to the display device 123. Display device 123 displays the decoded video data. Display device 123 may be integrated with decoding device 120 or external to decoding device 120. Display device 123 may include various display devices, such as liquid crystal display (LCD), plasma display, organic light-emitting diode (OLED) display, or other types of display devices. Furthermore, Figure 1 is merely an example, and the technical solutions of this application are not limited to Figure 1. For example, the technology of this application can also be applied to one-sided video encoding or one-sided video decoding. The video coding framework involved in the embodiments of this application is described below. Figure 2 is a schematic block diagram of a video encoder according to an embodiment of this application. It should be understood that the video encoder 200 can be used for lossy compression of images or lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression. This video encoder 200 can be applied to image data in luminance / chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents luminance (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) used to describe color and saturation. For example, in color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) per 4 pixels; 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) per 4 pixels; and 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr). For example, the video encoder 200 reads video data and divides each frame into several coding tree units (CTUs). In some examples, CTUs may be called "tree blocks," "largest coding unit" (LCU), or "coding tree block" (CTB). Each CTU can be associated with a pixel block of equal size within the image. Each pixel can correspond to one luminance (luma) sample and two chrominance (chroma) samples. Therefore, each CTU can be associated with one luminance sample block and two chrominance sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into several coding units (CUs) for encoding. CUs can be rectangular or square blocks. The CU can be further divided into prediction units (PUs) and transform units (TUs), thus separating encoding, prediction, and transformation for more flexible processing. In one example, the CTU is divided into CUs using a quadtree structure, and the CUs are further divided into TUs and PUs using a quadtree structure. The video encoder and decoder support various PU sizes. Assuming a specific CU size of 2N×2N, the video encoder and decoder can support PU sizes of 2N×2N or N×N for intra-frame prediction, and also support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter-frame prediction. The video encoder and decoder can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter-frame prediction. In some embodiments, as shown in FIG2, the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform / quantization unit 230, an inverse transform / quantization unit 240, a reconstruction unit 250, a loop filtering unit 260, a decoded image buffer 270, and an entropy coding unit 280. It should be noted that the video encoder 200 may include more, fewer, or different functional components. Optionally, in this application, the current block can be referred to as the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block can also be referred to as the predicted image block or the image prediction block, and the reconstructed image block can also be referred to as the reconstruction block or the image reconstruction block. In some embodiments, the prediction unit 210 includes an inter-frame prediction unit 211 and an intra-frame estimation unit 212. Because there is a strong correlation between adjacent pixels in a frame of a video, intra-frame prediction is used in video encoding and decoding techniques to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent frames in a video, inter-frame prediction is used in video encoding and decoding techniques to eliminate temporal redundancy between adjacent frames, thereby improving coding efficiency. Inter-frame prediction unit 211 can be used for inter-frame prediction, which can include motion estimation and motion compensation. It can reference image information from different frames. Inter-frame prediction uses motion information to find a reference block from the reference frame and generates a prediction block based on the reference block to eliminate temporal redundancy. The frames used for inter-frame prediction can be P-frames and / or B-frames, where P-frames refer to forward prediction frames and B-frames refer to bidirectional prediction frames. The motion information includes a list of reference frames, the reference frame index, and motion vectors. Motion vectors can be integer-pixel or fractional-pixel. If the motion vector is fractional-pixel, interpolation filtering needs to be used in the reference frame to create the required fractional-pixel blocks. Here, the integer-pixel or fractional-pixel blocks in the reference frame found based on the motion vectors are called reference blocks. Some techniques directly use the reference block as the prediction block, while others process the reference block further to generate the prediction block. Processing the reference block further to generate the prediction block can also be understood as using the reference block as the prediction block and then processing it to generate a new prediction block. Intra-frame estimation unit 212 refers only to information from the same frame image to predict pixel information within the current code image block, thereby eliminating spatial redundancy. The frame used for intra-frame prediction can be an I-frame. Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standards H-series as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, while H.265 / HEVC extends this to 33 angular prediction modes and 2 non-angular prediction modes. HEVC uses Planar, DC, and 33 angular modes for a total of 35 intra-frame prediction modes. VVC uses Planar, DC, and 65 angular modes for a total of 67 intra-frame prediction modes. It should be noted that with the increase in angle modes, intra-frame prediction will be more accurate and better meet the needs of the development of high-definition and ultra-high-definition digital video. The residual unit 220 can generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, the residual unit 220 can generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the corresponding sample in the prediction block of the PU of the CU. Transform / quantization unit 230 can quantize transform coefficients. Transform / quantization unit 230 can quantize transform coefficients associated with the TU of the CU based on the quantization parameter (QP) value associated with the CU. Video encoder 200 can adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU. The inverse transform / quantization unit 240 can apply inverse quantization and inverse transform to the quantized transform coefficients to reconstruct the residual block from the quantized transform coefficients. The reconstruction unit 250 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by the prediction unit 210 to produce a reconstructed image block associated with the TU. By reconstructing the sampled blocks of each TU of the CU in this way, the video encoder 200 can reconstruct the pixel blocks of the CU. The loop filtering unit 260 is used to process the pixels after inverse transformation and inverse quantization to compensate for the distortion information and provide a better reference for subsequent encoded pixels. For example, it can perform deblocking filtering to reduce the block effect of pixel blocks associated with the CU. In some embodiments, the loop filtering unit 260 includes a deblocking filtering unit and a sample adaptive compensation / adaptive loop filtering (SAO / ALF) unit, wherein the deblocking filtering unit is used to remove block effects and the SAO / ALF unit is used to remove ringing effects. The decoded image buffer 270 can store reconstructed pixel blocks. The inter-frame prediction unit 211 can use a reference image containing the reconstructed pixel blocks to perform inter-frame prediction on PUs of other images. In addition, the intra-frame estimation unit 212 can use the reconstructed pixel blocks in the decoded image buffer 270 to perform intra-frame prediction on other PUs in the same image as the CU. Entropy coding unit 280 can receive quantized transform coefficients from transform / quantization unit 230. Entropy coding unit 280 can perform one or more entropy coding operations on the quantized transform coefficients to produce entropy-coded data. Figure 3 is a schematic block diagram of the video decoder involved in the embodiments of this application. As shown in Figure 3, the video decoder 300 includes: an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transformation unit 330, a reconstruction unit 340, a loop filtering unit 350, and a decoded image buffer 360. It should be noted that the video decoder 300 may contain more, fewer, or different functional components. The video decoder 300 can receive a bitstream. The entropy decoding unit 310 can parse the bitstream to extract syntax elements from it. As part of parsing the bitstream, the entropy decoding unit 310 can parse the entropy-encoded syntax elements in the bitstream. The prediction unit 320, the dequantization / transform unit 330, the reconstruction unit 340, and the loop filtering unit 350 can decode the video data based on the syntax elements extracted from the bitstream, i.e., generate decoded video data. In some embodiments, the prediction unit 320 includes an intra-frame estimation unit 322 and an inter-frame prediction unit 321. Intra-frame estimation unit 322 can perform intra-frame prediction to generate prediction blocks for the PU. Intra-frame estimation unit 322 can use an intra-frame prediction mode to generate prediction blocks for the PU based on pixel blocks of spatially adjacent PUs. Intra-frame estimation unit 322 can also determine the intra-frame prediction mode of the PU based on one or more syntax elements parsed from the bitstream. Inter-frame prediction unit 321 can construct a first reference image list (list 0) and a second reference image list (list 1) based on the syntax elements parsed from the bitstream. Furthermore, if the PU uses inter-frame prediction coding, the entropy decoding unit 310 can parse the motion information of the PU. Inter-frame prediction unit 321 can determine one or more reference blocks of the PU based on the motion information of the PU. Inter-frame prediction unit 321 can generate prediction blocks for the PU based on one or more reference blocks of the PU. The dequantization / transformation unit 330 reversibly quantizes (i.e., dequantizes) the transform coefficients associated with the TU. The dequantization / transformation unit 330 can use the QP value associated with the CU of the TU to determine the degree of quantization. After the inverse quantization transform coefficients, the inverse quantization / transformation unit 330 can apply one or more inverse transforms to the inverse quantization transform coefficients to generate a residual block associated with the TU. The reconstruction unit 340 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, the reconstruction unit 340 can add the sample of the residual block to the corresponding sample of the prediction block to reconstruct the pixel block of the CU, thereby obtaining the reconstructed image block. The loop filter unit 350 can perform deblocking filtering operations to reduce the block effect of pixel blocks associated with the CU. The video decoder 300 can store the reconstructed image of the CU in the decoded image buffer 360. The video decoder 300 can use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation. The basic process of video encoding and decoding is as follows: At the encoding end, a frame image is divided into blocks. For the current block, the prediction unit 210 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual unit 220 can calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block. This residual block can also be called residual information. This residual block is transformed and quantized by the transform / quantization unit 230, which can remove information that is not sensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization unit 230 can be called a temporal residual block, and the temporal residual block after transformation and quantization by the transform / quantization unit 230 can be called a frequency residual block or a frequency domain residual block. The entropy coding unit 280 receives the quantized change coefficients output by the change quantization unit 230, and can perform entropy coding on the quantized change coefficients to output a bitstream. For example, the entropy coding unit 280 can eliminate character redundancy based on the target context model and the probability information of the binary bitstream. At the decoding end, the entropy decoding unit 310 can parse the bitstream to obtain the prediction information and quantization coefficient matrix of the current block. The prediction unit 320 uses intra-frame prediction or inter-frame prediction to generate the prediction block of the current block based on the prediction information. The dequantization / transform unit 330 uses the quantization coefficient matrix obtained from the bitstream to perform dequantization and inverse transform on the quantization coefficient matrix to obtain the residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain the reconstructed block. The reconstructed blocks form the reconstructed image. The loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain the decoded image. The encoding end also needs similar operations to the decoding end to obtain the decoded image. This decoded image can also be called the reconstructed image, which can be used as a reference frame for inter-frame prediction in subsequent frames. It should be noted that the block partitioning information determined at the encoding end, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, are carried in the bitstream when necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, and loop filtering mode information or parameter information as the encoding end by parsing the bitstream and analyzing existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The above describes the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. This application is applicable to the basic flow of a video codec under this block-based hybrid coding framework, but is not limited to this framework and flow. In some embodiments, the current block can be the current coding unit (CU) or the current prediction unit (PU), etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency on each other. A "frame" is a commonly used term, generally understood as an image. In this application, "frame" can also be replaced with "image" or "slice," etc. The Versatile Video Coding (VVC) standard, currently under development, includes an inter-frame prediction mode called Geometric Partitioning Mode (GPM). The Audio Video Coding Standard (AVS) standard, also under development, includes an inter-frame prediction mode called Angular Weighted Prediction (AWP). Although these two modes differ in name and specific implementation, they share common principles. It's important to note that traditional unidirectional prediction uses only one reference block of the same size as the current block, while traditional bidirectional prediction uses two reference blocks of the same size. The pixel value of each point in the predicted block is the average of the corresponding positions in the two reference blocks; that is, all points in each reference block occupy a 50% proportion. Bidirectional weighted prediction allows the proportions of the two reference blocks to differ, such as all points in the first reference block occupying a 75% proportion and all points in the second reference block occupying a 25% proportion. However, the proportions of all points within the same reference block are always the same. Other optimization techniques, such as Decoder Side Motion Vector Refinement (DMVR) and Bidirectional Optical Flow (BIO), may cause some changes in the reference or predicted pixels, but these are unrelated to the principles described above. BIO can also be abbreviated as BDOF. GPM or AWP also uses two reference blocks of the same size as the current block. However, some pixel locations use 100% of the pixel values ​​from the first reference block, and some pixel locations use 100% of the pixel values ​​from the second reference block. In the boundary or transition region, the pixel values ​​from both reference blocks are used in proportion. The weights in the boundary region also gradually transition. How these weights are specifically allocated is determined by the GPM or AWP mode. The weight of each pixel location is determined according to the GPM or AWP mode. Of course, in some cases, such as when the block size is very small, some GPM or AWP modes may not guarantee that some pixel locations will use 100% of the pixel values ​​from the first reference block, and some pixel locations will use 100% of the pixel values ​​from the second reference block. Alternatively, GPM or AWP can be considered to use two reference blocks of different sizes from the current block, that is, taking a portion of each as the reference block. That is, the part with a weight of non-zero is used as the reference block, while the part with a weight of zero is discarded. This is an implementation issue and not the focus of this invention. For example, Figure 4 is a schematic diagram of weight allocation. As shown in Figure 4, it illustrates the weight allocation of a GPM on a 64×64 current block using multiple partitioning modes, provided in an embodiment of this application. The GPM has 64 partitioning modes. Figure 5 is a schematic diagram of weight allocation. As shown in Figure 5, it illustrates the weight allocation of an AWP on a 64×64 current block using multiple partitioning modes, provided in an embodiment of this application. The AWP has 56 partitioning modes. In both Figure 4 and Figure 5, under each partitioning mode, the black area represents the weight value of the position corresponding to the first reference block as 0%, the white area represents the weight value of the position corresponding to the first reference block as 100%, and the gray area, according to its color intensity, represents a weight value greater than 0% and less than 100% for the position corresponding to the first reference block. The weight value of the position corresponding to the second reference block is 100% minus the weight value of the position corresponding to the first reference block. GPM and AWP use different methods to derive weights. GPM determines the angle and offset for each mode and then calculates the weight matrix for each mode. AWP first draws a one-dimensional weight line and then uses a method similar to intra-frame angle prediction to fill the entire matrix with the one-dimensional weight line. It should be understood that early encoding and decoding technologies only used rectangular partitioning, whether for CUs, PUs, or Transform Units (TUs). GPM and AWP, however, achieved non-rectangular partitioning for prediction without such partitioning. GPM and AWP use a weighted mask of two reference blocks, i.e., the weight map mentioned above. This mask determines the weights of the two reference blocks when generating the prediction block. Simply put, part of the prediction block's location comes from the first reference block, and part comes from the second. The blending area is obtained by weighting the corresponding positions of the two reference blocks, resulting in a smoother transition. Since GPM and AWP do not divide the current block into two CUs or PUs along a dividing line, the residual transformation, quantization, inverse transformation, and inverse quantization after prediction are all processed as a single unit. GPM uses a weight matrix to simulate the partitioning of geometry, or more precisely, the partitioning of predictions. To implement GPM, in addition to the weight matrix, two prediction values ​​are needed, each determined by one unidirectional motion information. These two unidirectional motion information pieces come from a motion information candidate list, such as the merge motion information candidate list (mergeCandList). GPM uses two indices in the bitstream to determine the two unidirectional motion information pieces from the mergeCandList. Inter-frame prediction uses motion information to represent "motion." Basic motion information includes information about the reference frame (or reference picture) and motion vectors (MVs). A common bidirectional prediction method uses two reference blocks to predict the current block. These two reference blocks can be one forward reference block and one backward reference block. Optionally, both can be forward or both can be backward. Forward means the reference frame's time point is before the current frame, and backward means the reference frame's time point is after the current frame. Alternatively, forward means the reference frame's position in the video is before the current frame, and backward means the reference frame's position is after the current frame. Or, forward means the reference frame's picture order count (POC) is less than the current frame's POC, and backward means the reference frame's POC is greater than the current frame's POC. To use bidirectional prediction, two reference blocks are needed, requiring information from two sets of reference frames and motion vectors. Each set can be understood as a unidirectional motion information, and combining these two sets together forms a bidirectional motion information. In specific implementations, unidirectional and bidirectional motion information can use the same data structure, except that the information of both sets of reference frames and motion vectors are valid in bidirectional motion information, while the information of one set of reference frames and motion vectors is invalid in unidirectional motion information. In some embodiments, two reference frame lists are supported, denoted as RPL0 and RPL1, where RPL is short for Reference Picture List. In some embodiments, a P slice can only use RPL0, while a B slice can use both RPL0 and RPL1. For a slice, each reference frame list contains several reference frames, and the codec finds a specific reference frame using its reference frame index. In some embodiments, motion information is represented by reference frame indices and motion vectors. For example, for the bidirectional motion information mentioned above, the reference frame index refIdxL0 corresponding to reference frame list 0 and the motion vector mvL0 corresponding to reference frame list 0 are used; the reference frame index refIdxL1 corresponding to reference frame list 1 and the motion vector mvL0 corresponding to reference frame list 1 are used. The reference frame indices corresponding to reference frame list 0 and reference frame list 1 can be understood as the information of the reference frames mentioned above. In some embodiments, two flags are used to indicate whether the motion information corresponding to reference frame list 0 is used and whether the motion information corresponding to reference frame list 0 is used, denoted as predFlagL0 and predFlagL1, respectively. This can also be understood as predFlagL0 and predFlagL1 representing whether the aforementioned unidirectional motion information is "valid". Although the data structure of motion information is not explicitly mentioned, it uses the reference frame index corresponding to each reference frame list, the motion vector, and the "valid" flag to represent the motion information. In some standard texts, motion information is not used; instead, motion vectors are used. The reference frame index and the flag indicating whether to use the corresponding motion information can be considered as subordinate to the motion vector. For convenience, this application still uses "motion information," but it should be understood that "motion vector" can also be used. Motion information used in the current block can be saved. Subsequent blocks in the current frame can use the motion information of previously encoded blocks, such as adjacent blocks, based on their positional relationships. This utilizes spatial correlation, so this type of encoded motion information is called spatial motion information. Motion information used by each block in the current frame can also be saved. Subsequent frames can use the motion information of previously encoded frames based on their reference relationships. This utilizes temporal correlation, so this type of encoded frame motion information is called temporal motion information. The method for storing motion information used by each block in the current frame typically involves using a fixed-size matrix, such as a 4x4 matrix, as a minimum unit, with each minimum unit storing a separate set of motion information. In this way, for each encoded block, the minimum units corresponding to its position can store the motion information for that block. This allows for direct retrieval of the motion information at a given position when using spatial or temporal motion information. For example, if a 16x16 block uses traditional one-way prediction, then all 4x4 minimum units corresponding to this block store the motion information for that one-way prediction. If a block uses GPM or AWP, then the motion information stored in each of the block's smallest units is determined based on the GPM or AWP mode, the first motion information, the second motion information, and the position of each smallest unit. One approach is that if all 4x4 pixels of a smallest unit come from the first motion information, then that smallest unit stores the first motion information; if all 4x4 pixels come from the second motion information, then that smallest unit stores the second motion information. If the 4x4 pixels of a smallest unit come from both the first and second motion information, then AWP selects one motion information to store. GPM's approach is to combine two motion information sets into bidirectional motion information if the two sets point to different reference frame lists; otherwise, only the second motion information is stored. Optionally, the mergeCandList described above is constructed based on spatial motion information, temporal motion information, historical motion information, and other types of motion information. For example, mergeCandList uses positions 1 to 5 in Figure 6A to derive spatial motion information, and positions 6 or 7 in Figure 6A to derive temporal motion information. Historical motion information is added to a first-in-first-out (FIFO) list each time a block is encoded or decoded. This addition process may require checks, such as checking for duplicate motion information already in the list. This allows the historical motion information to be referenced when encoding or decoding the current block. In some embodiments, the syntax description of GPM is shown in Table 1: Table 1 As shown in Table 1, in merge mode, if regular_merge_flag is not 1, the current block may use CIIP or GPM. If the current block does not use CIIP, then it uses GPM, which is the content shown in the syntax "if(!ciip_flag[x0][y0])" in Table 1. As shown in Table 1 above, GPM needs to transmit three pieces of information in the bitstream: merge_gpm_partition_idx, merge_gpm_idx0, and merge_gpm_idx1. x0 and y0 are used to determine the coordinates (x0, y0) of the current block's top-left luminance pixel relative to the top-left luminance pixel of the image. merge_gpm_partition_idx determines the partition shape of GPM; as mentioned above, it is a "simulated partition." merge_gpm_partition_idx is what this article refers to as the weight matrix derivation mode or the index of the weight matrix derivation mode, or simply the weight derivation mode or weight derivation mode index. merge_gpm_idx0 is the first merge candidate index, used to determine the first motion information, or the first merge candidate, based on mergeCandList. merge_gpm_idx1 is the second merge candidate index, used to determine the second motion information, or the second merge candidate, based on mergeCandList. If MaxNumGpmMergeCand > 2, meaning the candidate list length is greater than 2, then it is necessary to decode merge_gpm_idx1; otherwise, it can be determined directly. In some embodiments, the GPM decoding process includes the following steps: The information input to the decoding process includes: the coordinates (xCb, yCb) of the brightness position of the top-left corner of the current block relative to the top-left corner of the image, the width cbWidth of the brightness component of the current block, the height cbHeight of the brightness component of the current block, the brightness motion vectors mvA and mvB with 1 / 16 pixel precision, the chroma motion vectors mvCA and mvCB, the reference frame indices refIdxA and refIdxB, and the prediction list flags predListFlagA and predListFlagB. For example, motion information can be represented by combining motion vectors, reference frame indices, and prediction list flags. VVC supports two reference frame lists, each of which may contain multiple reference frames. Unidirectional prediction uses only one reference block from one reference frame in one of the reference frame lists as a reference, while bidirectional prediction uses one reference block from each of the two reference frame lists. GPM in VVC uses two unidirectional predictions. In the above examples of mvA and mvB, mvCA and mvCB, refIdxA and refIdxB, predListFlagA and predListFlagB, A can be understood as the first prediction mode, and B as the second prediction mode. We use X to represent A or B, predListFlagX to indicate whether X uses the first or second reference frame list, refIdxX to indicate the reference frame index in the reference frame list used by X, mvX to indicate the luma motion vector used by X, and mvCX to indicate the chroma motion vector used by X. To reiterate, in VVC, the motion vector, reference frame index, and prediction list flags can be considered as a combination to represent the motion information described herein. The information output during the decoding process includes: a luminance prediction sample matrix predSamplesL of (cbWidth) x (cbHeight); a prediction sample matrix of the Cb chromaticity component of (cbWidth / SubWidthC) x (cbHeight / SubHeightC), if needed; and a prediction sample matrix of the Cr chromaticity component of (cbWidth / SubWidthC) x (cbHeight / SubHeightC), if needed. For example, the following uses the luminance component as an example; the processing of the chrominance component is similar to that of the luminance component. Assume that the sizes of predSamplesLAL and predSamplesLBL are (cbWidth) x (cbHeight), representing the prediction sample matrices derived from two prediction modes. predSamplesL is derived as follows: predSamplesLAL and predSamplesLBL are determined based on the luminance motion vectors mvA and mvB, the chrominance motion vectors mvCA and mvCB, the reference frame indices refIdxA and refIdxB, and the prediction list flags predListFlagA and predListFlagB. That is, predictions are made based on the motion information of the two prediction modes; the detailed process is not elaborated here. Typically, GPM uses a merge mode, so both prediction modes of GPM can be considered merge modes. Based on merge_gpm_partition_idx[xCb][yCb], use Table 2 to determine the partition angle index variable angleIdx and distance index variable distanceIdx for GPM. Table 2 – Correspondence between angleIdx, distanceIdx and merge_gpm_partition_idx It should be noted that since all three components (such as Y, Cb, and Cr) can use GPM, some standard texts package the process of generating the GPM prediction sample matrix for one component into a sub-process, namely the weighted sample prediction process for geometric partitioning mode (GPM). All three components will call this process, but with different parameters. Here, we only use the luminance component as an example. The prediction matrix predSamplesL[xL][yL] (where xL = 0..cbWidth–1, yL = 0..cbHeight–1) of the current luminance block is derived from the weighted prediction process of GPM. Here, nCbW is set to cbWidth, nCbH is set to cbHeight, and the prediction sample matrices predSamplesLAL and predSamplesLBL from the two prediction modes, along with angleIdx and distanceIdx, are used as input. In some embodiments, the weighted prediction derivation process for GPM includes the following steps: The inputs to this process are: the width nCbW and height nCbH of the current block; two (nCbW) x (nCbH) prediction sample matrices, predSamplesLA and predSamplesLB; the GPM's dividing angle index variable angleIdx; the GPM's distance index variable distanceIdx; and the component index variable cIdx. This example uses luminance, therefore cIdx is 0, representing the luminance component. The output of this process is: a GPM prediction sample matrix pbSamples of (nCbW)X(nCbH). For example, variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are exported as follows: nW=(cIdx==0)? nCbW:nCbW*SubWidthC; nH=(cIdx==0)? nCbH:nCbH*SubHeightC; shift1 = Max(5, 17 - BitDepth), where BitDepth is the bit depth of the encoding and decoding; offset1 = 1 << (shift1 - 1), where "<<" indicates a left shift; displacementX = angleIdx; displacementY=(angleIdx+8)%32; partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1; shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1. The variables offsetX and offsetY are exported as follows: When the value of shiftHor is 0: offsetX = (-nW) >> 1, offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)). When shiftHor is 1: offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3), offsetY = (-nH) >> 1. Variables xL and yL are derived as follows: xL=(cIdx==0)? x:x*SubWidthC, yL=(cIdx==0)? y:y*SubHeightC, The variable wValue, which represents the weight of the predicted sample at the current position, is derived as follows: wValue is the weight of the predicted value predSamplesLA[x][y] of the prediction matrix of the first prediction mode at point (x, y), and (8-wValue) is the weight of the predicted value predSamplesLB[x][y] of the prediction matrix of the first prediction mode at point (x, y). The distance matrix disLut is determined according to Table 3: Table 3 idx02345681011121314disLut[idx]8884420-2-4-4-8-8idx161819202122242627282930disLut[idx]-8-8-8-4-4-2024488 weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+(((yL+offsetY)<<1)+1)*disLut[displacementY], weightIdxL=partFlip? 32+weightIdx:32–weightIdx, wValue=Clip3(0,8,(weightIdxL+4)>>3), The predicted sample values ​​pbSamples[x][y] are derived as follows: pbSamples[x][y] = Clip3(0, (1<<BitDepth)-1,(predSamplesLA[x][y]*wValue+predSamplesLB[x][y]*(8-wValue)+offset1)> >shift1). It should be noted that a weight value is derived for each position in the current block, and then a GPM prediction value pbSamples[x][y] is calculated. Because in this method, the weight wValue does not need to be written in matrix form, but it can be understood that if the wValue of each position is stored in a matrix, then it is a weight matrix. The principle is the same whether the weights are calculated separately for each point and then weighted to obtain the GPM prediction value, or all weights are calculated and then weighted uniformly to obtain the GPM prediction sample matrix. The use of the term "weight matrix" in many descriptions in this application is for easier understanding and more intuitive visualization. In fact, it can also be described according to the weight of each position. For example, the weight matrix derivation mode can also be called the weight derivation mode. In some embodiments, as shown in Figure 6B, the GPM decoding process can be described as follows: Parse the bitstream to determine whether the current block uses GPM technology; if the current block uses GPM technology, determine the weight derivation mode (or partitioning mode or weight matrix derivation mode), and the first motion information and the second motion information. Determine the first prediction block based on the first motion information, determine the second prediction block based on the second motion information, determine the weight matrix based on the weight matrix derivation mode, and determine the prediction block of the current block based on the first prediction block, the second prediction block, and the weight matrix. Intra-frame prediction uses the reconstructed pixels that have already been encoded and decoded around the current block as reference pixels to predict the current block. Figure 7A is a schematic diagram of intra-frame prediction. As shown in Figure 7A, the current block size is 4x4. The pixels in the left row and the top column of the current block are the reference pixels for the current block. Intra-frame prediction uses these reference pixels to predict the current block. These reference pixels may all be available, i.e., all have been encoded and decoded. Some may also be unavailable. For example, if the current block is the leftmost part of the entire frame, then the reference pixels on the left side of the current block are unavailable. Or, if the lower left part of the current block has not yet been encoded and decoded, then the reference pixels in the lower left are also unavailable. In the case where reference pixels are unavailable, available reference pixels, certain values, or certain methods can be used to fill the gaps, or no filling can be performed. Figure 7B is a schematic diagram of intra-frame prediction. As shown in Figure 7B, the Multiple Reference Line (MRL) intra-frame prediction method can use more reference pixels to improve encoding and decoding efficiency. For example, four reference rows / columns can be used as reference pixels for the current block. Furthermore, intra-frame prediction has multiple prediction modes. Figures 8A-5I illustrate intra-frame prediction. As shown in Figures 8A-5I, intra-frame prediction of a 4x4 block in H.264 mainly includes nine modes. Among them, Mode 0, as shown in Figure 8A, copies the pixels above the current block vertically to the current block as the prediction value. Mode 1, as shown in Figure 8B, copies the reference pixel on the left horizontally to the current block as the prediction value. Mode 2, as shown in Figure 8C, uses the average value of points A-D and I-L as the prediction value for all points. Modes 3-8, as shown in Figures 8D-5I, copy the reference pixel to the corresponding position in the current block at a certain angle. Because some positions in the current block cannot correspond exactly to the reference pixel, it may be necessary to use the weighted average value of the reference pixels, or the interpolated reference pixel sub-pixels. In addition to these, there are Plane, Planar, and other modes. With technological advancements and increased block size, the number of angle prediction modes is also increasing. Figure 9 shows a schematic diagram of intra-frame prediction modes. As shown in Figure 9, HEVC uses 35 intra-frame prediction modes, including Planar, DC, and 33 angle modes. Figure 10 shows a schematic diagram of intra-frame prediction modes. As shown in Figure 10, VVC uses 67 intra-frame prediction modes, including Planar, DC, and 65 angle modes. Figure 11 shows a schematic diagram of intra-frame prediction modes. As shown in Figure 11, VS3 uses 66 prediction modes, including DC, Plane, Bilinear, PCM, and 62 angle modes. Other techniques improve prediction, such as improving the subpixel interpolation of the reference pixel and filtering the predicted pixels. For example, the multiple inraprediction filter (MIPF) in AVS3 uses different filters to generate predicted values ​​for different block sizes. Within the same block, pixels closer to the reference pixel are predicted using one filter, while pixels farther from the reference pixel are predicted using another. Techniques for filtering predicted pixels include the intraprediction filter (IPF) in AVS3, which can filter the predicted values ​​using the reference pixel. In intra-frame prediction, the Most Probable Modes List (MPM) intra-frame mode coding technique can be used to improve encoding and decoding efficiency. A mode list is constructed by utilizing the intra-frame prediction modes of surrounding already encoded blocks, as well as intra-frame prediction modes derived from the intra-frame prediction modes of surrounding already encoded blocks, such as adjacent modes, and some commonly used or frequently used intra-frame prediction modes, such as DC, Planar, and Bilinear modes. Referencing the intra-frame prediction modes of surrounding already encoded blocks utilizes spatial correlation, because textures have a certain degree of spatial continuity. MPM can be used as a prediction for intra-frame prediction modes, meaning that the probability of the current block using MPM is considered higher than the probability of not using MPM. Therefore, during binarization, fewer codewords are used for MPM, thus saving overhead and improving encoding and decoding efficiency. In some embodiments, matrix-based intra-prediction (MIP), sometimes also referred to as matrix-weighted intra-prediction, can be used for intra-prediction. As shown in Figure 12, to predict a block with width W and height H, MIP requires H reconstructed pixels from the left column of the current block and W reconstructed pixels from the top row of the current block as input. MIP generates the prediction block in three steps: reference pixel averaging, matrix vector multiplication, and interpolation. Matrix multiplication is the core of MIP. MIP can be considered as a process of generating a prediction block using input pixels (reference pixels) through matrix multiplication. MIP provides various matrices, and the different prediction methods are reflected in the different matrices. Using different matrices with the same input pixels will yield different results. The reference pixel averaging and interpolation processes are a trade-off between performance and complexity. For larger blocks, reference pixel averaging can achieve an approximate downsampling effect, allowing the input to be adapted to a smaller matrix, while interpolation achieves an upsampling effect. This eliminates the need to provide a MIP matrix for every block size; instead, only one or a few specific size matrices are required. As demands for compression performance increase, and as hardware capabilities improve, next-generation standards may feature even more complex MIPs. MIP is somewhat similar to planar, but MIP is clearly more complex and flexible than planar. GPM combines two inter-frame prediction blocks using a weight matrix. In fact, it can be extended to combine two arbitrary prediction blocks, such as two inter-frame prediction blocks, two intra-frame prediction blocks, one inter-frame prediction block, and one intra-frame prediction block. Even in screen content encoding, prediction blocks from IBC (intra-block copy) or palettes can be used as one or two of the prediction blocks. This application refers to intra-frame, inter-frame, IBC, and palette as different prediction methods. For ease of expression, we use the term "prediction mode" here. A prediction mode can be understood as the information that the codec can use to generate a prediction block for the current block. For example, in intra-frame prediction, the prediction mode can be a specific intra-frame prediction mode, such as DC, Planar, various intra-frame angle prediction modes, etc. It can also superimpose one or more auxiliary information, such as optimization methods for intra-frame reference pixels, or optimization methods (such as filtering) after generating the initial prediction block. For example, in inter-frame prediction, the prediction mode can be skip mode, merge mode, MMVD (merge with motion vector difference) mode, or AMVP (advanced motion vector prediction), and can be unidirectional, bidirectional, or multi-hypothesis prediction. If the inter-frame prediction mode uses unidirectional prediction, a prediction mode must also be able to determine a motion information, and based on that motion information, a prediction block can be determined. If the inter-frame prediction mode uses bidirectional prediction, a prediction mode must also be able to determine two motion information points, and the prediction block can be determined based on the two motion information points. Thus, the information required for GPM can be expressed as one weighted derivation pattern and two prediction patterns. The weighted derivation pattern is used to determine the weight matrix or weights, and the two prediction patterns each determine a prediction block or prediction value. The weighted derivation pattern is sometimes referred to as a partitioning pattern. However, because it is a simulated partitioning, this application refers to it as a weighted derivation pattern. The two prediction modes can come from the same or different prediction methods, including but not limited to intra-frame prediction, inter-frame prediction, IBC, and palette. Optionally, the two prediction modes can come from the same or different prediction methods, including but not limited to intra-frame prediction, inter-frame prediction, IBC, and palette. A concrete example is as follows: if the current block uses GPM. This example is used in inter-frame coded blocks, allowing the use of merge modes in intra-frame prediction and inter-frame prediction. As shown in Table 4, an additional syntax element `intra_mode_idx` indicates which prediction mode is the intra-frame prediction mode. For example, `intra_mode_idx` of 0 indicates that both prediction modes are inter-frame prediction modes, i.e., `mode0IsInter` is 1 and `mode0IsInter` is 1; `intra_mode_idx` of 1 indicates that the first prediction mode is the intra-frame prediction mode and the second prediction mode is the inter-frame prediction mode, i.e., `mode0IsInter` is 0 and `mode0IsInter` is 1; `intra_mode_idx` of 2 indicates that the first prediction mode is the inter-frame prediction mode and the second prediction mode is the intra-frame prediction mode, i.e., `mode0IsInter` is 1 and `mode0IsInter` is 0; `intra_mode_idx` of 3 indicates that both prediction modes are intra-frame prediction modes, i.e., `mode0IsInter` is 0 and `mode0IsInter` is 0. Table 4 In some embodiments, as shown in Figure 13, the GPM decoding process can be described as follows: Parse the bitstream to determine whether the current block uses GPM technology; if the current block uses GPM technology, determine the weight derivation mode (or partitioning mode or weight matrix derivation mode), and the first prediction mode and the second prediction mode. Determine the first prediction block according to the first prediction mode, the second prediction block according to the second prediction mode, determine the weight matrix according to the weight matrix derivation mode, and determine the prediction block of the current block according to the first prediction block, the second prediction block, and the weight matrix. Template matching was first used in inter-frame prediction. It utilizes the correlation between adjacent pixels to use some regions surrounding the current block as templates. During the encoding and decoding of the current block, its left and top sides are already encoded and decoded according to the encoding order. However, in existing hardware decoder implementations, it's not guaranteed that the left and top sides are already decoded when the current block begins decoding. This applies to inter-frame blocks; for example, in HEVC, inter-coded blocks do not require surrounding reconstructed pixels when generating prediction blocks, allowing the prediction process for inter-frame blocks to run in parallel. However, intra-coded blocks always require reconstructed pixels from the left and top sides as reference pixels. Theoretically, the left and top sides are available, meaning that hardware design adjustments can be made to achieve this. Relatively speaking, the right and bottom sides are not available under current standards like VVC's encoding order. As shown in Figure 14, the rectangular regions on the left and top sides of the current block are set as templates. The height of the template on the left side is generally the same as the height of the current block, and the width of the template on the top side is generally the same as the width of the current block, although they can be different. The optimal matching position of the template is found in the reference frame to determine the motion information or motion vector of the current block. This process can be roughly described as follows: starting from a starting position in a reference frame, a search is performed within a certain range around the current block. Search rules, such as the search range and search step size, can be pre-defined. At each position, the matching degree between the template at that position and the templates surrounding the current block is calculated. The matching degree can be measured by distortion costs, such as SAD (sum of absolute difference) and SATD (sum of absolute transformed difference). SATD typically uses the Hadamard transform or MSE (mean-square error). The smaller the values ​​of SAD, SATD, and MSE, the higher the matching degree. The cost is calculated using the predicted block of the template at that position and the reconstructed blocks of the templates surrounding the current block. Besides searching at integer pixel positions, pixel-level searches can also be performed. The motion information for the current block is determined based on the position with the highest matching degree. Utilizing the correlation between adjacent pixels, motion information suitable for the template may also be suitable for the current block. Of course, template matching may not be applicable to all blocks. Therefore, methods can be used to determine whether to use template matching for the current block, such as using a control switch within the current block to indicate whether template matching is used. One name for this template matching method is DMVD (decoder-side motion vector derivation). Both the encoder and decoder can use the template to search and derive motion information or find better motion information based on existing motion information. It does not require transmitting specific motion vectors or motion vector differences; instead, both the encoder and decoder perform the same search rules to ensure consistency between encoding and decoding. Template matching can improve compression performance, but it requires a "search" in the decoder as well, thus introducing some decoder complexity. The above describes the application of template matching between frames. Template matching can also be used intra-frame, for example, to determine intra-prediction modes using templates. For the current block, a certain range of regions above and to the left of the current block can be used as templates, such as the rectangular regions on the left and top as shown in the diagram above. When encoding and decoding the current block, the reconstructed pixels in the template are available. This process can be roughly described as determining a set of candidate intra-prediction modes for the current block, which constitutes a subset of all available intra-prediction modes. Of course, candidate intra-prediction modes could be the entire set of all available intra-prediction modes. This can be determined based on a trade-off between performance and complexity. The set of candidate intra-prediction modes can be determined based on MPM or rules such as equal-interval filtering. The cost of each candidate intra-prediction mode on the template is calculated, such as SAD, SATD, MSE, etc. Prediction is performed on the template using this mode to create a prediction block, and the cost is calculated using the prediction block and the reconstructed block of the template. Low-cost patterns may be better matched to the template. Leveraging the similarity between adjacent pixels, an intra-prediction pattern that performs well on the template is likely to perform well on the current block as well. One or more low-cost patterns are selected. Of course, the above two steps can be repeated. For example, after selecting one or more low-cost patterns, a new set of candidate intra-prediction patterns can be determined, and the cost can be recalculated for the newly determined set of candidate intra-prediction patterns. One or more low-cost patterns can then be selected. This can also be understood as coarse selection and fine selection. The final selected intra-prediction pattern is determined as the intra-prediction pattern for the current block, or the final selected intra-prediction patterns are used as candidates for the intra-prediction pattern for the current block. Alternatively, the template matching method can be used to sort the set of candidate intra-prediction patterns, such as sorting the MPM list. This involves creating prediction blocks for each pattern in the MPM list on the template, determining the cost, and sorting them in ascending order of cost. Generally, patterns that appear earlier in the MPM list have lower overhead in the bitstream, thus improving compression efficiency. Template matching can be used to determine the two prediction modes of GPM. If template matching is applied to GPM, a single control switch can be used to control whether template matching is used for the two prediction modes of the current block, or two separate control switches can be used to control whether template matching is used for each of the two prediction modes individually. On the other hand, there's the question of how to use template matching. For example, if GPM is used in merge mode, such as GPM in VVC, it uses `merge_gpm_idxX` to determine a motion information from `mergeCandList`, where the uppercase X is 0 or 1. For the Xth motion information, one approach is to optimize it using template matching based on the aforementioned motion information. That is, if a motion information is determined from `merge_gpm_idxX` in `mergeCandList`, and template matching is used for that motion information, then the template matching method is used to optimize it based on the aforementioned motion information. Another approach is not to use `merge_gpm_idxX` to determine a motion information from `mergeCandList`, but instead to directly search for a motion information based on a default motion information. If the Xth prediction mode is an intra-prediction mode, and the Xth prediction mode of the current block uses template matching, then an intra-prediction mode can be determined using template matching without indicating its index in the bitstream. Alternatively, a candidate set or MPM list can be determined using template matching, in which case the index of the intra-prediction mode needs to be indicated in the bitstream. As mentioned above, GPM has three elements: a weight matrix and two prediction modes. The advantage of GPM is its ability to achieve more autonomous combinations through the weight matrix. However, GPM requires more information, thus incurring greater overhead in the bitstream. Taking GPM in VVC as an example, it is used in merge mode. In the bitstream, `merge_gpm_partition_idx`, `merge_gpm_idx0`, and `merge_gpm_idx1` determine the weight matrix, the first prediction mode, and the second prediction mode, respectively. The weight matrix and the two prediction modes each have multiple possible choices; for example, the weight matrix in VVC has 64 possible choices. `merge_gpm_idx0` and `merge_gpm_idx1` are each allowed a maximum of 6 possible choices in VVC, of ​​course, VVC stipulates that `merge_gpm_idx0` and `merge_gpm_idx1` cannot be repeated. Therefore, GPM has 65 x 6 x 5 possible choices. If MMVD is used to optimize two motion information (prediction patterns), multiple possible options can be provided for each prediction pattern. This number is quite large. If GPM uses two intra-prediction modes, and each prediction mode can use one of the 67 common intra-prediction modes in VVC, even if the two intra-prediction modes are different, there are still 64 x 67 x 66 possible choices. Of course, to save overhead, each prediction mode can be restricted to using only a subset of all common intra-prediction modes, but this still leaves many possible choices. Currently, GPM's one weighted derivation mode and two prediction modes need to transmit necessary information in the bitstream according to their respective rules. For example, one weighted 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, the standard can restrict that the second prediction mode cannot be the same as the first prediction mode in certain situations, or certain optimization techniques can be used simultaneously for two prediction modes (this can also be understood as being used in the current block), but the three are relatively independent in terms of writing and parsing syntax elements, that is, more codewords are needed to indicate the weighted derivation mode and prediction mode, resulting in high encoding overhead. To address the aforementioned technical issues, this application combines the weighted derivation mode and the K prediction modes as a single unit. This combination indicates the weighted derivation mode and the K prediction modes used in the current block within the bitstream, thereby saving codewords and improving coding efficiency. The video decoding method provided in this application embodiment will be described below with reference to Figure 15, taking the decoding end as an example. Figure 15 is a schematic flowchart of a video decoding method according to an embodiment of this application. This embodiment is applied to the video decoders shown in Figures 1 and 3. As shown in Figure 15, the method of this embodiment includes: S101. Decode the bitstream to obtain the first index. The first index is used to indicate a first combination consisting of a weighted derived pattern and K prediction patterns, where K is a positive integer greater than 1. As described above, a weighted derivation pattern and K prediction patterns together generate a prediction block. This prediction block acts on the current block; that is, the weight is determined according to the weighted derivation pattern, the K prediction patterns are used to predict the current block, resulting in K predicted values, and these K predicted values ​​are weighted according to the weights to obtain the predicted value for the current block. Therefore, the weighted derivation pattern and the K prediction patterns act as a combination on the current block, and they are related. For example, suppose the current block contains the edges of K relatively moving objects; this is an ideal scenario for inter-frame GPM. Theoretically, this partitioning should occur at the object edges. However, in practice, there are a finite number of possible partitions, and it's impossible to cover all edges. Sometimes, a partition that is close to the object's edge is chosen. In such cases, there might be more than one such partition, and the choice depends on which partition, combined with the K prediction patterns, yields the optimal result. Similarly, the choice of prediction pattern sometimes depends on which combination yields the optimal result, because even in the part using that prediction pattern, it's difficult for this part to perfectly match the current block for natural video. Ultimately, the most efficient coding method might be chosen. Another common application of GPM is when the current block contains parts of an object with relative motion, such as the distorted or deformed areas caused by an arm swing. In such cases, the partitioning is even more ambiguous, and the final decision likely depends on which combination yields the optimal result. Another scenario is intra-frame prediction. It is known that the texture of some parts of a natural image is very complex, some parts have a gradient from one texture to another, and some parts may not be able to be described by a simple direction. Intra-frame GPM can provide more complex prediction blocks. Intra-frame coded blocks usually have larger residuals than inter-frame coded blocks under the same quantization. The choice of which prediction mode may ultimately depend on which combination of results is optimal. Based on the above description, a weighted derivation pattern and K prediction patterns can be used together as a combination on the current block. In order to save codewords and reduce encoding costs, this application embodiment combines the weighted derivation pattern and K prediction patterns corresponding to the current block into a first combination and uses a first index to indicate the first combination. Compared with indicating the weighted derivation pattern and K prediction patterns separately, this application embodiment uses fewer codewords, thereby reducing the encoding cost. Specifically, the encoder determines the first combination corresponding to the current block. This first combination consists of one weighted derived pattern and K prediction patterns. For ease of description, the weighted derived pattern included in the first combination is denoted as the first weighted derived pattern, and the K prediction patterns included in the first combination are denoted as the K first prediction patterns. The encoder uses the first weighted derived pattern and the K first prediction patterns to predict the current block, obtaining the predicted value of the current block. For example, the weight is derived using the first weighted derived pattern, and the K prediction patterns are used to predict the current block to obtain K predicted values. These K predicted values ​​are then weighted according to the derived weights to obtain the predicted value of the current block. Meanwhile, to maintain consistency between the encoding and decoding ends, the encoding end indicates the first combination to the decoding end through the first index, that is, the encoding end writes the first index into the bitstream. The decoding end obtains the first index by decoding the bitstream, and then determines the first combination corresponding to the current block based on the first index, so as to use the first weighted derived mode and K first prediction modes included in the first combination to predict the current block and obtain the predicted value of the current block. This application does not limit the specific syntax element form of the first index in its embodiments. In one possible implementation, if the current block is predicted using GPM technology, then gpm_cand_idx is used to represent the first index. Since the first index is used to indicate the first combination, in some embodiments, the first index may also be referred to as the first combination index or the index of the first combination. In one example, the syntax after adding the first index to the bitstream is shown in Table 5: Table 5 Among them, gpm_cand_idx is the first index. In some embodiments, before decoding the first index, the decoding end first needs to determine whether the current block uses K different prediction modes for weighted prediction processing. If the decoding end determines that the current block uses K different prediction modes for weighted prediction processing, then it executes the above-described S101 decoding of the bitstream to obtain the first index. If the decoding end determines that the current block does not use K different prediction modes for weighted prediction processing, then it skips the above-described S101 step. In one possible implementation, the decoder can determine whether the current block uses K different prediction modes for weighted prediction processing by determining the prediction mode parameters of the current block. Optionally, in the implementation of this application, the prediction mode parameter can indicate whether the current block can use the GPM mode or the AWP mode, that is, whether the current block can use K different prediction modes for prediction processing. It is understood that, in the embodiments of this application, the prediction mode parameter can be understood as a flag indicating whether GPM mode or AWP mode is used. Specifically, the encoder can use a variable as the prediction mode parameter, and thus the prediction mode parameter can be set by setting the value of this variable. For example, in this application, if the current block uses GPM mode or AWP mode, the encoder can set the value of the prediction mode parameter to indicate that the current block uses GPM mode or AWP mode; specifically, the encoder can set the value of the variable to 1. For example, in this application, if the current block does not use GPM mode or AWP mode, the encoder can set the value of the prediction mode parameter to indicate that the current block does not use GPM mode or AWP mode; specifically, the encoder can set the value of the variable to 0. Further, in the embodiments of this application, after the encoder completes the setting of the prediction mode parameter, it can write the prediction mode parameter into the bitstream and transmit it to the decoder, so that the decoder can obtain the prediction mode parameter after parsing the bitstream. Based on this, the decoding end decodes the bitstream to obtain the prediction mode parameters, and then determines whether the current block uses GPM mode or AWP mode according to the prediction mode parameters. If the current block uses GPM mode or AWP mode, that is, when K different prediction modes are used for prediction processing, the weight derivation mode of the current block is determined. In some embodiments, as shown in Table 5, the embodiments of this application may also conditionally limit the use of GPM mode or AWP mode for the current block. That is, when it is determined that the current block meets the preset conditions, it is determined that the current block uses K prediction modes for weighted prediction, and then the decoding end decodes the bit stream to obtain the first index. For example, when applying GPM mode or AWP mode, the size of the current block can be limited. It is understandable that, since the prediction method proposed in this application requires generating K predicted values ​​using K different prediction modes, and then weighting them according to weights to obtain the predicted value of the current block, in order to reduce complexity and consider the trade-off between compression performance and complexity, in the embodiments of this application, the GPM mode or AWP mode can be restricted from being used for blocks of certain sizes. Therefore, in this application, the decoder can first determine the size parameters of the current block, and then determine whether the current block uses the GPM mode or AWP mode based on the size parameters. In embodiments of this application, the size parameters of the current block may include the height and width of the current block. Therefore, the decoder can determine whether the current block uses GPM mode or AWP mode based on the height and width of the current block. For example, in this application, if the width is greater than a first threshold and the height is greater than a second threshold, then the current block is determined to use either GPM mode or AWP mode. It is evident that one possible limitation is to use GPM mode or AWP mode only when the block's width is greater than (or greater than or equal to) the first threshold and the block's height is greater than (or greater than or equal to) the second threshold. The values ​​of the first and second thresholds can be 8, 16, 32, etc., and the first threshold can be equal to the second threshold. For example, in this application, if the width is less than a third threshold and the height is greater than a fourth threshold, then the current block is determined to use either GPM mode or AWP mode. It is evident that a possible limitation is to use GPM mode or AWP mode only when the block's width is less than (or less than or equal to) the third threshold and the block's height is greater than (or greater than or equal to) the fourth threshold. The values ​​of the third and fourth thresholds can be 8, 16, 32, etc., and the third threshold can be equal to the fourth threshold. Furthermore, in the embodiments of this application, the size of the block that can use GPM mode or AWP mode can also be limited by restricting the pixel parameters. For example, in this application, the decoder can first determine the pixel parameters of the current block, and then further determine whether the current block can use GPM mode or AWP mode based on the pixel parameters and a fifth threshold. It is evident that a possible limitation is to use GPM mode or AWP mode only when the number of pixels in the block is greater than (or greater than or equal to) the fifth threshold. The value of the fifth threshold can be 8, 16, 32, etc. In other words, in this application, the current block can only use GPM mode or AWP mode if the size parameters of the current block meet the size requirements. For example, in this application, a frame-level flag can be used to determine whether the current frame to be decoded uses this application. For instance, intra-frame frames (such as I-frames) can be configured to use this application, while inter-frame frames (such as B-frames and P-frames) cannot. Alternatively, intra-frame frames can be configured not to use this application, while inter-frame frames can use it. Or, some inter-frame frames can be configured to use this application, while others cannot. Inter-frame frames can also use intra-frame prediction, and therefore, inter-frame frames may also use this application. In some embodiments, a flag below the frame level and above the CU level (such as tile, slice, patch, LCU, etc.) may be used to determine whether this region is covered by this application. S102. Based on the first index, determine the first weighted derived pattern and K first prediction patterns included in the first combination. After decoding the bitstream and obtaining the first index, the decoding end determines the first weighted derived mode and K first prediction modes included in the first combination based on the first index. In this application, the weight derivation mode is used to determine the weights used in the current block. Specifically, the weight derivation mode can be a mode for deriving weights. For a block of a given length and width, each weight derivation mode can derive a weight matrix; for blocks of the same size, different weight derivation modes will derive different weight matrices. For example, in this application, AWP has 56 weight derivation modes and GPM has 64 weight derivation modes. The K different first prediction patterns included in the first combination mentioned above include the following examples: Example 1: All of the above K different first prediction modes are intra-prediction modes, such as the current block being an intra-coded block and not applicable to screen content encoding. Example 2: All of the above K different first prediction modes are inter-frame prediction modes, such as the current block being an inter-frame coded block. Example 3: Among the K different first prediction modes mentioned above, at least one is an intra-frame prediction mode and at least one is an inter-frame prediction mode. Example 4: Among the K different first prediction modes mentioned above, at least one is an intra-frame prediction mode, and at least one is a non-inter-frame and non-intra-frame prediction mode, such as an intra-block copy (IBC) prediction mode or a palette prediction mode. Example 5: Among the K different first prediction modes mentioned above, at least one is an inter-frame prediction mode, and at least one is a non-inter-frame and non-intra-frame prediction mode, such as an IBC prediction mode or a palette prediction mode. Example 6: None of the above K different first prediction modes are intra-frame prediction modes or inter-frame prediction modes. For example, one is an IBC prediction mode, and another is a palette prediction mode, etc. It should be noted that the embodiments of this application do not limit the specific types of the K different first prediction modes included in the first combination. In this embodiment of the application, the decoding end determines the first weighted derived mode and K first prediction modes included in the first combination based on the first index in the following ways, including but not limited to: Method 1: The encoder and decoder determine the first combination corresponding to the first index from a set of preset candidate combinations. For example, the preset candidate combinations may include any number of candidate combinations such as 2, 3, 4, 5, 6, 7, 8, or 9. Let's assume there are 8 candidate combinations, each including a weighted derived pattern and K prediction patterns, and these 8 candidate combinations have different identifiers (or indices). After obtaining the first index, the decoder searches for the candidate combination corresponding to the first index among these candidate combinations, identifies the candidate combination corresponding to the first index as the first combination, determines the weighted derived pattern included in that candidate combination as the first weighted derived pattern, and determines the K prediction patterns included in that candidate combination as the K first prediction patterns. Method 2: Both the decoder and encoder determine a list containing multiple candidate combinations; this list is also called the candidate combination list. The first combination corresponding to the first index is determined from this candidate combination list. In this case, S102 includes the following steps: S102-A, Determine the candidate combination list; S102-B: Determine the weighted derived pattern and K prediction patterns included in the candidate combination corresponding to the first index in the candidate combination list as the first weighted derived pattern and K first prediction patterns. The candidate combination list includes multiple candidate combinations, and any candidate combination includes a weighted derived pattern and K prediction patterns. For example, the list of candidate combinations is shown in Table 6: Table 6 Candidate combination 0, Candidate combination 1 (including one weighted derived pattern and K prediction patterns), Candidate combination 2 (including one weighted derived pattern and K prediction patterns) ...candidate combination i (including one weighted derived pattern and K predicted patterns)... As shown in Table 6, the candidate combination list includes multiple candidate combinations. No two candidate combinations are exactly the same; that is, the weight-derived patterns and at least one of the K prediction patterns in any two candidate combinations are different. For example, candidate combination 1 and candidate combination 2 may have different weight-derived patterns, or candidate combination 1 and candidate combination 2 may have the same weight-derived patterns but at least one of the K prediction patterns is different, or candidate combination 1 and candidate combination 2 may have different weight-derived patterns and at least one of the K prediction patterns is different. For example, Table 6 above uses the order of candidate combinations in the candidate combination list as the index. Optionally, the index of candidate combinations in the candidate combination list can also be represented in other ways, and this application embodiment does not limit this. In this method 2, the decoding end decodes the bitstream to obtain the first index and determines the candidate combination list as shown in Table 6 above. Based on the first index, it queries the candidate combination list to obtain the first weighted derived mode and K prediction modes included in the first combination indicated by the first index. For example, if the first index is index 1, in the candidate combination list shown in Table 6, the candidate combination corresponding to index 1 is candidate combination 2. That is, the first combination indicated by the first index is candidate combination 2. In this way, the decoder determines the weighted derived mode and K prediction modes included in candidate combination 1 as the first weighted derived mode and K first prediction modes included in the first combination, and uses the first weighted derived mode and K first prediction modes to predict the current block to obtain the predicted value of the current block. In this method 2, the encoder and decoder can each determine the same list of candidate combinations. For example, both the encoder and decoder can determine a list containing N candidate combinations, each candidate combination including one weighted derived mode and K prediction modes. In the bitstream, the encoder only needs to write the finally selected candidate combination, such as the first combination. The decoder parses the first combination finally selected by the encoder. Specifically, the decoder decodes the bitstream, obtains the first index, and determines the first combination from the candidate combination list determined by the decoder using the first index. This application does not limit the specific method by which the decoding end determines the above-mentioned candidate combination list. In some embodiments, the candidate combination list is existing. After the decoding end obtains the first index from the decoded bitstream, it can obtain or read the candidate combination list according to the first index, and then query the candidate combination corresponding to the first index in the candidate combination list according to the first index. In some embodiments, the above candidate combination list is sent from the encoder to the decoder, for example, the encoder sends it to the decoder before encoding the current block. In some embodiments, the candidate combination list is uploaded to the cloud by the encoding end, and the decoding end reads the candidate combination list from the cloud after decoding the bitstream and obtaining the first index. In some embodiments, the candidate combination list is constructed by the decoding end. For example, after decoding the bitstream and obtaining the first index, the decoding end constructs the candidate combination list in response to the first index. This application does not limit the method by which the decoding end constructs the candidate combination list. For example, it can use information related to the current block to analyze the probability of each combination formed by different weighted derivation modes and different prediction modes, and construct the candidate combination list based on the probability of each combination. Optionally, information related to the current block may include pattern information of the surrounding blocks and the reconstructed pixels of the current block. In some embodiments, the decoding end constructs a candidate combination list through the following steps S102-A1: S102-A1: Based on the template of the current block, construct a list of candidate combinations. Template matching utilizes the correlation between adjacent pixels to use regions surrounding the current block as templates. During encoding and decoding of the current block, its left and top sides are already encoded according to the encoding order. During inter-frame prediction, the best matching position of the template is found in the reference frame to determine the motion information or motion vector of the current block. During intra-frame prediction, the template is used to determine the intra-frame prediction mode of the current block. The template of the current block consists of the reconstructed area around the current block and is related to the current block. Based on this, the embodiments of this application construct a candidate combination list based on the template of the current block. This application does not impose any restrictions on the specific shape of the template for the current block. In some embodiments, the template includes at least one of the above encoded region, the left encoded region, and the upper left encoded region of the current block. Optionally, the width of the upper encoded region is the same as the width of the current block, the height of the left encoded region is the same as the height of the current block, the width of the upper left encoded region is the same as the width of the left encoded region, and the height of the upper left encoded region is the same as the height of the upper encoded region. For example, for each combination, the template of the current block is predicted using that combination to obtain the predicted value of the template under each combination, and a candidate combination list is constructed based on the predicted value of the template under each combination. For each combination, the template of the current block is predicted using that combination, resulting in a predicted value for the template under each combination. Specifically, the weights of the template are derived using the weighted derivation modes included in the combination. The template is then predicted using the K prediction modes included in the combination, resulting in K predicted values ​​for the template. Based on the derived template weights, the K predicted values ​​for the template are weighted to obtain the predicted value for the template under that combination. Finally, a candidate combination list is constructed based on the predicted values ​​for the template under each combination. It should be noted that the weights exported according to the weighted export mode described above can be understood as the weights corresponding to each pixel in the exported template, or as the weight matrix corresponding to the exported template. Specifically, when determining the predicted value of the template based on the weights, one can determine K predicted values ​​corresponding to each pixel in the template, and then determine the predicted value corresponding to each pixel based on the K predicted values ​​and their weights. The predicted values ​​corresponding to each pixel in the template constitute the predicted value of the template. Optionally, when determining the predicted value of the template based on the weights, it can also be performed in blocks. For example, to determine the predicted value of the template, the K predicted values ​​of the template can be weighted according to the template's weight matrix to obtain the predicted value of the template. In some embodiments, S102-A1 includes the following steps S102-A11 to S102-A13: S102-A11. Determine R second combinations. Each of the R second combinations includes a weighted derived pattern and K prediction patterns. The weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely the same. R is a positive integer greater than 1. S102-A12. For any of the R second combinations, use the weighted derivation mode and K prediction modes in the second combination to predict the template and obtain the template prediction value corresponding to the second combination. S102-A13. Construct a candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations. In this embodiment, when constructing the candidate combination list, the decoding end first determines R second combinations. This application does not limit the specific value of the R second combinations, for example, 8, 16, 32, etc. Each of the R second combinations includes a weighted derived pattern and K prediction patterns, and the weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely identical. Next, for each of the R second combinations, the template of the current block is predicted using the weighted derived pattern and K prediction patterns included in that second combination, obtaining the predicted value of the template under that second combination. Finally, based on the template prediction value corresponding to each of the R second combinations, a candidate combination list is constructed. The methods for constructing the candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations in S102-A13 above include, but are not limited to, the following: Method 1: Construct a candidate combination list based on the magnitude of the template prediction value corresponding to each of the R second combinations. For example, based on the magnitude of the template prediction value corresponding to each of the R second combinations, the R second combinations are sorted, and the sorted R second combinations are determined as a candidate combination list. At this time, the candidate combination list includes R candidate combinations. For example, based on the magnitude of the template prediction value corresponding to each of the R second combinations, the R second combinations are sorted, and N second combinations are selected from the sorted R second combinations to form a candidate combination list. At this time, the candidate combination list includes N candidate combinations. Method 2, the above S102-A13 includes the following steps: S102-A13-1. Determine the cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination; S102-A13-2. Construct a candidate combination list based on the cost of each of the R second combinations. Since the template of the current block is a reconstructed region, the decoder can obtain the reconstructed value of the template. Therefore, for each of the R second combinations, the prediction distortion cost corresponding to that second combination can be determined based on the predicted value and the reconstructed value of the template. The methods for determining the cost of the second combination include, but are not limited to, SAD, SATD, and SEE. Next, a candidate combination list is constructed based on the cost corresponding to each of the R second combinations. In S102-A13-2, the methods for constructing the candidate combination list based on the cost of each of the R second combinations include, but are not limited to, the following examples: Example 1: Sort the R second combinations according to the cost of each of the R second combinations; determine the R second combinations as a candidate combination list. The candidate combination list generated in Example 1 includes R candidate combinations. Optionally, the R candidate combinations in the candidate combination list are sorted in ascending order of cost, that is, the costs corresponding to the R candidate combinations in the candidate combination list increase sequentially according to the sorting. Specifically, sorting the R second combinations based on the cost of each of the R second combinations can be done by sorting the R second combinations in ascending order of cost. Example 2: Based on the cost corresponding to the second combination, select N second combinations from R second combinations, and determine the list of these N second combinations as the candidate combination list. Optionally, the above N second combinations are the top N second combinations with the smallest cost among the R second combinations. For example, based on the cost corresponding to each of the R second combinations, the N second combinations with the smallest cost are selected from the R second combinations to form a candidate combination list. In this case, the candidate combination list includes N candidate combinations. Optionally, the N candidate combinations in the candidate combination list are sorted in ascending order of cost, that is, the costs corresponding to the N candidate combinations in the candidate combination list increase sequentially according to the sorting. The process of determining R second combinations in S102-A11 above is described below. In some embodiments, the aforementioned R second combinations are preset. Each of the preset R second combinations is used to predict the template of the current block, obtaining a template prediction value corresponding to each second combination. Then, based on the template prediction value and the reconstructed template value, the cost corresponding to each second combination is determined. Based on the cost of each second combination, the R second combinations are sorted, and the sorted R second combinations are used as a candidate combination list. Alternatively, N second combinations with the lowest costs are selected from the sorted R second combinations to form a candidate combination list. In some embodiments, S102-A11 includes the following steps: S102-A11-1. Determine P weighted derived patterns and Q prediction patterns, where P is a positive integer and Q is a positive integer greater than or equal to K; S102-A11-2. Based on P weighted derived patterns and Q prediction patterns, construct R second combinations. Any second combination among the R second combinations includes one weighted derived pattern from the P weighted derived patterns and K prediction patterns from the Q prediction patterns. P are all positive integers and Q are positive integers greater than or equal to K. In this embodiment, the decoding end first determines P weighted derived patterns and Q prediction patterns, and then constructs R second combinations based on the determined P weighted derived patterns and Q prediction patterns. For example, the second combination includes one weighted derived pattern and two prediction patterns. Suppose that there are P weighted derived patterns, namely weighted derived pattern 1 and weighted derived pattern 2, and Q prediction patterns, namely prediction pattern 1, prediction pattern 2 and prediction pattern 3. These two weighted derived patterns and three prediction patterns can be combined into 2 x 3 x 2, a total of 12 second combinations. The embodiments of this application do not limit the specific number of the above-mentioned P weighted derivation modes and Q prediction modes. In one possible implementation, assuming the current block is an intra-coded block, it is assumed that there are 64 possible weighted derivation modes and 67 possible intra-prediction modes for the GPM, which can be found in the VVC standard. However, this does not limit the possible weights of the GPM to only 64, or any specific 64. It should be noted that the reason VVC chooses 64 weights for its GPM is a trade-off between improved prediction performance and increased overhead in the bitstream. This application, however, does not use a fixed logic to encode the weighted derivation modes, so theoretically, this application can use a wider variety of weights and employ them more flexibly. Similarly, it does not limit the intra-prediction modes of the GPM to only 67, or any specific 67. Theoretically, all possible intra-prediction modes can be used in the GPM. For example, if the intra-angle prediction mode is made more refined, generating more intra-angle prediction modes, then the GPM can also use more intra-angle prediction modes. For example, VVC's MIP (matrix-based intra prediction) mode can also be used in this application, but considering that MIP has multiple sub-modes to choose from, MIP is not included in this embodiment for ease of understanding. There are also some wide-angle modes that can be used in this application, but they will not be described in this embodiment. Assuming K=2, the above K prediction modes include the first prediction mode and the second prediction mode. Assuming there are 67 available prediction modes (i.e., Q=67), the first prediction mode has 67 possibilities. Since the second prediction mode is different from the first prediction mode, there are 66 possibilities for the second prediction mode. Assuming there are 64 weighted derivation modes (i.e., P=64), then this application may use any two different prediction modes and any weighted derivation mode to form a second combination, for a total of 64*67*66 possible second combinations. In this implementation, the P weighted derived modes represent all possible weighted derived modes, such as the 64 weighted derived modes in GPM, and the Q prediction modes represent all possible prediction modes, such as the 67 intra-frame prediction modes in GPM. An exhaustive method is used to obtain all possible second combinations, for example, 64*67*66 possible second combinations. 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, based on the distortion cost of each second combination, the candidate combination list corresponding to the current block is obtained. In some embodiments, in order to reduce the amount of data and improve the speed of building the candidate combination list, not every prediction mode is tried, but only some prediction modes are selected for trying. At this point, the methods for determining the Q prediction modes in S102-A11-1 above include, but are not limited to, the following: Method 1: Q prediction patterns are preset prediction patterns. Method 2: Determine at least one of the following: the candidate prediction mode list for the current block, the alternative prediction mode list corresponding to each of the K prediction modes, and the prediction mode corresponding to the weighted derivation mode. Based on the candidate prediction mode list, the alternative prediction mode list corresponding to each of the K prediction modes, and the prediction mode corresponding to the weighted derivation mode, determine Q prediction modes. The candidate prediction mode list includes multiple candidate prediction modes, and the alternative prediction mode list corresponding to any one of the K prediction modes includes at least one alternative prediction mode. For example, Q prediction patterns are determined based on the list of candidate prediction patterns for the current block. For example, based on the list of alternative prediction modes corresponding to the K prediction modes, Q prediction modes are determined. For example, based on the prediction patterns corresponding to the weighted patterns, Q prediction patterns are determined. For example, based on the candidate prediction mode list of the current block and the alternative prediction mode list corresponding to each of the K prediction modes, Q prediction modes are determined. For example, based on the candidate prediction mode list of the current block and the prediction mode corresponding to the weighted derived mode, Q prediction modes are determined. For example, based on the list of candidate prediction modes corresponding to the K prediction modes and the prediction mode corresponding to the weighted derived mode, Q prediction modes are determined. For example, based on the candidate prediction mode list, the alternative prediction mode list corresponding to the K prediction modes, and the prediction mode corresponding to the weighted derived mode, Q prediction modes are determined. Determining the candidate prediction mode lists corresponding to the K prediction modes can be understood as identifying a candidate prediction mode list for each of the K prediction modes. When constructing the second combination later, a prediction mode in the second combination is selected from the candidate prediction mode list corresponding to that prediction mode. For example, if K=2, and the K prediction modes include a first prediction mode and a second prediction mode, the decoder constructs a candidate prediction mode list 1 for the first prediction mode and a candidate prediction mode list 2 for the second prediction mode. Thus, when constructing different second combinations later, a candidate prediction mode is selected from candidate prediction mode list 1 as the first prediction mode, and a candidate prediction mode is selected from candidate prediction mode list 2 as the second prediction mode. This weighted derived mode, along with the currently selected first and second prediction modes, forms a second combination. The embodiments of this application do not limit the method for determining the list of alternative prediction modes corresponding to each of the K prediction modes. In one possible implementation, for any prediction mode among K prediction modes, a candidate prediction mode list corresponding to the prediction mode is determined, as well as at least one of the prediction modes corresponding to the weight-derived mode; based on the candidate prediction mode list and at least one of the prediction modes corresponding to the weight-derived mode, an alternative prediction mode list corresponding to the prediction mode is determined. In this embodiment of the application, the process of determining the candidate prediction mode list corresponding to a certain prediction mode among K prediction modes is basically similar to the process of determining the candidate prediction mode list corresponding to the current block, and can be referred to the following description for details. In some embodiments, the candidate prediction mode list includes one or more inter-frame prediction modes, such as at least one of skip, merge, normal inter-frame prediction mode, one-way prediction, two-way prediction, and multiple hypothesis prediction. In some embodiments, the candidate prediction mode list includes one or more intra-frame prediction modes, such as at least one of Direct Current (DC) mode, Planar mode, Angular mode, etc. Optionally, the candidate prediction mode list includes at least one intra-frame prediction mode from the MPM list. In some embodiments, the above-mentioned candidate prediction pattern list may also include patterns such as IBC and palette. This application does not impose any restrictions on the type or number of prediction modes included in the above candidate prediction mode list. In some embodiments, the candidate prediction pattern list is determined by at least one of the following methods: Method 1: The aforementioned candidate prediction pattern list includes preset patterns. Method 2: The aforementioned candidate prediction pattern list includes patterns from the MPM list. In some embodiments, the candidate intra-prediction mode list can be the MPM list of the current block. For example, in VVC, the current block can obtain an MPM list of length 6. Furthermore, in some subsequent technological evolutions, there is a secondary MPM scheme that may derive an MPM list of length 22; that is, the combined length of the first and second MPM lists is 22. In other words, embodiments of this application can use MPMs to filter intra-prediction modes. In some embodiments, if the preset mode is not included in the candidate prediction mode list determined above, the preset mode is added to the candidate prediction mode list. Optionally, the preset modes mentioned above include at least one of DC, horizontal mode, and vertical mode. Optionally, preset modes can be added under certain conditions. One example is adding a mode when the number of prediction modes in the candidate prediction modes is less than or equal to a threshold, such as 3, 4, 5, 6, etc. Method 3: The aforementioned candidate prediction pattern list includes a set of candidate prediction patterns determined according to certain rules, such as equal interval filtering. Method 4: Determine a list of candidate prediction modes based on the prediction modes used by at least one block adjacent to the current block. For example, the prediction modes used by one or more blocks adjacent to the current block are added to the candidate prediction mode list to obtain the candidate prediction mode list for the current block, or the candidate prediction mode list corresponding to the kth prediction mode among K prediction modes is obtained, where the kth prediction mode is any one of the K prediction modes. For example, the prediction mode corresponding to the k-th prediction mode among the prediction modes used by one or more blocks adjacent to the current block can be added to the candidate prediction mode list corresponding to the k-th prediction mode. For instance, suppose K=2, the k-th prediction mode is the first prediction mode, and the two blocks adjacent to the current block also use two prediction modes for weighted prediction. The first adjacent block uses prediction mode 1 and prediction mode 3, and the second adjacent block uses prediction mode 4 and prediction mode 5. In this case, prediction mode 1 and prediction mode 4 can be added to the candidate prediction mode list corresponding to the first prediction mode. It should be noted that methods 1 to 4 above can be used individually or in any combination to determine the list of candidate prediction modes. In some embodiments, the candidate prediction mode list includes at least one of a candidate intra-frame prediction mode list and a candidate inter-frame prediction mode list. Specifically, the candidate intra-frame prediction mode list includes at least one candidate intra-frame prediction mode, and the candidate inter-frame prediction mode list includes at least one candidate inter-frame prediction mode. After obtaining the candidate prediction mode list for the current block using the above method, Q prediction modes are determined based on the candidate prediction mode list. For example, all or part of the candidate prediction modes included in the candidate prediction mode list are determined as all or part of the Q prediction modes. The process of determining the prediction model corresponding to the weighted derivation model is described below. In this embodiment, the prediction mode corresponding to the weight derivation mode is a general term, such as a prediction mode corresponding to a preset weight derivation mode, or a prediction mode corresponding to several preset weight derivation modes. In some embodiments, the prediction mode corresponding to the weight derivation mode can also be understood as a list of prediction modes corresponding to the weight derivation mode, and the list of prediction modes includes at least one prediction mode. In some embodiments, the prediction mode corresponding to the weight derivation mode includes the prediction mode corresponding to at least one of the P weight derivation modes. In this case, determining the prediction mode corresponding to the weight derivation mode includes: for the p-th weight derivation mode among the P weight derivation modes, determining the prediction mode corresponding to the p-th weight derivation mode; and determining the prediction mode corresponding to the weight derivation mode based on the prediction mode corresponding to at least one of the P weight derivation modes, where p is a positive integer. In this embodiment of the application, the process of determining the prediction mode corresponding to each of the P weighted derivation modes is basically the same. For ease of description, the p-th weighted derivation mode among the P weighted derivation modes will be used as an example for the following explanation. The prediction mode corresponding to the p-th weighted derived mode can be determined in the following two ways: Method 1: If at least one of the prediction modes corresponding to the p-th weighted derived mode is an intra-prediction mode, determine the angle index according to the p-th weighted derived mode; determine the intra-prediction mode corresponding to the angle index as at least one of the prediction modes corresponding to the p-th weighted derived mode. The angle index is used to indicate the boundary angle index of the weights. In some embodiments, the angleIdx field represents the angle index. Table 2 above shows the correspondence between merge_gpm_partition_idx and angleIdx. Referring to Table 2 above, the angle index can be derived according to the p-th weight derivation mode. In this application, the angle index and the intra-frame prediction mode have a corresponding relationship, that is, different angle indices correspond to different intra-frame prediction modes. For example, the correspondence between angle index and intra-frame prediction mode is shown in Table 7: Table 7 angleIdx intra-frame prediction mode 050242338434530…… In this method, taking K=2 as an example, if the first or second prediction mode is an intra-prediction mode, the angle index is determined according to the p-th weighted derived mode. For example, according to Table 2 above, the angle index corresponding to the p-th weighted derived mode is derived. Then, in Table 7 above, the intra-prediction mode corresponding to the angle index is determined. For example, if the angle index is 2, its corresponding intra-prediction mode is 42, and then the intra-prediction mode 42 is determined as the first or second prediction mode. Method 2: If at least one of the prediction modes corresponding to the p-th weighted derivation mode is an intra-prediction mode, determine the intra-prediction mode corresponding to the p-th weighted derivation mode; determine at least one of the intra-prediction modes corresponding to the p-th weighted derivation mode as at least one of the prediction modes corresponding to the p-th weighted derivation mode. The intra-prediction mode corresponding to the p-th weight derivation mode includes at least one of the following: an intra-prediction mode in which the prediction direction is parallel to the weight boundary line, an intra-prediction mode in which the prediction direction is perpendicular to the boundary line, and a planar mode. It should be noted that intra-prediction modes with prediction directions parallel to the weight boundary include one or more intra-prediction modes with prediction directions parallel or approximately parallel to the weight boundary. Intra-prediction modes with prediction directions perpendicular to the weight boundary include one or more intra-prediction modes with prediction directions perpendicular or approximately perpendicular to the weight boundary. In this second method, taking K=2 as an example, if the first prediction mode and / or the second prediction mode are intra-frame prediction modes, the first prediction mode and / or the second prediction mode are determined from the intra-frame prediction modes corresponding to the weight-derived modes. For example, the first prediction mode and / or the second prediction mode can be intra-frame prediction modes that are on the same straight line or approximately on the same straight line as the weight dividing line (also called the boundary line). Alternatively, the first prediction mode and / or the second prediction mode can be intra-frame prediction modes whose prediction direction is perpendicular to or approximately perpendicular to the weight dividing line. For example, if the weight dividing line is horizontal, as shown in Figure 4 with GPM indices of 18, 19, 50, and 51, the first prediction mode and / or the second prediction mode is either the horizontal mode 18 or the vertical mode 50. Based on the above steps, the decoding end determines the prediction mode corresponding to at least one of the P weighted derived modes. Then, based on the prediction mode corresponding to at least one of the P weighted derived modes, it determines the prediction mode corresponding to the weighted derived mode. For example, all or part of the prediction modes corresponding to at least one of the P weighted derived modes are used as the prediction mode corresponding to the weighted derived mode. Furthermore, among the prediction modes corresponding to the P weighted derived modes, there may be duplicate prediction modes. In this case, the duplicate prediction modes are removed, and the remaining different prediction modes are determined as the prediction modes corresponding to the weighted derived modes. In this embodiment of the application, in order to reduce the number of R second combinations, the prediction patterns are screened, specifically by determining Q prediction patterns according to the above method. In some embodiments, in order to reduce the complexity of the decoding end, the number of the above Q prediction modes is limited. For example, Q is less than or equal to a first preset threshold. This application does not limit the specific value of the first preset threshold, which can be determined according to actual needs. For example, the first preset threshold is 6, that is, 6 prediction modes are selected to construct R second combinations to control the number of second combinations. In some embodiments, the size of Q is related to the size and / or shape of the current block, wherein the shape of the current block can be understood as being determined by the aspect ratio of the current block. During prediction, for smaller blocks, similar prediction patterns have little impact on the prediction results, while for larger blocks, the difference in impact becomes more pronounced. Therefore, embodiments of this application assign different Q values ​​to blocks of different sizes; that is, larger Q values ​​are assigned to larger blocks, and smaller Q values ​​are assigned to smaller blocks. At this point, when determining the Q value corresponding to the current block, it is set according to the size of the current block. For example, if the size of the current block is greater than the first value, then Q is greater than or equal to the second preset threshold. As another example, if the size of the current block is less than or equal to the first value, then Q is less than the third preset threshold. This application embodiment does not limit the specific sizes of the first value, the second prediction threshold, and the third preset threshold, wherein the third preset threshold is less than the second preset threshold. The process of determining P weight derivation modes in S102-A11-1 is described below. As can be seen from the above, GPM includes 64 weight derivation modes, and AWP includes 56 weight derivation modes. In some embodiments, the P weighted export patterns are the 64 weighted export patterns included in GPM, or the 56 weighted export patterns included in AWP. In some embodiments, P weight derivation patterns are selected from M preset weight derivation patterns, where M is a positive integer greater than or equal to P. The aforementioned preset M weight export modes can be the 64 weight export modes included in GPM, or the 56 weight export modes included in AWP, or a partial weight export mode of the 64 weight export modes included in GPM, or a partial weight export mode of the 56 weight export modes included in AWP. In this embodiment, in order to further reduce the number of R second combinations, the preset M weight derivation modes are filtered, and P weight derivation modes can be selected from the preset M weight derivation modes to construct R second combinations. In some embodiments, weight export patterns corresponding to preset division angles and / or preset offsets are removed from M weight export patterns to obtain P weight export patterns. Since the same division angle can correspond to multiple offsets in a weight export pattern, as shown in weight export patterns 10, 11, 12, and 13 in Figure 16A, they have the same division angle but different offsets. This allows for the removal of some weight export patterns corresponding to preset offsets, and / or some weight export patterns corresponding to preset division angles. This reduces the total number of possible second combinations and makes the differences between the various possible second combinations more obvious. In some embodiments, different blocks may have different filtering conditions. Thus, when determining the P weight export modes corresponding to the current block, the filtering conditions corresponding to the current block are first determined, and P weight export modes are selected from the M weight export modes based on the filtering conditions corresponding to the current block. In some embodiments, the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block. During prediction, for smaller blocks, similar weight derivation patterns have little difference in impact on the prediction results, while for larger blocks, the difference in impact is more pronounced. Based on this, embodiments of this application assign different P values ​​to blocks of different sizes; that is, larger P values ​​are assigned to larger blocks, and smaller P values ​​are assigned to smaller blocks. In some embodiments, the above filtering conditions include an array containing M elements, each of which corresponds one-to-one with one of the M weighted export patterns. The element corresponding to each weighted export pattern is used to indicate whether the weighted export pattern is available. Whether a weighted export pattern is available can be understood as whether the weighted export pattern is used to form one of the P weighted export patterns for a subsequent second combination attempt. The array above can be a single-digit number or a two-digit number. For example, taking GPM as an example, there are M weight export patterns, which are 64. We set up an array containing 64 elements, where each element's value indicates whether its corresponding weight export pattern is available. Taking a single-digit value as an example, a specific example is as follows: setting up an array of `g_sgpm_splitDir`: g_sgpm_splitDir

[0064] ={ 1,1,1,0,1,0,1,0, 1,0,1,0,1,0,1,0, 1,0,1,1,1,0,1,0, 1,0,1,0,1,0,1,0, 0,0,0,0,1,1,0,1, 0,0,1,0,0,1,0,0, 1,0,1,1,0,1,0,0, 1,0,0,1,0,0,1,0 }; In this case, a value of 1 for g_sgpm_splitDir[x] indicates that the weight export mode at index x is available, while a value of 0 indicates that the weight export mode at index x is not available. In some embodiments, if the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and filtering conditions corresponding to the shape of the current block, and for the same weight export mode, if the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicate that the weight export mode is available, then the weight export mode is determined to be one of P weight export modes. If at least one of the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicates that the weight export mode is unavailable, then the weight export mode is determined not to constitute P weight export modes. In some embodiments, multiple arrays can be used to implement the filtering conditions corresponding to different block sizes and different block shapes. In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes can be implemented using a two-dimensional array. That is, a two-dimensional array includes both filtering conditions corresponding to block size and filtering conditions corresponding to block shape. For example, the filtering criteria for a block of size A and shape B are shown below, and these criteria are represented by a two-dimensional array: g_sgpm_splitDir

[0064] ={ (1,1),(1,1),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (1,1),(0,0),(1,1),(1,0),(1,0),(0,0),(1,0),(1,1), (0,1),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0),(0,0), (1,1),(0,0),(0,1),(1,0),(1,0),(1,0),(1,0),(0,0), (0,0),(0,0),(1,1),(0,0),(1,1),(1,1),(1,0),(0,1), (0,0),(0,0),(1,1),(0,0),(1,0),(0,0),(1,0),(0,0),(0,0), (1,0),(0,0),(1,1),(1,0),(1,0),(1,0),(0,0),(0,0), (1,1),(0,0),(1,1),(0,0),(0,0),(1,0),(1,1),(0,0) }; In this context, a value of 1 for all values ​​of g_sgpm_splitDir[x] indicates that the weight export mode at index x is available, while a value of 0 for any of the values ​​in g_sgpm_splitDir[x] indicates that the weight export mode at index x is not available. For example, g_sgpm_splitDir[4] = (1,0) means that weight export mode 4 is available for blocks of size A, but not for blocks of shape B. Therefore, if the block size is A and the shape is B, the weight export mode is not available. After determining Q prediction modes and P weighted derivation modes based on the above steps, the decoding end then forms R different second combinations based on these Q prediction modes and P weighted derivation modes. In some embodiments, to further improve the construction speed of the candidate combination list, the decoding end further filters the Q prediction modes and P weighted derivation modes determined above. At this time, the steps in S102-A11-2 above, which form R second combinations based on the determined P weighted derivation modes and Q prediction modes, include the following steps S102-A11-21 to S102-A11-23: S102-A11-21. Select S weight derivation patterns from P weight derivation patterns, where S is a positive integer less than or equal to P. Specifically, from the P weight derivation patterns determined above, weight derivation patterns with low probability of occurrence are removed to obtain S weight derivation patterns after filtering. Among them, the methods for selecting S weight derivation patterns from P weight derivation patterns in S102-A11-21 above include, but are not limited to, the following: Method 1: For the i-th weighted export pattern among P weighted export patterns, determine the weights of K second prediction patterns on the template based on the i-th weighted export pattern. The K second prediction patterns are any K prediction patterns among Q prediction patterns, where i is a positive integer from 1 to P. If the weight of any prediction pattern among the K prediction patterns on the template is less than the first preset value, then remove the i-th weighted export pattern from the P weighted export patterns to obtain S weighted export patterns. In Method 1, if a weighted derivation pattern derives template weights that result in a prediction pattern having little or no influence on the template, then that weighted derivation pattern is not used. For example, weighted derivation pattern 52 in Figure 4 (the square block) results in a small weight for the second prediction pattern on the template. Another example is weighted derivation pattern 54, which results in a weight of 0 for the second prediction pattern on the template. In other words, under weighted derivation pattern 54, the second prediction pattern has no influence on the template, and the predicted value of the template is entirely determined by the first prediction pattern. In this case, the second prediction pattern has no effect whatsoever, and such weighted derivation patterns need to be removed from the P weighted derivation patterns. It should be noted that the same weighted derivation pattern for blocks of different shapes may result in different effects for the two prediction patterns. Since the current block may be a square or a rectangle, its length may be greater than its width, or vice versa, and the ratio may be 1:2, 1:4, etc. Figures 16A and 16B show the weighted derivation patterns of GPM for 32x64 and 64x32 blocks. It can be seen that the intersection point of the boundary line of the same weighted derivation pattern with the block boundary is different under different shapes. This is because the block shape changes, but the angle of the boundary line does not change accordingly. As shown in Figure 16A, for the weighted derivation pattern with index 52 in a 32x64 block, when the boundary of the weighted derivation pattern with index 52 is extended towards the template area of ​​the current block, it intersects with the template area, making the weight of the second prediction pattern in the template no less than the preset value. This indicates that the second prediction pattern has an influence on the template. However, as shown in Figure 16B, the same weighted export pattern with index 52, when its interface is delayed to the template region of the current block in a 64x32 block, does not intersect with the template region, resulting in the second prediction pattern having a weight of 0 in the template. This means that the second prediction pattern has no effect in the template. In the above method 1, the weight export patterns that make the weight of any one of the K prediction patterns on the template less than the first preset value are removed from the P weight export patterns, resulting in S weight export patterns. The embodiments of this application do not limit the specific value of the first preset value, for example, it can be a smaller value that is greater than or equal to 0. Method 2: For the i-th weight export pattern among the P weight export patterns, determine the cost of using the i-th weight export pattern to predict the template, where i is a positive integer from 1 to P; based on the cost corresponding to the i-th weight export pattern, select S weight export patterns from the P weight export patterns. In this method 2, S weight export patterns are selected from the P weight export patterns by calculating the cost corresponding to each weight export pattern among the P weight export patterns. In this embodiment of the application, the weighted derivation mode and K prediction modes are combined as a group for cost calculation. Thus, for ease of calculation, based on the given K prediction modes, the cost of P weighted derivation modes is calculated. That is, the P weighted derivation modes are combined with the set K prediction modes to obtain P combinations. The cost corresponding to each of these P combinations is calculated to obtain the cost of the P weighted derivation modes. For example, suppose we have K prediction patterns, namely prediction pattern 1 and prediction pattern 2. For the i-th weighted derived pattern among P weighted derived patterns, the i-th weighted derived pattern forms a combination with prediction pattern 1 and prediction pattern 2, denoted as combination i. Using combination i, we predict the template of the current block, obtaining the predicted value of the template under combination i. Based on the predicted value and the reconstructed value of the template under combination i, we determine the prediction distortion cost corresponding to combination i. This prediction distortion cost corresponding to combination i is then determined as the cost corresponding to the i-th weighted derived pattern. In this way, we can determine the cost corresponding to any weighted derived pattern among the P weighted derived patterns. Based on the above method, after determining the cost corresponding to the i-th weight export pattern among the P weight export patterns, S weight export patterns are selected from the P weight export patterns according to the cost corresponding to the i-th weight export pattern. In this method 2, the decoding end selects S weight export modes from P weight export modes based on the cost corresponding to the i-th weight export mode, including the following methods: In the first approach, if the cost corresponding to the i-th weighted derivation pattern is less than the second preset value, then a weighted derivation pattern similar to the i-th weighted derivation pattern is selected from the P weighted derivation patterns. Based on the i-th weighted derivation pattern and its similar weighted derivation patterns, S weighted derivation patterns are determined. The similar weighted derivation patterns of the i-th weighted derivation pattern can be understood as weighted derivation patterns whose prediction results are similar to those of the i-th weighted derivation pattern. For example, similar weighted derivation patterns include weighted derivation patterns with a partition angle similar to that of the i-th weighted derivation pattern, and / or weighted derivation patterns with an offset similar to that of the i-th weighted derivation pattern. The offset of a weighted derivation pattern can also be understood as the intercept of the boundary line of that weighted derivation pattern on the edge of the current block. For example, the above-mentioned similar division angles can include the same division angle but different offsets, such as weight export mode 11 and weight export mode 13 in Figure 4. It can also include the same division angle and similar offsets, such as weight export mode 11 and weight export mode 12 in Figure 4. It can also include similar division angles but different offsets, such as weight export mode 9 and weight export mode 11 in Figure 4. It can also include similar division angles and similar offsets, such as weight export mode 9 and weight export mode 12 in Figure 4. For example, the above-mentioned similar offsets can include offsets that are similar and have the same division angle, such as weight export mode 29 and weight export mode 30 in Figure 4, and also include offsets that are the same or similar and have similar division angles, such as weight export mode 2 and weight export mode 38 in Figure 4. In some embodiments, a similar weight export pattern to the i-th weight export pattern can be understood as a weight export pattern whose index is close to that of the i-th weight export pattern. In this first approach, if the cost corresponding to the i-th weighted derivation pattern is less than the second preset value, it indicates that using the i-th weighted derivation pattern to predict the current block may achieve a better prediction effect. In this case, the i-th weighted derivation pattern is selected from the P weighted derivation patterns to construct the subsequent R second combinations. Furthermore, since weighted derivation patterns similar to the i-th weighted derivation pattern have similar characteristics, similar weighted derivation patterns are selected from the P weighted derivation patterns to construct the subsequent R second combinations. Next, from the remaining weighted derivation patterns among the P weighted derivation patterns, one weighted derivation pattern is selected as the new i-th weighted derivation pattern, and the above steps are repeated to obtain S weighted derivation patterns. The embodiments of this application do not limit the size of the second preset value, but determine it according to actual needs. In some embodiments, the decoding end can also select S weight export modes from P weight export modes according to the second method below. In the second approach, if the cost corresponding to the i-th weight export pattern is greater than the third preset value, then the i-th weight export pattern and its similar weight export patterns are removed from the P weight export patterns to obtain at least one weight export pattern after removal; based on the at least one weight export pattern after removal, S weight export patterns are determined. In this second approach, if the cost corresponding to the i-th weighted derived pattern is less than the third preset value, it indicates that using the i-th weighted derived pattern to predict the current block may not achieve a good prediction effect. In this case, the i-th weighted derived pattern is removed from the P weighted derived patterns. Furthermore, since weighted derived patterns similar to the i-th weighted derived pattern have similar characteristics, these similar weighted derived patterns are also removed from the P weighted derived patterns, resulting in a set of removed weighted derived patterns. Next, from this set, a weighted derived pattern is selected as the new i-th weighted derived pattern. The above steps are repeated until the final set of weighted derived patterns includes S weighted derived patterns. The embodiments of this application do not limit the size of the third preset value, but determine it according to actual needs. The third preset value is greater than the second preset value. Based on the above steps, after the decoding end selects S weight export modes from P weight export modes, it executes the following steps S102-A11-22. S102-A11-22. Select T prediction patterns from Q prediction patterns, where T is a positive integer less than or equal to Q. This application does not limit the method of selecting T prediction modes from Q prediction modes in the embodiments. In some embodiments, T preset prediction patterns are selected from Q prediction patterns. In some embodiments, for the i-th prediction mode among the Q prediction modes, the decoder determines the cost of using the i-th prediction mode to predict the template, where i is a positive integer from 1 to Q; and selects T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode. In this embodiment of the application, the weighted derivation mode and K prediction modes are combined as a group for cost calculation. Thus, for ease of calculation, based on the given weighted derivation mode and other K-1 prediction modes, the cost of Q weighted derivation modes is calculated. That is, the Q prediction modes are combined with the set weighted derivation mode and K-1 prediction modes respectively to obtain Q combinations. The cost corresponding to each of these Q combinations is calculated to obtain the cost of the Q prediction modes. For example, suppose we have K-1 prediction patterns, designated as prediction pattern 1, and a weighted derived pattern, designated as weighted derived pattern 1. For the i-th prediction pattern among the Q prediction patterns, weighted derived pattern 1, along with the i-th prediction pattern and prediction pattern 1, forms a combination, denoted as combination i. Using combination i, we predict the template of the current block, obtaining the predicted value of the template under combination i. Based on the predicted value and the reconstructed value of the template under combination i, we determine the prediction distortion cost corresponding to combination i. This prediction distortion cost corresponding to combination i is then used as the cost corresponding to the i-th prediction pattern. This allows us to determine the cost corresponding to any one of the Q prediction patterns. Based on the above method, after determining the cost corresponding to the i-th prediction mode among the Q prediction modes, T prediction modes are selected from the Q prediction modes according to the cost corresponding to the i-th prediction mode. The decoding end selects T prediction modes from Q prediction modes based on the cost corresponding to the i-th prediction mode, including the following methods: In the first approach, if the cost corresponding to the i-th prediction mode is less than the fourth preset value, then a prediction mode similar to the i-th prediction mode is selected from the Q prediction modes. Based on the i-th prediction mode and the similar prediction modes of the i-th prediction mode, T prediction modes are determined. Here, a prediction mode similar to the i-th prediction mode can be understood as a prediction mode whose prediction result is similar (or close) to the prediction reception of the i-th prediction mode. For example, a prediction mode whose prediction direction (or angle) is close to the prediction direction (or angle) of the i-th prediction mode, or a prediction mode whose prediction mode index is close to the index of the i-th prediction mode. For example, a prediction mode whose index is 1 or 2 larger than the index of the i-th prediction mode, or a prediction mode whose index is 1 or 2 smaller than the index of the i-th prediction mode. In this first approach, if the cost corresponding to the i-th prediction mode is less than the fourth preset value, it indicates that using the i-th prediction mode to predict the current block may achieve a better prediction effect. In this case, the i-th prediction mode is selected from the Q prediction modes to construct the subsequent R second combinations. Furthermore, since prediction modes similar to the i-th prediction mode have similar characteristics, similar prediction modes are selected from the Q prediction modes to construct the subsequent R second combinations. Next, from the remaining prediction modes of the Q prediction modes, one prediction mode is selected as the new i-th prediction mode, and the above steps are repeated to obtain T prediction modes. The embodiments of this application do not limit the size of the fourth preset value mentioned above, and the specific value is determined according to actual needs. The second approach is to remove the i-th prediction mode and its similar prediction modes from the Q prediction modes to obtain at least one prediction mode after removal; and to determine T prediction modes based on the at least one prediction mode after removal. In this second approach, if the cost corresponding to the i-th prediction mode is greater than the fifth preset value, it indicates that using the i-th prediction mode to predict the current block may not achieve a satisfactory prediction effect. 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, these similar prediction modes are also removed from the Q prediction modes, resulting in a set of removed prediction modes. Next, from this set of removed prediction modes, one prediction mode is selected as the new i-th prediction mode. The above steps are repeated until the final set of prediction modes includes T prediction modes. In this application embodiment, the size of the fifth preset value is not limited, but is determined according to actual needs. The fifth preset value is greater than the fourth preset value. Based on the above steps, select S weighted export patterns from P weighted export patterns, select T prediction patterns from Q prediction patterns, and then execute the following S102-A11-23. S102-A11-23. Based on S weighted derived patterns and T prediction patterns, R second combinations are formed. Specifically, select one weighted derived pattern from S weighted derived patterns, and select K prediction patterns from T prediction patterns. This weighted derived pattern and the K prediction patterns form a second combination. Repeat this step to obtain R second combinations. As can be seen from the above, a second combination includes a weighted derivation pattern and K prediction patterns. In this way, when selecting prediction patterns, the possible selection of another element can be restricted when the K elements in a combination are fixed. For example, when K=2, the possible selection of the other element can be restricted when it is used in combination with two of the elements. The following section uses the process of selecting another prediction mode when the weighted derivation mode and one prediction mode are fixed as an example to introduce one implementation process of the above S102-A11-2. In some embodiments, S102-A11-2 includes: for the i-th weighted derivation mode among P weighted derivation modes, determining the cost of using the i-th weighted derivation mode and the j-th prediction mode among Q prediction modes to predict the template; if the cost corresponding to the combination of the i-th weighted derivation mode and the j-th prediction mode is greater than a sixth preset value, then removing the j-th prediction mode and similar prediction modes of the j-th prediction mode from the Q prediction modes to obtain at least one prediction mode after removal; and constructing R second combinations based on the i-th weighted derivation mode and the at least one prediction mode after removal. In this embodiment, when the weighted derivation mode and one prediction mode are fixed, the other prediction mode is selected. For example, if a certain intra-prediction mode under a certain weighted derivation mode cannot achieve a relatively low cost as the first prediction mode, then the intra-prediction mode similar to that intra-prediction mode under that weighted derivation mode will no longer be tried as the first prediction mode. Specifically, for the i-th weight-derived pattern among P weight-derived patterns, assuming K=2, this combination includes the i-th weight-derived pattern, the first prediction pattern, and the second prediction pattern. Assume the second prediction pattern is set as prediction pattern 1. This prediction pattern 1 can be one of the Q prediction patterns or another prediction pattern outside the Q prediction patterns. The possible selection of the first prediction pattern from the Q prediction patterns is determined by taking the j-th prediction pattern from the Q prediction patterns as the first prediction pattern. Then, when the combination j (composed of the i-th weight-derived pattern, the j-th prediction pattern, and prediction pattern 1) predicts the template, the predicted value of the template is determined. Based on this predicted value, the cost corresponding to combination j is determined, and the cost corresponding to combination j is set as the cost corresponding to the j-th prediction pattern. Next, it is determined whether the cost corresponding to the j-th prediction mode is greater than the sixth preset value. If the cost corresponding to the j-th prediction mode is greater than the sixth preset value, it means that the combination of the j-th prediction mode, the ith weighted derived mode, and prediction mode 1 cannot achieve accurate template prediction. In this case, the j-th prediction mode is removed from the Q prediction modes. Since prediction modes similar to the j-th prediction mode have similar characteristics, similar prediction modes are removed from the Q prediction modes, resulting in a set of removed prediction modes. From the set of removed prediction modes, a new prediction mode is selected as the new j-th prediction mode, and the above steps are repeated to obtain the final set of removed prediction modes corresponding to the ith weighted derived mode. Based on the above steps, we can determine the set of predicted modes after final elimination for each of the P weighted derived modes. Then, based on the P weighted derived modes and their respective sets of predicted modes after final elimination, we can construct R second combinations. It should be noted that the above embodiments illustrate a method of filtering prediction modes in the form of combinations. Optionally, either the weighted derivation mode or the prediction mode can be filtered in the form of combinations to finally construct R second combinations. After determining R second combinations based on the methods described above, the decoder uses the weighted derived mode and K prediction modes in the second combination to predict the template and obtain the template prediction value corresponding to the second combination. The following describes the process of using any second combination to predict the template of the current block and obtaining the predicted value of the template. First, the weights of the template are determined using the weight derivation patterns included in the second combination. Currently, as shown in Figure 13 above, the template for the current block is either 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. In some embodiments, the weight matrix can be directly extended towards the template region, for example, extending left and upward, covering the template with the weight matrix to determine the template's weights. For example, as shown in Figure 17, a small rectangular region on the upper left side of the current block can be added to the template, combining the template and the current block to form a rectangle. Alternatively, only the left and upper parts can be used as the template. As shown in Figure 17, taking the addition of the upper left region as an example, the regions within the inverted L-shaped frames on the left, upper left, and top sides are the template region, and the rectangular region on the lower right is the current block. Then, the weight matrix extended to the upper left becomes the template's weight matrix. In some embodiments, the process of deriving template weights and predicted value weights according to the weight derivation mode is combined, for example, simultaneously deriving template weights and predicted value weights. The weight of the predicted value can be understood as the weight corresponding to the predicted value. For example, a first predicted value is obtained using a first prediction mode, a second predicted value is obtained using a second prediction mode, a first weight of the first predicted value is determined according to the weight derivation mode, a second weight of the second predicted value is determined according to the weight derivation mode, and 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. In order to distinguish it from the template weights, this application refers to the first and second weights as the weights of the predicted values. In some embodiments, determining template weights based on the weight derivation mode includes the following steps: Step 1: Determine the angle index and distance index based on the weighted export mode; Step 2: Determine the template weight based on the angle index, distance index, and template size. This application can derive template weights in the same way as deriving the weights of the predicted values. For example, firstly, based on the weight deriving mode, the angle index and distance index are determined, where the angle index can be understood as the boundary angle index of each weight derived by the weight deriving mode. For instance, according to Table 2 above, the angle index and distance index corresponding to the weight deriving mode can be determined; for example, if the weight deriving mode is 27, then 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 the size of the template. In step 2 above, the methods for determining the template weight based on the angle index, distance index, and template size include, but are not limited to, the following: Method 1: Determine the template weight directly based on the angle index, distance index, and template size. In this case, step 2 above includes steps 21 to 23 as follows: Step 21: Determine the first parameter of the pixels in the template based on the angle index, distance index, and template size; Step 22: Determine the weight of the pixels in the template based on the first parameter of the pixels in the template; Step 23: Determine the template weight based on the weight of each pixel in the template. In this implementation, the weights of pixels in the template are determined based on the angle index, distance index, template size, and current block size. Then, the weight matrix composed of the weights of each point in the template is determined as the template weight. The first parameter of this application is used to determine the weight. In some embodiments, the first parameter is also referred to as the weight index. In one possible implementation, the offset and the first parameter can be determined as follows: The inputs for the template weight derivation process are as follows: as shown in Figure 17, 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 "division" angle index variable angleId of GPM; the distance index variable distanceIdx of GPM; and the component index variable cIdx. For example, this application takes the luminance component as an example, so cIdx is 0, which represents the luminance component. The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are exported as follows: nW=(cIdx==0)? nCbW:nCbW*SubWidthC nH=(cIdx==0)? nCbH:nCbH*SubHeightC shift1 = Max(5, 17 - BitDepth) where BitDepth is the bit depth of the encoding / decoding process. offset1 = 1 << (shift1 - 1) displacementX = angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1 The offsets offsetX and offsetY are derived as follows: - If the value of shiftHor is 0: offsetX = (-nW) >> 1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) Otherwise (i.e., shiftHor is 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY = (-nH) >> 1 The template weight matrix wTemplateValue[x][y] (where x = -nTmW..nCbW–1, y = -nTmH..nCbH–1, excluding cases where x and y are both greater than or equal to 0) is derived as follows, with the top-left corner of the current block as (0, 0): – Variables xL and yL are derived as follows: xL=(cIdx==0)? x:x*SubWidthC yL=(cIdx==0)? y:y*SubHeightC disLut is determined according to Table 3 above. The first parameter, weightIdx, is derived as follows: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] Based on the above method, after determining the first parameter weightIdx, the weight at the midpoint (x, y) of the template is determined according to weightIdx. In this application, the methods for determining the weight of pixels in the template based on the first parameter of the pixels in the template in step 22 above include, but are not limited to, the following: Method 1: Determine the second parameter of the pixel in the template based on the first parameter of the pixel in the template; determine the weight of the pixel in the template based on the second parameter of the pixel in the template. The second parameter is also used to determine the weight. In some embodiments, the second parameter is also called the weight index under the first component, which can be the luminance component, chrominance component, etc. For example, the weights of pixels in the template are determined according to the formula: weightIdxL=partFlip? 32+weightIdx:32-weightIdx wTemplateValue[x][y]=Clip3(0,8,(weightIdxL+4)>>3) Where wTemplateValue[x][y] is the weight of the template midpoint (x, y), weightIdxL is the second parameter of the template midpoint (x, y), also known as the weight index under the first component (e.g., the luminance component), and partFlip is an intermediate variable determined according to the angle index angleIdx, for example, as mentioned above: partFlip = (angleIdx>=13&&angleIdx<=27)? 0:1, that is, the value of partFlip is 1 or 0. When partFlip is 0, weightIdxL is 32 – weightIdx, and when partFlip is 1, weightIdxL is 32 + weightIdx. It should be noted that 32 here is just an example, and this application is not limited to this. Method 2: Determine the weight of the pixels in the template based on the first parameter, the first threshold, and the second threshold of the pixels in the template. To reduce the computational complexity of template weights, Method 2 limits the weights of pixels in the template to either a first threshold or a second threshold. In other words, the weights of pixels in the template are either the first threshold or the second threshold, thereby reducing the computational complexity of template weights. This application does not impose any restrictions on the specific values ​​of the first threshold and the second threshold. Optionally, the first threshold is 1. Optionally, the second threshold is 0. In one example, the weights of pixels in the template can be determined using the following formula: wTemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 Where wTemplateValue[x][y] is the weight of the midpoint (x, y) of the template, and the 1 in the above "1:0" is the first threshold and the 0 is the second threshold. In the first method described above, the weight of each point in the template is determined by the weight derivation mode, and the weight matrix composed of the weights of each point in the template is used as the template weight. Method 2 involves determining the weights of the current block and the template based on the weight export mode. In other words, in this method, the merged region consisting of the current block and the template is treated as a whole, and the weights of the pixels within the merged region are exported according to the weight export mode. Therefore, step 2 above includes the following steps 2-1 and 2-2: Step 2-1: Determine the weights of pixels in the merged region composed of the current block and the template based on the angle index, distance index, template size, and current block size; Step 2-2: Determine the template weight based on the size of the template and the weight of the pixels in the merged region. In this second method, the current block and the template are treated as a whole. The weights of the pixels in the merged region composed of the current block and the template are determined based on the angle index, distance index, size of the template, and size of the current block. Then, based on the size of the template, the weights corresponding to the template in the merged region are determined as template weights. For example, as shown in Figure 17, the weights corresponding to the L-shaped template region in the merged region are determined as template weights. In this second method, not only the template weights are determined in one weight determination process, but also the weights of the predicted values. That is, after removing the template weights from the weights corresponding to the merged regions, the remaining weights are the weights of the predicted values. Then, the subsequent prediction process can be executed based on the weights of the predicted values ​​without having to redetermine the weights of the predicted values, thereby reducing the prediction steps and improving prediction efficiency. This application does not limit the specific implementation of determining the weights of pixels in the merged region composed of the current block and the template based on the angle index, distance index, template size, and current block size. In some embodiments, determining the weights of pixels in the merged region in step 2-1 above includes the following steps 2-11 to 2-12: Step 2-11: Determine the first parameter of the pixels in the merged region based on the angle index, distance index, and size of the merged region; Step 2-12: Determine the weight of the pixels in the merged region based on the first parameter of the pixels in the merged region. In this implementation, the weights of pixels in the merged region are determined based on the angle index, distance index, and size of the merged region, forming a weight matrix composed of the weights of each point in the merged region. In one possible implementation, the offset and the first parameter can be determined as follows: The inputs for the merged region weight derivation process are as follows: as shown in Figure 17, the width of the current block nCbW, the height of the current block nCbH; the width of the left template nTmW, the height of the upper template nTmH; the "division" angle index variable angleId of GPM; the distance index variable distanceIdx of GPM; and the component index variable cIdx. For example, this application takes the luminance component as an example, so cIdx is 0, indicating the luminance component. The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are exported as follows: nW=(cIdx==0)? nCbW:nCbW*SubWidthC nH=(cIdx==0)? nCbH:nCbH*SubHeightC shift1 = Max(5, 17 - BitDepth) where BitDepth is the bit depth of the encoding / decoding process. offset1 = 1 << (shift1 - 1) displacementX = angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1 The offsets offsetX and offsetY are derived as follows: - If the value of shiftHor is 0: offsetX = (-nW) >> 1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) Otherwise (i.e., shiftHor is 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY = (-nH) >> 1 The weight matrix wValueMatrix[x][y] of the pixels in the merged region (where x = -nTmW..nCbW–1, y = -nTmH..nCbH-1) is derived as follows, with the top-left corner of the current block as (0, 0): – Variables xL and yL are derived as follows: xL=(cIdx==0)? x:x*SubWidthC yL=(cIdx==0)? y:y*SubHeightC disLut is determined according to Table 3. The first parameter, weightIdx, is derived as follows: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] Based on the above method, after determining the first parameter weightIdx, the weight at point (x, y) in the merged region is determined according to weightIdx. In this application, the methods for determining the weights of pixels in the merged region based on the first parameter of the pixels in the merged region in steps 2-12 above include, but are not limited to, the following: Method 1: Determine the second parameter of the pixels in the merged region based on the first parameter of the pixels in the merged region; determine the weight of the pixels in the merged region based on the second parameter of the pixels in the merged region. For example, the weights of pixels in the merged region are determined according to the formula: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] weightIdxL=partFlip? 32+weightIdx:32-weightIdx wValueMatrix[x][y]=Clip3(0,8,(weightIdxL+4)>>3) Where wValueMatrix[x][y] is the weight of the point (x, y) in the merged region, weightIdxL is the second parameter of the point (x, y) in the merged region, and wTemplateValue[x][y] is the weight of the point (x, y) in the merged region. Method 2: Determine the weight of pixels in the merged region based on the first parameter, first threshold and second threshold of the pixels in the merged region. For example, the weight of pixels in the merged region is either a first threshold or a second threshold. To reduce the computational complexity of the weights in the merged region, Method 2 limits the weights of pixels in the merged region to either a first threshold or a second threshold. In other words, the weights of pixels in the merged region are either the first threshold or the second threshold, thereby reducing the computational complexity of the weights in the merged region. This application does not impose any restrictions on the specific values ​​of the first threshold and the second threshold. Optionally, the first threshold is 1. Optionally, the second threshold is 0. In one example, the weights of pixels in the merged region can be determined using the following formula: wTemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 Where wValueMatrix[x][y] represents the weight of the point (x, y) in the merged region, and the 1 in the above "1:0" represents the first threshold and the 0 represents the second threshold. In the second method described above, the weight of each point in the merged region composed of the current block and the template is determined by the weight derivation mode. Then, based on the size of the template, the weight corresponding to the template in the merged region is determined as the template weight. In this second method, the weight of the predicted value is determined at the same time, eliminating the need to perform the subsequent steps of determining the weight of the predicted value, thus reducing the prediction steps and improving the prediction efficiency. According to the above method, after determining the template weights corresponding to the weighted derivation modes included in the second combination, the K prediction modes in the second combination are used to predict the template to obtain K prediction values. The K prediction values ​​are then weighted according to the template weights to obtain the predicted values ​​of the template. The predicted value of the template can be understood as a matrix composed of the predicted values ​​of the pixels in the template. In some embodiments, the above-mentioned predicted values ​​are also referred to as predicted samples. Next, the cost of the second combination is determined based on the predicted and reconstructed values ​​of the template. The methods for determining the cost of the second combination mentioned above include, but are not limited to, the following: Method 1: Determine the cost of the second combination using a matrix approach. Specifically, based on the predicted and reconstructed values ​​of the template, determine a loss, which is denoted as the first loss. Since the predicted and reconstructed values ​​of the template are matrices, the first loss is also a matrix. For example, the absolute value of the difference between the predicted and reconstructed values ​​of the template can be determined as the first loss, and this first loss can be used as the cost of the second combination. Method 2: Use point-by-point calculation to determine the cost of the second combination. Specifically, for the i-th pixel in the template, when determining the prediction of each of the K prediction modes in the second combination at the i-th pixel, the template weight corresponding to the i-th pixel in the template weight is determined. Based on the template weight of the i-th pixel and the K prediction values ​​of the i-th pixel, the prediction value of the i-th pixel is obtained. Based on the prediction value and the reconstructed value of the i-th pixel, the cost of the second combination at the i-th pixel is obtained. According to this method, the prediction distortion cost of the second combination at each pixel in the template can be determined. Finally, the sum of the prediction distortion costs of the second combination at each pixel in the template is determined as the cost of the second combination. Based on the above method, the cost of each of the R second combinations can be determined. Next, a candidate combination list is constructed based on the cost of each of the R second combinations. For example, based on the cost of the second combination, the R second combinations are sorted in ascending order, and the sorted R second combinations are determined as a candidate combination list. For example, based on the cost of the second combination, select the N second combinations with the smallest cost from the R second combinations to form a candidate combination list. Optionally, N can be 8, 16, or 32, etc. Based on the above method, a candidate combination list is determined. Each candidate combination in the candidate combination list is sorted in ascending order of cost. For example, the candidate combination list is shown in Table 6 above. Thus, the decoding end, based on the first index, queries the candidate combination list shown in Table 6 for the candidate combination corresponding to the first index, and determines the candidate combination corresponding to the first index as the first combination, that is, determines the weighted derived mode included in the candidate combination as the first weighted derived mode, and determines the K prediction modes included in the candidate combination as the K first prediction modes. Next, the decoding end executes the following S103. S103. Based on the first weighted derivation mode and K first prediction modes, predict the current block to obtain the predicted value of the current block. Specifically, the weights of the predicted values ​​are determined based on the first weighted derivation pattern, K predicted values ​​are determined based on K predicted patterns, the K predicted values ​​are weighted according to their weights, and the weighted result is determined as the predicted value for the current block. The methods used in this application to determine the weights corresponding to the K predicted values ​​based on the weight derivation pattern include, but are not limited to, the following: Method 1: If the template weights are determined using the weight derivation mode during the template weight determination process, but the weights corresponding to the pixels in the current block are not determined, then S103 above includes the following steps: S103-A1. Determine the weight of the predicted value according to the first weight derivation mode; S103-A2. Determine K predicted values ​​based on K first prediction patterns; S103-A3: Determine the predicted value for the current block based on the K predicted values ​​and their weights. The execution order of S103-A1 and S103-A2 is not sequential; that is, S103-A1 can be executed before S103-A2, after S103-A2, or in parallel with S103-A2. It should be noted that, in this application, the first weight derivation mode is used to determine the weights of the predicted values ​​used in the current block. For a block of a given length and width, each weight derivation mode can derive a weight matrix for the predicted values; for blocks of the same size, the weight matrices derived by different weight derivation modes can be different. Thus, the decoder determines the weights of the predicted values ​​based on the first weight derivation mode as a weight matrix, which includes the predicted weights corresponding to each pixel in the current block. In some embodiments, when predicting the current block, each of the K first prediction modes is used to predict a pixel A in the current block, resulting in K predicted values ​​for pixel A. The weights of the predicted values ​​for pixel A are then determined according to a first weight derivation mode. For example, a weight matrix is ​​determined based on the first weight derivation mode, and this weight matrix includes the weights corresponding to each pixel in the current block. Thus, the weights of the predicted values ​​for pixel A can be determined within this weight matrix. Next, these K predicted values ​​are weighted using the weights of the predicted values ​​for pixel A to obtain the predicted value for pixel A. Performing the above steps for each pixel in the current block yields the predicted value for each pixel in the current block, and the predicted values ​​for each pixel in the current block constitute the predicted value for the current block. Taking K=2 as an example, the first prediction mode is used to predict a certain pixel A in the current block to obtain the first predicted value of pixel A. The second prediction mode is used to predict the pixel A to obtain the second predicted value of pixel A. According to the prediction value weight corresponding to pixel A, the first and second predicted values ​​are weighted to obtain the predicted value of pixel A. For example, in this application, AVS3's AWP has 56 weighted export modes and VVC's GPM has 64 weighted export modes. It is understood that, in the embodiments of this application, when the decoding end determines the predicted value based on the K first prediction modes and the weights of the predicted values, it can first determine the K predicted values ​​based on the K first prediction modes; then use the weights of the predicted values ​​to perform a weighted average calculation on the K predicted values, and finally obtain the predicted value of the current block. In this method one, it can be understood that determining the template weight and the weight of the predicted value based on the first weight derivation mode are two independent processes that do not interfere with each other. In some embodiments, this application may also use the following method two to determine the weight of the predicted value. Method 2: If, during the determination of template weights, the weights of pixels in the merged region formed by the template region and the current block are determined using the first weight derivation mode, then S103 includes the following steps: S103-B1. Determine K predicted values ​​based on K first prediction patterns; S103-B2. Determine the weight of the predicted value based on the weight of the pixels in the merged region; S103-B3: Determine the predicted value for the current block based on the K predicted values ​​and their weights. The execution order of S103-B1 and S103-B2 is not sequential; that is, S103-B1 can be executed before S103-B2, after S103-B2, or in parallel with S103-B2. In this second method, during weight export, the weights of pixels in the merged region are exported according to the first weight export mode. This merged region includes the current block and its template region. The weight corresponding to the current block in the merged region is then determined as the weight of the predicted value, and the weight corresponding to the template region in the merged region is determined as the template weight. In other words, in this second method, the template region and the current block are treated as a single region, and the template weight and the predicted value weight are exported in one step, thus reducing the weight export steps and improving prediction performance. In some embodiments, the prediction process described above is performed on a pixel-by-pixel basis, and the corresponding weights are also the weights corresponding to each pixel. When predicting the current block, each of the K first prediction modes is used to predict a pixel A in the current block, resulting in K predicted values ​​for pixel A. The weight of the predicted value for pixel A is determined according to the first weight derivation mode. Specifically, a weight matrix corresponding to the merged region is determined according to the first weight derivation mode. This weight matrix includes the weight corresponding to each pixel in the current block, thus allowing the determination of the weight of the predicted value for pixel A within this weight matrix. Next, the K predicted values ​​are weighted using the weight of the predicted value for pixel A to obtain the predicted value for pixel A. Performing the above steps for each pixel in the current block yields the predicted value for each pixel in the current block, and the predicted values ​​for each pixel in the current block constitute the predicted value for the current block. Taking K=2 as an example, the first prediction mode is used to predict a certain pixel A in the current block to obtain the first predicted value of pixel A. The second prediction mode is used to predict the pixel A to obtain the second predicted value of pixel A. According to the prediction value weight corresponding to pixel A, the first and second predicted values ​​are weighted to obtain the predicted value of pixel A. In one example, taking K=2, if both the first and second prediction modes are intra-frame prediction modes, the first intra-frame prediction mode is used to predict, resulting in a first predicted value. The second intra-frame prediction mode is used to predict, resulting in a second predicted value. The first and second predicted values ​​are then weighted according to their respective weights to obtain the predicted value for the current block. For example, using the first intra-frame prediction mode to predict pixel A yields a first predicted value for pixel A. Using the second intra-frame prediction mode to predict pixel A yields a second predicted value for pixel A. The first and second predicted values ​​are then weighted according to their respective weights to obtain the predicted value for pixel A. In some embodiments, if the j-th prediction mode among the K first prediction modes is an inter-frame prediction mode, then the above-described S103, based on the K first prediction modes and the first weighted derivation mode, determines the prediction value of the current block by the following steps: S103-C1, Determine motion information based on the j-th prediction pattern; S103-C2, Determine the j-th predicted value based on the motion information; S103-C3: Determine K-1 predicted values ​​based on the other prediction modes among the K first prediction modes, excluding the j-th prediction mode; S103-C4. Determine the weights of the K predicted values ​​based on the first weight derivation mode; S103-C5. Determine the predicted value of the current block based on the j-th predicted value, the K-1 predicted value, and the weights of the predicted values. Taking K=2 as an example, if the first prediction mode is intra-frame prediction and the second prediction mode is inter-frame prediction, the intra-frame prediction mode is used to obtain the first predicted value, and the inter-frame prediction mode is used to obtain the second predicted value. The first and second predicted values ​​are then weighted according to their respective weights to obtain the predicted value for the current block. In this example, the intra-frame prediction mode is used to predict each point in the current block, obtaining the predicted value for each point in the current block. The predicted values ​​for each point in the current block constitute the first predicted value for the current block. The inter-frame prediction mode is used to determine motion information, and based on this motion information, the best matching block for the current block is determined. This best matching block is then identified as the second predicted value for the current block. Finally, the first and second predicted values ​​for the current block are weighted point-by-point according to the weights of the predicted values ​​for each pixel in the current block to obtain the predicted value for the current block. For example, for pixel A in the current block, the first predicted value corresponding to pixel A in the first predicted value of the current block is weighted according to the weight of the predicted value of pixel A, and the second predicted value corresponding to pixel A in the second predicted value of the current block is weighted to obtain the predicted value of pixel A. In some embodiments, if K is greater than 2, the weights of the predicted values ​​corresponding to two of the K first prediction modes can be determined according to the first weight derivation mode, and the weights of the predicted values ​​corresponding to the other prediction modes in the K first prediction modes can be preset values. For example, if K = 3, the first weights of the predicted values ​​corresponding to the first and second prediction modes are derived according to the weight derivation mode, and the weight of the predicted value corresponding to the third prediction mode is a preset value. In some embodiments, if the total weight of the predicted values ​​corresponding to the K first prediction modes is fixed, for example, 8, the weight of the predicted values ​​corresponding to each of the K first prediction modes can be determined according to the preset weight ratio. Assuming that the weight of the predicted value corresponding to the third prediction mode accounts for 1 / 4 of the total weight of the predicted values, the weight of the predicted value of the third prediction mode can be determined to be 2, and the remaining 3 / 4 of the total weight of the predicted values ​​can be allocated to the first and second prediction modes. For example, if the weight of the predicted value corresponding to the first prediction mode is 3 derived according to the first weight derivation mode, then the weight of the predicted value corresponding to the first prediction mode is determined to be (3 / 4)*3, and the weight of the predicted value corresponding to the second prediction mode is (3 / 4)*5. Based on the above method, the predicted value of the current block is determined. At the same time, the bitstream is decoded to obtain the quantization coefficients of the current block. The quantization coefficients of the current block are then dequantized and inversely transformed to obtain the residual value of the current block. The predicted value and the residual value of the current block are added together to obtain the reconstructed value of the current block. As described above, in the candidate combination list of this application embodiment, each candidate combination is sorted in ascending order of cost, with candidate combinations with lower costs having a higher probability of being selected. Based on this, in order to further reduce the encoding cost, shorter codewords are used to encode candidate combinations that rank higher in the candidate combination list, while longer codewords are used to encode candidate combinations that rank lower in the candidate combination list, thereby improving the overall encoding efficiency. In some embodiments, the first index is encoded into the bitstream using a variable-length encoding method, for example, using Columbus encoding. In some embodiments, if the number of candidate combinations included in the candidate combination list is less than a fourth preset threshold, the first index is encoded into the bitstream using a fixed-length encoding method. That is, in this embodiment, if the number of candidate combinations included in the candidate combination list is small, each candidate combination is uniformly encoded using a preset bit length. This embodiment does not limit the specific value of the fourth preset threshold; for example, the fourth preset threshold = 16. In some embodiments, a high-level syntax can be used to control the switching of the combined encoding scheme provided in the embodiments of this application. For example, at least one flag can be used to indicate whether the current block is allowed to use the combined encoding scheme provided in the embodiments of this application, that is, whether the first combination is allowed to be used for decoding. In one possible implementation, at least one flag can be a flag of different levels, used to indicate whether the combined encoding technology provided in the embodiments of this application is allowed at the corresponding level. Optionally, the above-mentioned at least one flag includes at least one of sequence-level flags, image-level flags, slice-level flags, unit-level flags, and block-level flags. For example, at least one of the above flags includes a sequence-level flag, which is used to indicate whether the current sequence is allowed to use the combined encoding technology scheme provided in this application. For example, the syntax element `sps_cgpm_enabled_flag` is added to the sequence parameter set. Here, `cgpm` can be considered an abbreviation for combined geometric partitioning mode. If the value of `sps_cgpm_enabled_flag` is 1, it indicates that the current sequence is allowed to use the technical solution of this application; if the value of `sps_cgpm_enabled_flag` is 0, it indicates that the current sequence is not allowed to use the technical solution of this application. If the technical solution provided in this application is used in inter-frame mode, since the inter-frame mode already has `sps_gpm_enbled_flag`, this solution can also be controlled by `sps_gpm_enbled_flag`. Because this solution can also be used in intra-frame mode, `sps_cgpm_enabled_flag` or `sps_gpm_enabled_flag` can be used together with inter-frame mode. Of course, for better flexibility, different flags can be used for intra-frame mode and inter-frame mode, such as setting a single `sps_sgpm_enabled_flag`. Here, `sgpm` can be considered an abbreviation for Spatial Geometric Partitioning Mode. `sps_sgpm_enabled_flag` controls whether this solution is allowed in intra-frame mode, while `sps_cgpm_enabled_flag` or `sps_gpm_enabled_flag` controls whether this solution is allowed in inter-frame mode. For example, at least one of the above-mentioned marks includes an image-level mark, which is used to indicate whether the current image allows the use of the technical solution of this application. Optionally, if at least one of the tags includes an image-level tag, the image-level tag may be located in the image header. For example, at least one of the above-mentioned flags includes a slice-level flag, which is used to indicate whether the current slice is allowed to use the technical solution of this application. Optionally, if at least one flag includes a slice flag, the slice flag may be located in the slice header. For example, at least one of the above-mentioned flags includes a unit-level flag, which is used to indicate whether the current CTU allows the use of the technical solution of this application. For example, at least one of the above-mentioned flags includes a block (CU) level flag, which is used to indicate whether the technical solution of this application is allowed in the current block. Taking intra-frame as an example, assume the block-level flag is cu_sgpm_flag. If the value of cu_sgpm_flag is 1, it means that the current block is allowed to use the technical solution of this application; if the value of cu_sgpm_flag is 0, it means that the current block is not allowed to use the technical solution of this application. Currently, GPM in VVC is used in the inter-frame merge mode, which is derived through derivation. Of course, in the future, it may be directly represented by a CU-level flag, which is not restricted here. Thus, the decoding end first decodes the bitstream to obtain at least one of the aforementioned flags, and determines whether the current block is allowed to use the technical solution of this application based on these flags. If, based on the aforementioned flags, it is determined that the current block is not allowed to use the technical solution of this application, the method of this application embodiment is skipped. If, based on the aforementioned flags, it is determined that the current block is allowed to use the technical solution of this application, the method of this application embodiment is executed, i.e., decoding the bitstream to obtain the first index. The video decoding method provided in this application obtains a first index by decoding the bitstream. This first index indicates a first combination consisting of a weighted derived mode and K prediction modes, where K is a positive integer greater than 1. Based on the first index, the first weighted derived mode and K prediction modes included in the first combination are determined. The current block is then predicted based on the first weighted derived mode and K prediction modes to obtain the predicted value of the current block. This application treats the weighted derived mode and K prediction modes as a combination, thus indicating the weighted derived mode and K prediction modes used by the current block in a combined form in the bitstream. This simplifies the syntax, saves codewords, and eliminates the need for judgments on various cases, thereby improving encoding efficiency. The above section uses the decoding end as an example to introduce the prediction method of this application. The following section uses the encoding end as an example to illustrate it. Figure 19 is a schematic flowchart of a prediction method provided in an embodiment of this application. This embodiment is applied to the video encoders shown in Figures 1 and 2. As shown in Figure 19, the method of this embodiment includes: S201. Determine the first combination. The first combination includes a first weighted derived pattern and K first prediction patterns. Based on the above description, a weighted derivation pattern and K prediction patterns can be used together as a combination on the current block. In order to save codewords and reduce encoding costs, this application embodiment combines the weighted derivation pattern and K prediction patterns corresponding to the current block into a first combination and uses a first index to indicate the first combination. Compared with indicating the weighted derivation pattern and K prediction patterns separately, this application embodiment uses fewer codewords, thereby reducing the encoding cost. Specifically, the encoder determines the first combination corresponding to the current block. This first combination consists of one weighted derived pattern and K prediction patterns. For ease of description, the weighted derived pattern included in the first combination is denoted as the first weighted derived pattern, and the K prediction patterns included in the first combination are denoted as the K first prediction patterns. The encoder uses the first weighted derived pattern and the K first prediction patterns to predict the current block, obtaining the predicted value of the current block. For example, the weight is derived using the first weighted derived pattern, and the K prediction patterns are used to predict the current block to obtain K predicted values. These K predicted values ​​are then weighted according to the derived weights to obtain the predicted value of the current block. In some embodiments, before determining the first combination, the encoder first needs to determine whether the current block uses K different prediction modes for weighted prediction processing. If the encoder determines that the current block uses K different prediction modes for weighted prediction processing, then the above-described S201 step is executed to determine the first combination. If the encoder determines that the current block does not use K different prediction modes for weighted prediction processing, then the above-described S201 step is skipped. In one possible implementation, the encoder can determine whether the current block uses K different prediction modes for weighted prediction processing by determining the prediction mode parameters of the current block. Optionally, in the implementation of this application, the prediction mode parameter can indicate whether the current block can use the GPM mode or the AWP mode, that is, whether the current block can use K different prediction modes for prediction processing. It is understood that, in the embodiments of this application, the prediction mode parameter can be understood as a flag indicating whether GPM mode or AWP mode is used. Specifically, the encoder can use a variable as the prediction mode parameter, and thus the prediction mode parameter can be set by setting the value of this variable. For example, in this application, if the current block uses GPM mode or AWP mode, the encoder can set the value of the prediction mode parameter to indicate that the current block uses GPM mode or AWP mode; specifically, the encoder can set the value of the variable to 1. For example, in this application, if the current block does not use GPM mode or AWP mode, the encoder can set the value of the prediction mode parameter to indicate that the current block does not use GPM mode or AWP mode; specifically, the encoder can set the value of the variable to 0. Further, in the embodiments of this application, after the encoder completes the setting of the prediction mode parameter, it can write the prediction mode parameter into the bitstream and transmit it to the decoder, so that the decoder can obtain the prediction mode parameter after parsing the bitstream. In some embodiments, as shown in Table 5, the embodiments of this application may also impose conditions on the use of GPM mode or AWP mode for the current block. That is, when it is determined that the current block meets the preset conditions, it is determined that the current block uses K prediction modes for weighted prediction, and then the first combination is determined. For example, when applying GPM mode or AWP mode, the size of the current block can be limited. It is understandable that, since the prediction method proposed in this application requires generating K predicted values ​​using K different prediction modes, and then weighting them according to weights to obtain the predicted value of the current block, in order to reduce complexity and consider the trade-off between compression performance and complexity, in the embodiments of this application, the GPM mode or AWP mode can be restricted from being used for blocks of certain sizes. Therefore, in this application, the encoding end can first determine the size parameters of the current block, and then determine whether the current block uses the GPM mode or AWP mode based on the size parameters. In embodiments of this application, the size parameters of the current block may include the height and width of the current block. Therefore, the encoder can determine whether the current block uses GPM mode or AWP mode based on the height and width of the current block. For example, in this application, if the width is greater than a first threshold and the height is greater than a second threshold, then the current block is determined to use either GPM mode or AWP mode. It is evident that one possible limitation is to use GPM mode or AWP mode only when the block's width is greater than (or greater than or equal to) the first threshold and the block's height is greater than (or greater than or equal to) the second threshold. The values ​​of the first and second thresholds can be 8, 16, 32, etc., and the first threshold can be equal to the second threshold. For example, in this application, if the width is less than a third threshold and the height is greater than a fourth threshold, then the current block is determined to use either GPM mode or AWP mode. It is evident that a possible limitation is to use GPM mode or AWP mode only when the block's width is less than (or less than or equal to) the third threshold and the block's height is greater than (or greater than or equal to) the fourth threshold. The values ​​of the third and fourth thresholds can be 8, 16, 32, etc., and the third threshold can be equal to the fourth threshold. Furthermore, in the embodiments of this application, the size of the block that can use GPM mode or AWP mode can also be limited by restricting the pixel parameters. For example, in this application, the encoder can first determine the pixel parameters of the current block, and then further determine whether the current block can use GPM mode or AWP mode based on the pixel parameters and a fifth threshold. It is evident that a possible limitation is to use GPM mode or AWP mode only when the number of pixels in the block is greater than (or greater than or equal to) the fifth threshold. The value of the fifth threshold can be 8, 16, 32, etc. In other words, in this application, the current block can only use GPM mode or AWP mode if the size parameters of the current block meet the size requirements. For example, in this application, a frame-level flag can be used to determine whether the current frame to be encoded uses this application. For instance, intra-frame frames (such as I-frames) can be configured to use this application, while inter-frame frames (such as B-frames and P-frames) cannot. Alternatively, intra-frame frames can be configured not to use this application, while inter-frame frames can use it. Or, some inter-frame frames can be configured to use this application, while others cannot. Inter-frame frames can also use intra-frame prediction, and therefore, inter-frame frames may also use this application. In some embodiments, a flag below the frame level and above the CU level (such as tile, slice, patch, LCU, etc.) may be used to determine whether the technical solution of this application is used in this area. In this embodiment of the application, the first combination includes a first weighted derivation mode and K first prediction modes. The first weight derivation mode is used to determine the weights used in the current block. Specifically, the first weight derivation mode can be a mode for deriving weights. For a block of a given length and width, each weight derivation mode can derive a weight matrix; for blocks of the same size, different weight derivation modes will derive different weight matrices. For example, in this application, AWP has 56 weight derivation modes and GPM has 64 weight derivation modes. The K different first prediction patterns included in the first combination mentioned above include the following examples: Example 1: All of the above K different first prediction modes are intra-prediction modes, such as the current block being an intra-coded block and not applicable to screen content encoding. Example 2: All of the above K different first prediction modes are inter-frame prediction modes, such as the current block being an inter-frame coded block. Example 3: Among the K different first prediction modes mentioned above, at least one is an intra-frame prediction mode and at least one is an inter-frame prediction mode. Example 4: Among the K different first prediction modes mentioned above, at least one is an intra-frame prediction mode, and at least one is a non-inter-frame and non-intra-frame prediction mode, such as an intra-block copy (IBC) prediction mode or a palette prediction mode. Example 5: Among the K different first prediction modes mentioned above, at least one is an inter-frame prediction mode, and at least one is a non-inter-frame and non-intra-frame prediction mode, such as an IBC prediction mode or a palette prediction mode. Example 6: None of the above K different first prediction modes are intra-frame prediction modes or inter-frame prediction modes. For example, one is an IBC prediction mode, and another is a palette prediction mode, etc. It should be noted that the embodiments of this application do not limit the specific types of the K different first prediction modes included in the first combination. In this embodiment of the application, the encoding end determines the first combination in several ways, including but not limited to the following: Method 1, the first combination is the preset combination. Method 2: The encoding end determines a list containing multiple candidate combinations; therefore, this list is also called the candidate combination list. The first combination is determined from this candidate combination list. In this case, S201 above includes the following steps: S201-A, Determine the candidate combination list; S201-B: Determine the first combination from the list of candidate combinations. The candidate combination list includes multiple candidate combinations, and any candidate combination includes a weighted derived pattern and K prediction patterns. For example, the list of candidate combinations is shown in Table 6 above. As shown in Table 6, the candidate combination list includes multiple candidate combinations. No two candidate combinations are exactly the same; that is, the weight-derived patterns and at least one of the K prediction patterns in any two candidate combinations are different. For example, candidate combination 1 and candidate combination 2 may have different weight-derived patterns, or candidate combination 1 and candidate combination 2 may have the same weight-derived patterns but at least one of the K prediction patterns is different, or candidate combination 1 and candidate combination 2 may have different weight-derived patterns and at least one of the K prediction patterns is different. For example, Table 6 above uses the order of candidate combinations in the candidate combination list as the index. Optionally, the index of candidate combinations in the candidate combination list can also be represented in other ways, and this application embodiment does not limit this. In this method 2, the encoder determines one of the candidate combinations in the candidate combination list as the first combination. For example, the encoder determines the first candidate combination in the candidate combination list as the first combination. In this method 2, the encoder and decoder can each determine the same list of candidate combinations. For example, both the encoder and decoder can determine a list containing N candidate combinations, each candidate combination including one weighted derived mode and K prediction modes. In the bitstream, the encoder only needs to write the finally selected candidate combination, such as the first combination. The decoder parses the first combination finally selected by the encoder. Specifically, the decoder decodes the bitstream, obtains the first index, and determines the first combination from the candidate combination list determined by the decoder using the first index. This application does not limit the specific method by which the encoding end determines the above-mentioned candidate combination list. In some embodiments, the candidate combination list is existing, and the encoder obtains the candidate combination list when it determines that the current block can be weighted by K prediction modes. In some embodiments, the candidate combination list is constructed by the encoding end. In this case, in some embodiments, the encoding end can send the constructed candidate combination list to the decoding end. In some embodiments, the encoding end uploads the constructed candidate combination list to the cloud, and the decoding end, after decoding the bitstream and obtaining the first index, reads the candidate combination list from the cloud. The following describes the process of constructing a candidate combination list at the encoding end. This application does not limit the method by which the encoding end constructs the candidate combination list. In some embodiments, the encoding end constructs a candidate combination list through the following steps S201-A1: S201-A1: Based on the template of the current block, construct a list of candidate combinations. Template matching utilizes the correlation between adjacent pixels to use regions surrounding the current block as templates. During encoding and decoding of the current block, its left and top sides are already encoded according to the encoding order. During inter-frame prediction, the best matching position of the template is found in the reference frame to determine the motion information or motion vector of the current block. During intra-frame prediction, the template is used to determine the intra-frame prediction mode of the current block. The template of the current block consists of the reconstructed area around the current block and is related to the current block. Based on this, the embodiments of this application construct a candidate combination list based on the template of the current block. This application does not impose any restrictions on the specific shape of the template for the current block. In some embodiments, the template includes at least one of the above encoded region, the left encoded region, and the upper left encoded region of the current block. Optionally, the width of the upper encoded region is the same as the width of the current block, the height of the left encoded region is the same as the height of the current block, the width of the upper left encoded region is the same as the width of the left encoded region, and the height of the upper left encoded region is the same as the height of the upper encoded region. For example, for each combination, the template of the current block is predicted using that combination to obtain the predicted value of the template under each combination, and a candidate combination list is constructed based on the predicted value of the template under each combination. For each combination, the template of the current block is predicted using that combination, resulting in a predicted value for the template under each combination. Specifically, the weights of the template are derived using the weighted derivation modes included in the combination. The template is then predicted using the K prediction modes included in the combination, resulting in K predicted values ​​for the template. Based on the derived template weights, the K predicted values ​​for the template are weighted to obtain the predicted value for the template under that combination. Finally, a candidate combination list is constructed based on the predicted values ​​for the template under each combination. It should be noted that the weights exported according to the weighted export mode described above can be understood as the weights corresponding to each pixel in the exported template, or as the weight matrix corresponding to the exported template. Specifically, when determining the predicted value of the template based on the weights, one can determine K predicted values ​​corresponding to each pixel in the template, and then determine the predicted value corresponding to each pixel based on the K predicted values ​​and their weights. The predicted values ​​corresponding to each pixel in the template constitute the predicted value of the template. Optionally, when determining the predicted value of the template based on the weights, it can also be performed in blocks. For example, to determine the predicted value of the template, the K predicted values ​​of the template can be weighted according to the template's weight matrix to obtain the predicted value of the template. In some embodiments, S201-A1 includes the following steps S201-A11 to S201-A13: S201-A11. Determine R second combinations. Each of the R second combinations includes a weighted derived pattern and K prediction patterns. The weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely the same. R is a positive integer greater than 1. S201-A12. For any of the R second combinations, use the weighted derivation mode and K prediction modes in the second combination to predict the template and obtain the template prediction value corresponding to the second combination. S201-A13. Construct a candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations. In this embodiment, when constructing the candidate combination list, the encoder first determines R second combinations. This application does not limit the specific value of the R second combinations, for example, 8, 16, 32, etc. Each of the R second combinations includes a weighted derived pattern and K prediction patterns, and the weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely identical. Next, for each of the R second combinations, the template of the current block is predicted using the weighted derived pattern and K prediction patterns included in that second combination, obtaining the predicted value of the template under that second combination. Finally, based on the template prediction value corresponding to each of the R second combinations, a candidate combination list is constructed. The methods for constructing a candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations in S201-A13 above include, but are not limited to, the following: Method 1: Construct a candidate combination list based on the magnitude of the template prediction value corresponding to each of the R second combinations. For example, based on the magnitude of the template prediction value corresponding to each of the R second combinations, the R second combinations are sorted, and the sorted R second combinations are determined as a candidate combination list. At this time, the candidate combination list includes R candidate combinations. For example, based on the magnitude of the template prediction value corresponding to each of the R second combinations, the R second combinations are sorted, and N second combinations are selected from the sorted R second combinations to form a candidate combination list. At this time, the candidate combination list includes N candidate combinations. Method 2, the above S201-A13 includes the following steps: S201-A13-1. Determine the cost corresponding to the second combination based on the template prediction value and the template reconstruction value corresponding to the second combination. S201-A13-2. Based on the cost of each of the R second combinations, construct a candidate combination list. Since the template of the current block is a reconstructed region, the encoder can obtain the reconstructed value of the template. Therefore, for each of the R second combinations, the prediction distortion cost corresponding to that second combination can be determined based on the predicted value and the reconstructed value of the template. The methods for determining the cost of the second combination include, but are not limited to, SAD, SATD, and SEE. Next, a candidate combination list is constructed based on the cost corresponding to each of the R second combinations. In S201-A13-2, the methods for constructing a candidate combination list based on the costs corresponding to each of the R second combinations include, but are not limited to, the following examples: Example 1: Sort the R second combinations according to the cost of each of the R second combinations; determine the R second combinations as a candidate combination list. The candidate combination list generated in Example 1 includes R candidate combinations. Optionally, the R candidate combinations in the candidate combination list are sorted in ascending order of cost, that is, the costs corresponding to the R candidate combinations in the candidate combination list increase sequentially according to the sorting. Specifically, sorting the R second combinations based on the cost of each of the R second combinations can be done by sorting the R second combinations in ascending order of cost. Example 2: Based on the cost corresponding to the second combination, select N second combinations from R second combinations, and determine the list of these N second combinations as the candidate combination list. Optionally, the above N second combinations are the top N second combinations with the smallest cost among the R second combinations. For example, based on the cost corresponding to each of the R second combinations, the N second combinations with the smallest cost are selected from the R second combinations to form a candidate combination list. In this case, the candidate combination list includes N candidate combinations. Optionally, the N candidate combinations in the candidate combination list are sorted in ascending order of cost, that is, the costs corresponding to the N candidate combinations in the candidate combination list increase sequentially according to the sorting. The process of determining R second combinations in S201-A11 above is described below. In some embodiments, the aforementioned R second combinations are preset. Each of the preset R second combinations is used to predict the template of the current block, obtaining a template prediction value corresponding to each second combination. Then, based on the template prediction value and the reconstructed template value, the cost corresponding to each second combination is determined. Based on the cost of each second combination, the R second combinations are sorted, and the sorted R second combinations are used as a candidate combination list. Alternatively, N second combinations with the lowest costs are selected from the sorted R second combinations to form a candidate combination list. In some embodiments, S201-A11 includes the following steps: S201-A11-1. Determine P weighted derived patterns and Q prediction patterns, where P is a positive integer and Q is a positive integer greater than or equal to K; S201-A11-2. Based on P weighted derived patterns and Q prediction patterns, construct R second combinations. Any second combination among the R second combinations includes one weighted derived pattern from the P weighted derived patterns and K prediction patterns from the Q prediction patterns. P are all positive integers and Q are positive integers greater than or equal to K. In this embodiment, the encoder first determines P weighted derived patterns and Q prediction patterns, and then constructs R second combinations based on the determined P weighted derived patterns and Q prediction patterns. The embodiments of this application do not limit the specific number of the above-mentioned P weighted derivation modes and Q prediction modes. In one possible implementation, assuming the current block is an intra-coded block, it is assumed that there are 64 possible weighted derivation modes and 67 possible intra-prediction modes for the GPM, which can be found in the VVC standard. However, this does not limit the possible weights of the GPM to only 64, or any specific 64. It should be noted that the reason VVC chooses 64 weights for its GPM is a trade-off between improved prediction performance and increased overhead in the bitstream. This application, however, does not use a fixed logic to encode the weighted derivation modes, so theoretically, this application can use a wider variety of weights and employ them more flexibly. Similarly, it does not limit the intra-prediction modes of the GPM to only 67, or any specific 67. Theoretically, all possible intra-prediction modes can be used in the GPM. For example, if the intra-angle prediction mode is made more refined, generating more intra-angle prediction modes, then the GPM can also use more intra-angle prediction modes. For example, VVC's MIP (matrix-based intra prediction) mode can also be used in this application, but considering that MIP has multiple sub-modes to choose from, MIP is not included in this embodiment for ease of understanding. There are also some wide-angle modes that can be used in this application, but they will not be described in this embodiment. Assuming K=2, the above K prediction modes include the first prediction mode and the second prediction mode. Assuming there are 67 available prediction modes (i.e., Q=67), the first prediction mode has 67 possibilities. Since the second prediction mode is different from the first prediction mode, there are 66 possibilities for the second prediction mode. Assuming there are 64 weighted derivation modes (i.e., P=64), then this application may use any two different prediction modes and any weighted derivation mode to form a second combination, for a total of 64*67*66 possible second combinations. In this implementation, the P weighted derived modes represent all possible weighted derived modes, such as the 64 weighted derived modes in GPM, and the Q prediction modes represent all possible prediction modes, such as the 67 intra-frame prediction modes in GPM. An exhaustive method is used to obtain all possible second combinations, for example, 64*67*66 possible second combinations. 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, based on the distortion cost of each second combination, the candidate combination list corresponding to the current block is obtained. In some embodiments, in order to reduce the amount of data and improve the speed of building the candidate combination list, not every prediction mode is tried, but only some prediction modes are selected for trying. At this point, the methods for determining the Q prediction modes in S201-A11-1 above include, but are not limited to, the following: Method 1: Q prediction patterns are preset prediction patterns. Method 2: Determine at least one of the following: the candidate prediction mode list for the current block, the alternative prediction mode list corresponding to each of the K prediction modes, and the prediction mode corresponding to the weighted derivation mode. Based on the candidate prediction mode list, the alternative prediction mode list corresponding to each of the K prediction modes, and the prediction mode corresponding to the weighted derivation mode, determine Q prediction modes. The candidate prediction mode list includes multiple candidate prediction modes, and the alternative prediction mode list corresponding to any one of the K prediction modes includes at least one alternative prediction mode. Determining the candidate prediction mode lists corresponding to the K prediction modes can be understood as identifying a candidate prediction mode list for each of the K prediction modes. When constructing the second combination later, a prediction mode in the second combination is selected from the candidate prediction mode list corresponding to that prediction mode. For example, if K=2, and the K prediction modes include a first prediction mode and a second prediction mode, the encoder constructs a candidate prediction mode list 1 for the first prediction mode and a candidate prediction mode list 2 for the second prediction mode. Thus, when constructing different second combinations later, a candidate prediction mode is selected from candidate prediction mode list 1 as the first prediction mode, and a candidate prediction mode is selected from candidate prediction mode list 2 as the second prediction mode. This weighted derived mode, along with the currently selected first and second prediction modes, forms a second combination. The embodiments of this application do not limit the method for determining the list of alternative prediction modes corresponding to each of the K prediction modes. In one possible implementation, for any prediction mode among K prediction modes, a candidate prediction mode list corresponding to the prediction mode is determined, as well as at least one of the prediction modes corresponding to the weight-derived mode; based on the candidate prediction mode list and at least one of the prediction modes corresponding to the weight-derived mode, an alternative prediction mode list corresponding to the prediction mode is determined. In this embodiment of the application, the process of determining the candidate prediction mode list corresponding to a certain prediction mode among K prediction modes is basically similar to the process of determining the candidate prediction mode list corresponding to the current block, and can be referred to the following description for details. In some embodiments, the candidate prediction mode list includes one or more inter-frame prediction modes, such as at least one of skip, merge, normal inter-frame prediction mode, one-way prediction, two-way prediction, and multiple hypothesis prediction. In some embodiments, the candidate prediction mode list includes one or more intra-frame prediction modes, such as at least one of Direct Current (DC) mode, Planar mode, Angular mode, etc. Optionally, the candidate prediction mode list includes at least one intra-frame prediction mode from the MPM list. In some embodiments, the above-mentioned candidate prediction pattern list may also include patterns such as IBC and palette. This application does not impose any restrictions on the type or number of prediction modes included in the above candidate prediction mode list. In some embodiments, the candidate prediction pattern list is determined by at least one of the following methods: Method 1: The aforementioned candidate prediction pattern list includes preset patterns. Method 2: The aforementioned candidate prediction pattern list includes patterns from the MPM list. In some embodiments, the candidate intra-prediction mode list can be the MPM list of the current block. For example, in VVC, the current block can obtain an MPM list of length 6. Furthermore, in some subsequent technological evolutions, there is a secondary MPM scheme that may derive an MPM list of length 22; that is, the combined length of the first and second MPM lists is 22. In other words, embodiments of this application can use MPMs to filter intra-prediction modes. In some embodiments, if the preset mode is not included in the candidate prediction mode list determined above, the preset mode is added to the candidate prediction mode list. Optionally, the preset modes mentioned above include at least one of DC, horizontal mode, and vertical mode. Optionally, preset modes can be added under certain conditions. One example is adding a mode when the number of prediction modes in the candidate prediction modes is less than or equal to a threshold, such as 3, 4, 5, 6, etc. Method 3: The aforementioned candidate prediction pattern list includes a set of candidate prediction patterns determined according to certain rules, such as equal interval filtering. Method 4: Determine a list of candidate prediction modes based on the prediction modes used by at least one block adjacent to the current block. For example, the prediction modes used by one or more blocks adjacent to the current block are added to the candidate prediction mode list to obtain the candidate prediction mode list for the current block, or the candidate prediction mode list corresponding to the kth prediction mode among K prediction modes is obtained, where the kth prediction mode is any one of the K prediction modes. For example, the prediction mode corresponding to the k-th prediction mode among the prediction modes used by one or more blocks adjacent to the current block can be added to the candidate prediction mode list corresponding to the k-th prediction mode. For instance, suppose K=2, the k-th prediction mode is the first prediction mode, and the two blocks adjacent to the current block also use two prediction modes for weighted prediction. The first adjacent block uses prediction mode 1 and prediction mode 3, and the second adjacent block uses prediction mode 4 and prediction mode 5. In this case, prediction mode 1 and prediction mode 4 can be added to the candidate prediction mode list corresponding to the first prediction mode. It should be noted that methods 1 to 4 above can be used individually or in any combination to determine the list of candidate prediction modes. In some embodiments, the candidate prediction mode list includes at least one of a candidate intra-frame prediction mode list and a candidate inter-frame prediction mode list. Specifically, the candidate intra-frame prediction mode list includes at least one candidate intra-frame prediction mode, and the candidate inter-frame prediction mode list includes at least one candidate inter-frame prediction mode. After obtaining the candidate prediction mode list for the current block using the above method, Q prediction modes are determined based on the candidate prediction mode list. For example, all or part of the candidate prediction modes included in the candidate prediction mode list are determined as all or part of the Q prediction modes. The process of determining the prediction model corresponding to the weighted derivation model is described below. In this embodiment, the prediction mode corresponding to the weight derivation mode is a general term, such as a prediction mode corresponding to a preset weight derivation mode, or a prediction mode corresponding to several preset weight derivation modes. In some embodiments, the prediction mode corresponding to the weight derivation mode can also be understood as a list of prediction modes corresponding to the weight derivation mode, and the list of prediction modes includes at least one prediction mode. In some embodiments, the prediction mode corresponding to the above-mentioned derived mode includes the prediction mode corresponding to at least one of the P weight derived modes. In this case, determining the prediction mode corresponding to the weight derived mode includes: for the p-th weight derived mode among the P weight derived modes, determining the prediction mode corresponding to the p-th weight derived mode; and determining the prediction mode corresponding to the weight derived mode based on the prediction mode corresponding to at least one of the P weight derived modes, where p is a positive integer. In this embodiment of the application, the process of determining the prediction mode corresponding to each of the P weighted derivation modes is basically the same. For ease of description, the p-th weighted derivation mode among the P weighted derivation modes will be used as an example for the following explanation. The prediction mode corresponding to the p-th weighted derived mode can be determined in the following two ways: Method 1: If at least one of the prediction modes corresponding to the p-th weighted derived mode is an intra-prediction mode, determine the angle index according to the p-th weighted derived mode; determine the intra-prediction mode corresponding to the angle index as at least one of the prediction modes corresponding to the p-th weighted derived mode. The angle index is used to indicate the boundary angle index of the weights. In some embodiments, the angleIdx field represents the angle index. Table 2 above shows the correspondence between merge_gpm_partition_idx and angleIdx. Referring to Table 2 above, the angle index can be derived according to the p-th weight derivation mode. In this application, the angle index and the intra-frame prediction mode have a corresponding relationship, that is, different angle indices correspond to different intra-frame prediction modes. For example, the correspondence between angle index and intra-frame prediction mode is shown in Table 7. In this method, taking K=2 as an example, if the first or second prediction mode is an intra-prediction mode, the angle index is determined according to the p-th weighted derived mode. For example, according to Table 2 above, the angle index corresponding to the p-th weighted derived mode is derived. Then, in Table 7 above, the intra-prediction mode corresponding to the angle index is determined. For example, if the angle index is 2, its corresponding intra-prediction mode is 42, and then the intra-prediction mode 42 is determined as the first or second prediction mode. Method 2: If at least one of the prediction modes corresponding to the p-th weighted derivation mode is an intra-prediction mode, determine the intra-prediction mode corresponding to the p-th weighted derivation mode; determine at least one of the intra-prediction modes corresponding to the p-th weighted derivation mode as at least one of the prediction modes corresponding to the p-th weighted derivation mode. The intra-prediction mode corresponding to the p-th weight derivation mode includes at least one of the following: an intra-prediction mode in which the prediction direction is parallel to the weight boundary line, an intra-prediction mode in which the prediction direction is perpendicular to the boundary line, and a planar mode. It should be noted that intra-prediction modes with prediction directions parallel to the weight boundary include one or more intra-prediction modes with prediction directions parallel or approximately parallel to the weight boundary. Intra-prediction modes with prediction directions perpendicular to the weight boundary include one or more intra-prediction modes with prediction directions perpendicular or approximately perpendicular to the weight boundary. In this second method, taking K=2 as an example, if the first prediction mode and / or the second prediction mode are intra-frame prediction modes, the first prediction mode and / or the second prediction mode are determined from the intra-frame prediction modes corresponding to the weight-derived modes. For example, the first prediction mode and / or the second prediction mode can be intra-frame prediction modes that are on the same straight line or approximately on the same straight line as the weight dividing line (also called the boundary line). Alternatively, the first prediction mode and / or the second prediction mode can be intra-frame prediction modes whose prediction direction is perpendicular to or approximately perpendicular to the weight dividing line. For example, if the weight dividing line is horizontal, as shown in Figure 4 with GPM indices of 18, 19, 50, and 51, the first prediction mode and / or the second prediction mode is either the horizontal mode 18 or the vertical mode 50. Based on the above steps, the encoding end determines the prediction mode corresponding to at least one of the P weighted derived modes. Then, based on the prediction mode corresponding to at least one of the P weighted derived modes, it determines the prediction mode corresponding to the weighted derived mode. For example, all or part of the prediction modes corresponding to at least one of the P weighted derived modes are used as the prediction mode corresponding to the weighted derived mode. Furthermore, among the prediction modes corresponding to the P weighted derived modes, there may be duplicate prediction modes. In this case, the duplicate prediction modes are removed, and the remaining different prediction modes are determined as the prediction modes corresponding to the weighted derived modes. In this embodiment of the application, in order to reduce the number of R second combinations, the prediction patterns are screened, specifically by determining Q prediction patterns according to the above method. In some embodiments, in order to reduce the complexity of the encoding end, the number of the above Q prediction modes is limited. For example, Q is less than or equal to a first preset threshold. This application does not limit the specific value of the first preset threshold, which can be determined according to actual needs. For example, the first preset threshold is 6, that is, 6 prediction modes are selected to construct R second combinations to control the number of second combinations. In some embodiments, the size of Q is related to the size and / or shape of the current block, wherein the shape of the current block can be understood as being determined by the aspect ratio of the current block. During prediction, for smaller blocks, similar prediction patterns have little impact on the prediction results, while for larger blocks, the difference in impact becomes more pronounced. Therefore, embodiments of this application assign different Q values ​​to blocks of different sizes; that is, larger Q values ​​are assigned to larger blocks, and smaller Q values ​​are assigned to smaller blocks. At this point, when determining the Q value corresponding to the current block, it is set according to the size of the current block. For example, if the size of the current block is greater than the first value, then Q is greater than or equal to the second preset threshold. As another example, if the size of the current block is less than or equal to the first value, then Q is less than the third preset threshold. This application embodiment does not limit the specific sizes of the first value, the second prediction threshold, and the third preset threshold, wherein the third preset threshold is less than the second preset threshold. The process of determining P weight derivation modes in S202-A11-1 is described below. As can be seen from the above, GPM includes 64 weight derivation modes, and AWP includes 56 weight derivation modes. In some embodiments, the P weighted export patterns are the 64 weighted export patterns included in GPM, or the 56 weighted export patterns included in AWP. In some embodiments, P weight derivation patterns are selected from M preset weight derivation patterns, where M is a positive integer greater than or equal to P. The aforementioned preset M weight export modes can be the 64 weight export modes included in GPM, or the 56 weight export modes included in AWP, or a partial weight export mode of the 64 weight export modes included in GPM, or a partial weight export mode of the 56 weight export modes included in AWP. In this embodiment, in order to further reduce the number of R second combinations, the preset M weight derivation modes are filtered, and P weight derivation modes can be selected from the preset M weight derivation modes to construct R second combinations. In some embodiments, weight export patterns corresponding to preset division angles and / or preset offsets are removed from M weight export patterns to obtain P weight export patterns. Since the same division angle can correspond to multiple offsets in a weight export pattern, as shown in weight export patterns 10, 11, 12, and 13 in Figure 16A, they have the same division angle but different offsets. This allows for the removal of some weight export patterns corresponding to preset offsets, and / or some weight export patterns corresponding to preset division angles. This reduces the total number of possible second combinations and makes the differences between the various possible second combinations more obvious. In some embodiments, different blocks may have different filtering conditions. Thus, when determining the P weight export modes corresponding to the current block, the filtering conditions corresponding to the current block are first determined, and P weight export modes are selected from the M weight export modes based on the filtering conditions corresponding to the current block. In some embodiments, the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block. During prediction, for smaller blocks, similar weight derivation patterns have little difference in impact on the prediction results, while for larger blocks, the difference in impact is more pronounced. Based on this, embodiments of this application assign different P values ​​to blocks of different sizes; that is, larger P values ​​are assigned to larger blocks, and smaller P values ​​are assigned to smaller blocks. In some embodiments, the above filtering conditions include an array containing M elements, each of which corresponds one-to-one with one of the M weighted export patterns. The element corresponding to each weighted export pattern is used to indicate whether the weighted export pattern is available. Whether a weighted export pattern is available can be understood as whether the weighted export pattern is used to form one of the P weighted export patterns for a subsequent second combination attempt. The array above can be a single-digit number or a two-digit number. In some embodiments, if the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and filtering conditions corresponding to the shape of the current block, and for the same weight export mode, if the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicate that the weight export mode is available, then the weight export mode is determined to be one of P weight export modes. If at least one of the filtering conditions corresponding to the size of the current block and the filtering conditions corresponding to the shape of the current block indicates that the weight export mode is unavailable, then the weight export mode is determined not to constitute P weight export modes. In some embodiments, multiple arrays can be used to implement the filtering conditions corresponding to different block sizes and different block shapes. In some embodiments, filtering conditions corresponding to different block sizes and filtering conditions corresponding to different block shapes can be implemented using a two-dimensional array. That is, a two-dimensional array includes both filtering conditions corresponding to block size and filtering conditions corresponding to block shape. After determining Q prediction patterns and P weighted derivation patterns according to the above steps, the encoding end uses these Q prediction patterns and P weighted derivation patterns to form R different second combinations. In some embodiments, to further improve the construction speed of the candidate combination list, the encoding end further filters the Q prediction modes and P weighted derivation modes determined above. At this time, the steps in S201-A11-21 to S201-A11-23 above, which form R second combinations based on the determined P weighted derivation modes and Q prediction modes, include the following steps: S201-A11-21. Select S weight derivation patterns from P weight derivation patterns, where S is a positive integer less than or equal to P. Specifically, from the P weight derivation patterns determined above, weight derivation patterns with low probability of occurrence are removed to obtain S weight derivation patterns after filtering. Among them, the methods for selecting S weight derivation patterns from P weight derivation patterns in S201-A11-21 above include, but are not limited to, the following: Method 1: For the i-th weighted export pattern among P weighted export patterns, determine the weights of K second prediction patterns on the template based on the i-th weighted export pattern. The K second prediction patterns are any K prediction patterns among Q prediction patterns, where i is a positive integer from 1 to P. If the weight of any prediction pattern among the K prediction patterns on the template is less than the first preset value, then remove the i-th weighted export pattern from the P weighted export patterns to obtain S weighted export patterns. In Method 1, if a weighted derivation pattern derives template weights that result in a prediction pattern having little or no influence on the template, then that weighted derivation pattern is not used. For example, weighted derivation pattern 52 in Figure 4 (the square block) results in a small weight for the second prediction pattern on the template. Another example is weighted derivation pattern 54, which results in a weight of 0 for the second prediction pattern on the template. In other words, under weighted derivation pattern 54, the second prediction pattern has no influence on the template, and the predicted value of the template is entirely determined by the first prediction pattern. In this case, the second prediction pattern has no effect whatsoever, and such weighted derivation patterns need to be removed from the P weighted derivation patterns. In the above method 1, the weight export patterns that make the weight of any one of the K prediction patterns on the template less than the first preset value are removed from the P weight export patterns, resulting in S weight export patterns. The embodiments of this application do not limit the specific value of the first preset value, for example, it can be a smaller value that is greater than or equal to 0. Method 2: For the i-th weight export pattern among the P weight export patterns, determine the cost of using the i-th weight export pattern to predict the template, where i is a positive integer from 1 to P; based on the cost corresponding to the i-th weight export pattern, select S weight export patterns from the P weight export patterns. In this method 2, S weight export patterns are selected from the P weight export patterns by calculating the cost corresponding to each weight export pattern among the P weight export patterns. In this embodiment of the application, the weighted derivation mode and K prediction modes are combined as a group for cost calculation. Thus, for ease of calculation, based on the given K prediction modes, the cost of P weighted derivation modes is calculated. That is, the P weighted derivation modes are combined with the set K prediction modes to obtain P combinations. The cost corresponding to each of these P combinations is calculated to obtain the cost of the P weighted derivation modes. Based on the above method, after determining the cost corresponding to the i-th weight export pattern among the P weight export patterns, S weight export patterns are selected from the P weight export patterns according to the cost corresponding to the i-th weight export pattern. In this method 2, the encoder selects S weight export patterns from P weight export patterns based on the cost corresponding to the i-th weight export pattern, including the following methods: In the first approach, if the cost corresponding to the i-th weighted derivation pattern is less than the second preset value, then a weighted derivation pattern similar to the i-th weighted derivation pattern is selected from the P weighted derivation patterns. Based on the i-th weighted derivation pattern and its similar weighted derivation patterns, S weighted derivation patterns are determined. Here, the similar weighted derivation patterns of the i-th weighted derivation pattern can be understood as weighted derivation patterns whose prediction results are similar to those of the i-th weighted derivation pattern. The embodiments of this application do not limit the size of the second preset value, but determine it according to actual needs. In some embodiments, the encoder may also select S weight derivation modes from P weight derivation modes according to the second method below. In the second approach, if the cost corresponding to the i-th weight export pattern is greater than the third preset value, then the i-th weight export pattern and its similar weight export patterns are removed from the P weight export patterns to obtain at least one weight export pattern after removal; based on the at least one weight export pattern after removal, S weight export patterns are determined. The embodiments of this application do not limit the size of the third preset value, but determine it according to actual needs. The third preset value is greater than the second preset value. Based on the above steps, after the encoding end selects S weight export patterns from P weight export patterns, it executes the following steps S201-A11-22. S201-A11-22. Select T prediction patterns from Q prediction patterns, where T is a positive integer less than or equal to Q. The embodiments of this application do not limit the method of selecting T prediction modes from Q prediction modes. In some embodiments, T preset prediction patterns are selected from Q prediction patterns. In some embodiments, for the i-th prediction mode among the Q prediction modes, the encoder determines the cost of using the i-th prediction mode to predict the template, where i is a positive integer from 1 to Q; and selects T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode. In this embodiment of the application, the weighted derivation mode and K prediction modes are combined as a group for cost calculation. Thus, for ease of calculation, based on the given weighted derivation mode and other K-1 prediction modes, the cost of Q weighted derivation modes is calculated. That is, the Q prediction modes are combined with the set weighted derivation mode and K-1 prediction modes respectively to obtain Q combinations. The cost corresponding to each of these Q combinations is calculated to obtain the cost of the Q prediction modes. For example, suppose we have K-1 prediction patterns, designated as prediction pattern 1, and a weighted derived pattern, designated as weighted derived pattern 1. For the i-th prediction pattern among the Q prediction patterns, weighted derived pattern 1, along with the i-th prediction pattern and prediction pattern 1, forms a combination, denoted as combination i. Using combination i, we predict the template of the current block, obtaining the predicted value of the template under combination i. Based on the predicted value and the reconstructed value of the template under combination i, we determine the prediction distortion cost corresponding to combination i. This prediction distortion cost corresponding to combination i is then used as the cost corresponding to the i-th prediction pattern. This allows us to determine the cost corresponding to any one of the Q prediction patterns. Based on the above method, after determining the cost corresponding to the i-th prediction mode among the Q prediction modes, T prediction modes are selected from the Q prediction modes according to the cost corresponding to the i-th prediction mode. The encoding end selects T prediction modes from Q prediction modes based on the cost corresponding to the i-th prediction mode, including the following methods: In the first approach, if the cost corresponding to the i-th prediction mode is less than the fourth preset value, then a prediction mode similar to the i-th prediction mode is selected from the Q prediction modes. Based on the i-th prediction mode and the similar prediction modes of the i-th prediction mode, T prediction modes are determined. Here, a prediction mode similar to the i-th prediction mode can be understood as a prediction mode whose prediction result is similar (or close) to the prediction reception of the i-th prediction mode. For example, a prediction mode whose prediction direction (or angle) is close to the prediction direction (or angle) of the i-th prediction mode, or a prediction mode whose prediction mode index is close to the index of the i-th prediction mode. For example, a prediction mode whose index is 1 or 2 larger than the index of the i-th prediction mode, or a prediction mode whose index is 1 or 2 smaller than the index of the i-th prediction mode. The embodiments of this application do not limit the size of the fourth preset value mentioned above, and the specific value is determined according to actual needs. The second approach is to remove the i-th prediction mode and its similar prediction modes from the Q prediction modes to obtain at least one prediction mode after removal; and to determine T prediction modes based on the at least one prediction mode after removal. The embodiments of this application do not limit the size of the fifth preset value mentioned above, but determine it according to actual needs. The fifth preset value is greater than the fourth preset value mentioned above. Based on the above steps, select S weighted export patterns from P weighted export patterns, select T prediction patterns from Q prediction patterns, and then execute S201-A11-23 as follows. S201-A11-23. Based on S weighted derived patterns and T prediction patterns, R second combinations are formed. Specifically, select one weighted derived pattern from S weighted derived patterns, and select K prediction patterns from T prediction patterns. This weighted derived pattern and the K prediction patterns form a second combination. Repeat this step to obtain R second combinations. In some embodiments, S201-A11-2 includes: for the i-th weighted derivation mode among P weighted derivation modes, determining the cost of using the i-th weighted derivation mode and the j-th prediction mode among Q prediction modes to predict the template; if the cost corresponding to the combination of the i-th weighted derivation mode and the j-th prediction mode is greater than a sixth preset value, then removing the j-th prediction mode and similar prediction modes of the j-th prediction mode from the Q prediction modes to obtain at least one prediction mode after removal; and constructing R second combinations based on the i-th weighted derivation mode and the at least one prediction mode after removal. In this embodiment, when the weighted derivation mode and one prediction mode are fixed, the other prediction mode is selected. For example, if a certain intra-prediction mode under a certain weighted derivation mode cannot achieve a relatively low cost as the first prediction mode, then the intra-prediction mode similar to that intra-prediction mode under that weighted derivation mode will no longer be tried as the first prediction mode. Based on the above steps, we can determine the set of predicted modes after final elimination for each of the P weighted derived modes. Then, based on the P weighted derived modes and their respective sets of predicted modes after final elimination, we can construct R second combinations. It should be noted that the above embodiments illustrate a method of filtering prediction modes in the form of combinations. Optionally, either the weighted derivation mode or the prediction mode can be filtered in the form of combinations to finally construct R second combinations. After determining R second combinations according to the above methods, the encoder uses the weighted derivation mode and K prediction modes in the second combination to predict the template and obtain the template prediction value corresponding to the second combination. The following describes the process of using any second combination to predict the template of the current block and obtaining the predicted value of the template. First, the weights of the template are determined using the weight derivation patterns included in the second combination. Currently, as shown in Figure 13 above, the template for the current block is either 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. In some embodiments, the weight matrix can be directly extended towards the template region, for example, extending left and upward, covering the template with the weight matrix to determine the template's weights. For example, as shown in Figure 17, a small rectangular region on the upper left side of the current block can be added to the template, combining the template and the current block to form a rectangle. Alternatively, only the left and upper parts can be used as the template. As shown in Figure 17, taking the addition of the upper left region as an example, the regions within the inverted L-shaped frames on the left, upper left, and top sides are the template region, and the rectangular region on the lower right is the current block. Then, the weight matrix extended to the upper left becomes the template's weight matrix. In some embodiments, the process of deriving template weights and predicted value weights according to the weight derivation mode is combined, for example, simultaneously deriving template weights and predicted value weights. The weight of the predicted value can be understood as the weight corresponding to the predicted value. For example, a first predicted value is obtained using a first prediction mode, a second predicted value is obtained using a second prediction mode, a first weight of the first predicted value is determined according to the weight derivation mode, a second weight of the second predicted value is determined according to the weight derivation mode, and 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. In order to distinguish it from the template weights, this application refers to the first and second weights as the weights of the predicted values. In some embodiments, determining template weights based on the weight derivation mode includes the following steps: Step 3: Determine the angle index and distance index based on the weighted export mode; Step 4: Determine the template weight based on the angle index, distance index, and template size. This application can derive template weights in the same way as deriving the weights of the predicted values. For example, firstly, based on the weight deriving mode, the angle index and distance index are determined, where the angle index can be understood as the boundary angle index of each weight derived by the weight deriving mode. For instance, according to Table 2 above, the angle index and distance index corresponding to the weight deriving mode can be determined; for example, if the weight deriving mode is 27, then 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 the size of the template. In step 4 above, the methods for determining the template weight based on the angle index, distance index, and template size include, but are not limited to, the following: Method 1: Determine the template weight directly based on the angle index, distance index, and template size. In this case, step 4 above includes steps 41 to 43 as follows: Step 41: Determine the first parameter of the pixels in the template based on the angle index, distance index, and template size; Step 42: Determine the weight of the pixels in the template based on the first parameter of the pixels in the template; Step 43: Determine the template weight based on the weight of each pixel in the template. In this implementation, the weights of pixels in the template are determined based on the angle index, distance index, template size, and current block size. Then, the weight matrix composed of the weights of each point in the template is determined as the template weight. The first parameter of this application is used to determine the weight. In some embodiments, the first parameter is also referred to as the weight index. In one possible implementation, the offset and the first parameter can be determined as follows: The inputs for the template weight derivation process are as follows: as shown in Figure 18, 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 "division" angle index variable angleId of GPM; the distance index variable distanceIdx of GPM; and the component index variable cIdx. For example, this application takes the luminance component as an example, so cIdx is 0, which represents the luminance component. The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are exported as follows: nW=(cIdx==0)? nCbW:nCbW*SubWidthC nH=(cIdx==0)? nCbH:nCbH*SubHeightC shift1 = Max(5, 17 - BitDepth) where BitDepth is the bit depth of the encoding / decoding process. offset1 = 1 << (shift1 - 1) displacementX = angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1 The offsets offsetX and offsetY are derived as follows: - If the value of shiftHor is 0: offsetX = (-nW) >> 1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) Otherwise (i.e., shiftHor is 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY = (-nH) >> 1 The template weight matrix wTemplateValue[x][y] (where x = -nTmW..nCbW–1, y = -nTmH..nCbH–1, excluding cases where x and y are both greater than or equal to 0) is derived as follows, with the top-left corner of the current block as (0, 0): – Variables xL and yL are derived as follows: xL=(cIdx==0)? x:x*SubWidthC yL=(cIdx==0)? y:y*SubHeightC disLut is determined according to Table 3 above. The first parameter, weightIdx, is derived as follows: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] Based on the above method, after determining the first parameter weightIdx, the weight at the midpoint (x, y) of the template is determined according to weightIdx. In this application, the methods for determining the weight of pixels in the template based on the first parameter of the pixels in the template in step 42 above include, but are not limited to, the following: Method 1: Determine the second parameter of the pixel in the template based on the first parameter of the pixel in the template; determine the weight of the pixel in the template based on the second parameter of the pixel in the template. The second parameter is also used to determine the weight. In some embodiments, the second parameter is also called the weight index under the first component, which can be the luminance component, chrominance component, etc. For example, the weights of pixels in the template are determined according to the formula: weightIdxL=partFlip? 32+weightIdx:32-weightIdx wTemplateValue[x][y]=Clip3(0,8,(weightIdxL+4)>>3) Where wTemplateValue[x][y] is the weight of the template midpoint (x, y), weightIdxL is the second parameter of the template midpoint (x, y), also known as the weight index under the first component (e.g., the luminance component), and partFlip is an intermediate variable determined according to the angle index angleIdx, for example, as mentioned above: partFlip = (angleIdx>=13&&angleIdx<=27)? 0:1, that is, the value of partFlip is 1 or 0. When partFlip is 0, weightIdxL is 32 – weightIdx, and when partFlip is 1, weightIdxL is 32 + weightIdx. It should be noted that 32 here is just an example, and this application is not limited to this. Method 2: Determine the weight of the pixels in the template based on the first parameter, the first threshold, and the second threshold of the pixels in the template. To reduce the computational complexity of template weights, Method 2 limits the weights of pixels in the template to either a first threshold or a second threshold. In other words, the weights of pixels in the template are either the first threshold or the second threshold, thereby reducing the computational complexity of template weights. This application does not impose any restrictions on the specific values ​​of the first threshold and the second threshold. Optionally, the first threshold is 1. Optionally, the second threshold is 0. In one example, the weights of pixels in the template can be determined using the following formula: wTemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 Where wTemplateValue[x][y] is the weight of the midpoint (x, y) of the template, and the 1 in the above "1:0" is the first threshold and the 0 is the second threshold. In the first method described above, the weight of each point in the template is determined by the weight derivation mode, and the weight matrix composed of the weights of each point in the template is used as the template weight. Method 2 involves determining the weights of the current block and the template based on the weight export mode. In other words, in Method 2, the merged region consisting of the current block and the template is treated as a whole, and the weights of the pixels within the merged region are exported according to the weight export mode. Therefore, step 4 above includes the following steps 4-1 and 4-2: Step 4-1: Determine the weights of pixels in the merged region composed of the current block and the template based on the angle index, distance index, template size, and current block size; Step 4-2: Determine the template weight based on the size of the template and the weight of the pixels in the merged region. In this second method, the current block and the template are treated as a whole. The weights of the pixels in the merged region composed of the current block and the template are determined based on the angle index, distance index, template size and current block size. Then, based on the template size, the weights corresponding to the template in the merged region are determined as template weights. For example, as shown in Figure 18, the weights corresponding to the L-shaped template region in the merged region are determined as template weights. In this second method, not only the template weights are determined in one weight determination process, but also the weights of the predicted values. That is, after removing the template weights from the weights corresponding to the merged regions, the remaining weights are the weights of the predicted values. Then, the subsequent prediction process can be executed based on the weights of the predicted values ​​without having to redetermine the weights of the predicted values, thereby reducing the prediction steps and improving prediction efficiency. This application does not limit the specific implementation of determining the weights of pixels in the merged region composed of the current block and the template based on the angle index, distance index, template size, and current block size. In some embodiments, determining the weights of pixels in the merged region in step 4-1 above includes the following steps 4-11 to 4-12: Step 4-11: Determine the first parameter of the pixels in the merged region based on the angle index, distance index, and size of the merged region; Step 4-12: Determine the weight of the pixels in the merged region based on the first parameter of the pixels in the merged region. In this implementation, the weights of pixels in the merged region are determined based on the angle index, distance index, and size of the merged region, forming a weight matrix composed of the weights of each point in the merged region. In one possible implementation, the offset and the first parameter can be determined as follows: The inputs for the merged region weight derivation process are as follows: as shown in Figure 18, the width of the current block nCbW, the height of the current block nCbH; the width of the left template nTmW, the height of the upper template nTmH; the "division" angle index variable angleId of GPM; the distance index variable distanceIdx of GPM; and the component index variable cIdx. For example, this application takes the luminance component as an example, so cIdx is 0, indicating the luminance component. The variables nW, nH, shift1, offset1, displacementX, displacementY, partFlip, and shiftHor are exported as follows: nW=(cIdx==0)? nCbW:nCbW*SubWidthC nH=(cIdx==0)? nCbH:nCbH*SubHeightC shift1 = Max(5, 17 - BitDepth) where BitDepth is the bit depth of the encoding / decoding process. offset1 = 1 << (shift1 - 1) displacementX = angleIdx displacementY=(angleIdx+8)%32 partFlip=(angleIdx>=13&&angleIdx<=27)? 0:1 shiftHor=(angleIdx%16==8||(angleIdx%16!=0&&nH>=nW))? 0:1 The offsets offsetX and offsetY are derived as follows: - If the value of shiftHor is 0: offsetX = (-nW) >> 1 offsetY=((-nH)>>1)+(angleIdx<16?(distanceIdx*nH)>>3:-((distanceIdx*nH)>>3)) Otherwise (i.e., shiftHor is 1): offsetX=((-nW)>>1)+(angleIdx<16?(distanceIdx*nW)>>3:-((distanceIdx*nW)>>3) offsetY = (-nH) >> 1 The weight matrix wValueMatrix[x][y] of the pixels in the merged region (where x = -nTmW..nCbW–1, y = -nTmH..nCbH-1) is derived as follows, with the top-left corner of the current block as (0, 0): – Variables xL and yL are derived as follows: xL=(cIdx==0)? x:x*SubWidthC yL=(cIdx==0)? y:y*SubHeightC disLut is determined according to Table 3. The first parameter, weightIdx, is derived as follows: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] Based on the above method, after determining the first parameter weightIdx, the weight at point (x, y) in the merged region is determined according to weightIdx. In this application, the methods for determining the weights of pixels in the merged region based on the first parameter of the pixels in the merged region in steps 4-12 above include, but are not limited to, the following: Method 1: Determine the second parameter of the pixels in the merged region based on the first parameter of the pixels in the merged region; determine the weight of the pixels in the merged region based on the second parameter of the pixels in the merged region. For example, the weights of pixels in the merged region are determined according to the formula: weightIdx=(((xL+offsetX)<<1)+1)*disLut[displacementX]+ (((yL+offsetY)<<1)+1)*disLut[displacementY] weightIdxL=partFlip? 32+weightIdx:32-weightIdx wValueMatrix[x][y]=Clip3(0,8,(weightIdxL+4)>>3) Where wValueMatrix[x][y] is the weight of the point (x, y) in the merged region, weightIdxL is the second parameter of the point (x, y) in the merged region, and wTemplateValue[x][y] is the weight of the point (x, y) in the merged region. Method 2: Determine the weight of pixels in the merged region based on the first parameter, first threshold and second threshold of the pixels in the merged region. For example, the weight of pixels in the merged region is either a first threshold or a second threshold. To reduce the computational complexity of the weights in the merged region, Method 2 limits the weights of pixels in the merged region to either a first threshold or a second threshold. In other words, the weights of pixels in the merged region are either the first threshold or the second threshold, thereby reducing the computational complexity of the weights in the merged region. This application does not impose any restrictions on the specific values ​​of the first threshold and the second threshold. Optionally, the first threshold is 1. Optionally, the second threshold is 0. In one example, the weights of pixels in the merged region can be determined using the following formula: wTemplateValue[x][y]=(partFlip?weightIdx:-weightIdx)>0?1:0 Where wValueMatrix[x][y] represents the weight of the point (x, y) in the merged region, and the 1 in the above "1:0" represents the first threshold and the 0 represents the second threshold. In the second method described above, the weight of each point in the merged region composed of the current block and the template is determined by the weight derivation mode. Then, based on the size of the template, the weight corresponding to the template in the merged region is determined as the template weight. In this second method, the weight of the predicted value is determined at the same time, eliminating the need to perform the subsequent steps of determining the weight of the predicted value, thus reducing the prediction steps and improving the prediction efficiency. According to the above method, after determining the template weights corresponding to the weighted derivation modes included in the second combination, the K prediction modes in the second combination are used to predict the template to obtain K prediction values. The K prediction values ​​are then weighted according to the template weights to obtain the predicted values ​​of the template. The predicted value of the template can be understood as a matrix composed of the predicted values ​​of the pixels in the template. In some embodiments, the above-mentioned predicted values ​​are also referred to as predicted samples. Next, the cost of the second combination is determined based on the predicted and reconstructed values ​​of the template. The methods for determining the cost of the second combination mentioned above include, but are not limited to, the following: Method 1: Determine the cost of the second combination using a matrix approach. Specifically, based on the predicted and reconstructed values ​​of the template, determine a loss, which is denoted as the first loss. Since the predicted and reconstructed values ​​of the template are matrices, the first loss is also a matrix. For example, the absolute value of the difference between the predicted and reconstructed values ​​of the template can be determined as the first loss, and this first loss can be used as the cost of the second combination. Method 2: Use point-by-point calculation to determine the cost of the second combination. Specifically, for the i-th pixel in the template, when determining the prediction of each of the K prediction modes in the second combination at the i-th pixel, the template weight corresponding to the i-th pixel in the template weight is determined. Based on the template weight of the i-th pixel and the K prediction values ​​of the i-th pixel, the prediction value of the i-th pixel is obtained. Based on the prediction value and the reconstructed value of the i-th pixel, the cost of the second combination at the i-th pixel is obtained. According to this method, the prediction distortion cost of the second combination at each pixel in the template can be determined. Finally, the sum of the prediction distortion costs of the second combination at each pixel in the template is determined as the cost of the second combination. Based on the above method, the cost of each of the R second combinations can be determined. Next, a candidate combination list is constructed based on the cost of each of the R second combinations. For example, based on the cost of the second combination, the R second combinations are sorted in ascending order, and the sorted R second combinations are determined as a candidate combination list. For example, based on the cost of the second combination, select the N second combinations with the smallest cost from the R second combinations to form a candidate combination list. Optionally, N can be 8, 16, or 32, etc. Based on the above method, a candidate combination list is determined. Each candidate combination in the candidate combination list is sorted in ascending order of cost. For example, the candidate combination list is shown in Table 6 above. In this way, the encoder determines the first combination from the candidate combination list shown in Table 6. For example, the candidate combination with the lowest cost in the candidate combination list is determined as the first combination, that is, the weighted derived mode included in the candidate combination is determined as the first weighted derived mode, and the K prediction modes included in the candidate combination are determined as the K first prediction modes. Then, the encoder executes the following S202. S202. Based on the first weighted derivation mode and K first prediction modes, predict the current block to obtain the predicted value of the current block. For example, the weights of the predicted values ​​are determined based on the first weighted derivation pattern, K predicted values ​​are determined based on K first prediction patterns, and the predicted value of the current block is determined based on the K predicted values ​​and their weights. In one example, the weights of the predicted values ​​derived by the first weighted derivation mode described above are a weight matrix. The implementation process of S202 is basically the same as that of S103. Referring to the description of S103, it will not be repeated here. S203. Based on the predicted value of the current block, a bitstream is obtained, which includes a first index used to indicate a first combination. Specifically, after determining the predicted value of the current block according to the above steps, the residual value of the current block is obtained based on the current block and the predicted value of the current block. The residual value of the current block is transformed to obtain the transformation coefficients. The transformation coefficients are quantized to obtain the quantization coefficients. The quantization coefficients are encoded to obtain the bitstream. In this embodiment of the application, in order to maintain consistency between the encoding and decoding ends, the encoding end indicates a first combination to the decoding end through a first index, that is, the encoding end writes the first index into the bitstream. In this way, the decoding end obtains the first index by decoding the bitstream, and then determines the first combination corresponding to the current block based on the first index, so as to use the first weighted derived mode and K first prediction modes included in the first combination to predict the current block and obtain the predicted value of the current block. This application does not limit the specific syntax element form of the first index in its embodiments. In one possible implementation, if the current block is predicted using GPM technology, then gpm_cand_idx is used to represent the first index. Since the first index is used to indicate the first combination, in some embodiments, the first index may also be referred to as the first combination index or the index of the first combination. In one example, the syntax after adding the first index to the bitstream is shown in Table 5. In some embodiments, in order to further reduce the encoding cost, the encoding end uses a variable encoding method to encode the first index into the bitstream. In some embodiments, if the number of candidate combinations included in the candidate combination list is less than a fourth preset threshold, the encoding end uses a fixed-length encoding method to encode the first index into the bitstream. That is, in this embodiment, if the number of candidate combinations included in the candidate combination list is small, each candidate combination is uniformly encoded using a preset bit length, and this embodiment does not limit the specific value of the fourth preset threshold. In some embodiments, a high-level syntax can be used to control the switching on and off of the combined encoding scheme provided in the embodiments of this application. For example, at least one flag can be used to indicate whether the current block is allowed to use the combined encoding scheme provided in the embodiments of this application, that is, whether the first combination is allowed to be used for encoding. In one possible implementation, at least one flag can be a flag of different levels, used to indicate whether the combined encoding technology provided in the embodiments of this application is allowed at the corresponding level. Optionally, the above-mentioned at least one flag includes at least one of sequence-level flags, image-level flags, slice-level flags, unit-level flags, and block-level flags. For example, at least one of the above flags includes a sequence-level flag, which is used to indicate whether the current sequence is allowed to use the combined encoding technology scheme provided in this application. For example, the syntax element `sps_cgpm_enabled_flag` is added to the sequence parameter set. Here, `cgpm` can be considered an abbreviation for combined geometric partitioning mode. If the value of `sps_cgpm_enabled_flag` is 1, it indicates that the current sequence is allowed to use the technical solution of this application; if the value of `sps_cgpm_enabled_flag` is 0, it indicates that the current sequence is not allowed to use the technical solution of this application. If the technical solution provided in this application is used in inter-frame mode, since the inter-frame mode already has `sps_gpm_enbled_flag`, this solution can also be controlled by `sps_gpm_enbled_flag`. Because this solution can also be used in intra-frame mode, `sps_cgpm_enabled_flag` or `sps_gpm_enabled_flag` can be used together with inter-frame mode. Of course, for better flexibility, different flags can be used for intra-frame mode and inter-frame mode, such as setting a single `sps_sgpm_enabled_flag`. Here, `sgpm` can be considered an abbreviation for Spatial Geometric Partitioning Mode. `sps_sgpm_enabled_flag` controls whether this solution is allowed in intra-frame mode, while `sps_cgpm_enabled_flag` or `sps_gpm_enabled_flag` controls whether this solution is allowed in inter-frame mode. For example, at least one of the above-mentioned marks includes an image-level mark, which is used to indicate whether the current image allows the use of the technical solution of this application. Optionally, if at least one of the tags includes an image-level tag, the image-level tag may be located in the image header. For example, at least one of the above-mentioned flags includes a slice-level flag, which is used to indicate whether the current slice is allowed to use the technical solution of this application. Optionally, if at least one flag includes a slice flag, the slice flag may be located in the slice header. For example, at least one of the above-mentioned flags includes a unit-level flag, which is used to indicate whether the current CTU allows the use of the technical solution of this application. For example, at least one of the above-mentioned flags includes a block (CU) level flag, which is used to indicate whether the technical solution of this application is allowed in the current block. Taking intra-frame as an example, assume the block-level flag is cu_sgpm_flag. If the value of cu_sgpm_flag is 1, it means that the current block is allowed to use the technical solution of this application; if the value of cu_sgpm_flag is 0, it means that the current block is not allowed to use the technical solution of this application. Currently, GPM in VVC is used in the inter-frame merge mode, which is derived through derivation. Of course, in the future, it may be directly represented by a CU-level flag, which is not restricted here. Thus, the encoding end first determines at least one of the aforementioned flags, and based on these flags, determines whether the current block is allowed to use the technical solution of this application. If, based on the aforementioned flags, it is determined that the current block is not allowed to use the technical solution of this application, the method of this application embodiment is skipped. If, based on the aforementioned flags, it is determined that the current block is allowed to use the technical solution of this application, the method of this application embodiment is executed, that is, the first combination is determined. The video encoding method provided in this application involves the encoder determining a first combination, which includes a first weighted derived mode and K first prediction modes. The encoder then predicts the current block based on the first weighted derived mode and the K first prediction modes to obtain a predicted value for the current block. Based on the predicted value of the current block, a bitstream is obtained. The bitstream includes a first index, which indicates the first combination. This application treats the weighted derived mode and the K prediction modes as a single combination, thus indicating the weighted derived mode and the K prediction modes used by the current block in a combined form within the bitstream. This simplifies the syntax, saves codewords, and eliminates the need for judgments on various cases, thereby improving encoding efficiency. It should be understood that Figures 15 to 19 are merely examples of this application and should not be construed as limiting this application. The preferred embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this application, various simple modifications can be made to the technical solutions of this application, and these simple modifications all fall within the protection scope of this application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this application will not describe the various possible combinations separately. Furthermore, various different embodiments of this application can also be arbitrarily combined, as long as they do not violate the spirit of this application, they should also be considered as the content disclosed in this application. It should also be understood that, in the various method embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. Furthermore, in the embodiments of this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. Specifically, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, in this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. The method embodiments of this application have been described in detail above with reference to Figures 15 to 19, and the device embodiments of this application have been described in detail below with reference to Figures 20 to 22. Figure 20 is a schematic block diagram of a video decoding device 10 provided in an embodiment of this application, which is applied to the aforementioned video decoder. As shown in Figure 20, the video decoding device 10 includes: Decoding unit 11 is used to decode the bitstream to obtain a first index, the first index being used to indicate a first combination consisting of a weighted derived mode and K prediction modes, wherein K is a positive integer greater than 1; The determining unit 12 is configured to determine, based on the first index, the first weighted derived pattern and K first prediction patterns included in the first combination; The prediction unit 13 is used to predict the current block according to the first weighted derivation mode and the K first prediction modes to obtain the predicted value of the current block. In some embodiments, the determining unit 12 is specifically used to determine a candidate combination list, the candidate combination list including multiple candidate combinations, any candidate combination among the multiple candidate combinations including a weighted derivation mode and K prediction modes; the weighted derivation mode and K prediction modes included in the candidate combination corresponding to the first index in the candidate combination list are determined as the first weighted derivation mode and the K first prediction modes. In some embodiments, the determining unit 12 is specifically used to construct the candidate combination list. In some embodiments, the determining unit 12 is specifically used to construct the candidate combination list based on the template of the current block. In some embodiments, the determining unit 12 is specifically used to determine R second combinations, each of the R second combinations including a weighted derived pattern and K prediction patterns, and the weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely the same, where R is a positive integer greater than 1; for any second combination among the R second combinations, the template is predicted using the weighted derived pattern and K prediction patterns in the second combination to obtain the template prediction value corresponding to the second combination; and the candidate combination list is constructed based on the template prediction values ​​corresponding to each of the R second combinations. In some embodiments, the determining unit 12 is specifically configured to determine the cost corresponding to the second combination based on the template prediction value and the reconstruction value of the template corresponding to the second combination; and to construct the candidate combination list based on the cost corresponding to each of the R second combinations. In some embodiments, the determining unit 12 is specifically configured to sort the R second combinations according to the cost corresponding to each of the R second combinations; and determine the sorted R second combinations as the candidate combination list. In some embodiments, the determining unit 12 is specifically used to sort the R second combinations in ascending order of the cost. In some embodiments, the determining unit 12 is specifically configured to select N second combinations from the R second combinations based on the cost corresponding to the second combination; and determine the list composed of the N second combinations as the candidate combination list. Optionally, the N second combinations are the top N second combinations with the lowest cost among the R second combinations. In some embodiments, the determining unit 12 is specifically used to determine P weighted derived patterns and Q prediction patterns, where P is a positive integer and Q is a positive integer greater than or equal to K; and to construct R second combinations based on the P weighted derived patterns and the Q prediction patterns, wherein any one of the R second combinations includes one weighted derived pattern from the P weighted derived patterns and K prediction patterns from the Q prediction patterns. In some embodiments, the determining unit 12 is specifically configured to determine at least one of the candidate prediction mode list of the current block, the alternative prediction mode list corresponding to the K prediction modes respectively, and the prediction mode corresponding to the weight derivation mode. The candidate prediction mode list includes multiple candidate prediction modes, and the alternative prediction mode list corresponding to any one of the K prediction modes includes at least one alternative prediction mode. The Q prediction modes are determined based on the candidate prediction mode list, the alternative prediction mode list corresponding to the K prediction modes respectively, and the prediction mode corresponding to the weight derivation mode. In some embodiments, the determining unit 12 is specifically configured to, for any one of the K prediction modes, determine a candidate prediction mode list corresponding to the prediction mode and at least one of the prediction modes corresponding to the weighted derivation mode; and determine a backup prediction mode list corresponding to the prediction mode based on the candidate prediction mode list and at least one of the prediction modes corresponding to the weighted derivation mode. In some embodiments, the determining unit 12 is specifically configured to determine the candidate prediction mode list based on the prediction mode used by at least one block adjacent to the current block. In some embodiments, the determining unit 12 is further configured to add the preset mode to the candidate prediction mode list if the preset mode is not included in the candidate prediction mode list. Optionally, the preset mode includes at least one of DC, horizontal mode, and vertical mode. Optionally, the candidate prediction mode list includes at least one of a candidate intra-frame prediction mode list and a candidate inter-frame prediction mode list, wherein the candidate intra-frame prediction mode list includes at least one candidate intra-frame prediction mode and the candidate inter-frame prediction mode list includes at least one candidate inter-frame prediction mode. In some embodiments, the determining unit 12 is specifically used to determine the prediction mode correspondin...

Claims

1. A video decoding method, characterized in that... In, including : Decode the bitstream to obtain a first index, which indicates a first combination consisting of a weighted derived mode and K prediction modes, where K is a positive integer greater than 1. ; Based on the first index, determine the first weighted derived pattern and K first prediction patterns included in the first combination. ; The current block is predicted based on the first weighted derivation mode and the K first prediction modes to obtain the predicted value of the current block. 。 2. The method according to claim 1, wherein its features The feature is that, based on the first index, determining the first weighted derived pattern and K first prediction patterns included in the first combination includes: Determine a candidate combination list, which includes multiple candidate combinations, and any candidate combination includes a weighted derived pattern and K prediction patterns; The weighted derivation mode and K prediction modes included in the candidate combination corresponding to the first index in the candidate combination list are determined as the first weighted derivation mode and the K first prediction modes. model.

3. The method according to claim 2, The feature is that determining the candidate combination list includes: Construct the candidate A list of combinations.

4. The method according to claim 3 The method, characterized in that constructing the candidate combination list includes: Based on the template of the current block, construct the List of candidate combinations.

5. As described in claim 4 The method, characterized in that constructing the candidate combination list based on the template of the current block includes: Determine R second combinations, each of the R second combinations including a weighted derived pattern and K prediction patterns, and the weighted derived pattern and K prediction patterns included in any two of the R second combinations are not completely the same, where R is a positive integer greater than 1; For any of the R second combinations, the template is predicted using the weighted derivation mode and K prediction modes in the second combination to obtain the template prediction value corresponding to the second combination. Based on the template prediction values ​​corresponding to each of the R second combinations, construct... The list of candidate combinations.

6. According to claim 5 The method, characterized in that, constructing the candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations, includes: The cost corresponding to the second combination is determined based on the template prediction value and the reconstructed value of the template. Based on the cost corresponding to each of the R second combinations. Construct the candidate combination list.

7. According to the rights The method described in claim 6, characterized in that, constructing the candidate combination list based on the cost corresponding to each of the R second combinations, includes: Sort the R second combinations according to the cost corresponding to each of the R second combinations; The sorted R second combinations The candidate combination list is determined accordingly.

8. According to the right The method described in claim 7, characterized in that, sorting the R second combinations according to the cost corresponding to each of the R second combinations includes: In order of increasing cost The R second combinations are sorted.

9. Root The method according to claim 6, characterized in that, constructing the candidate combination list based on the cost corresponding to each of the R second combinations, includes: Based on the cost corresponding to the second combination, select N second combinations from the R second combinations; The N second groups The resulting list is determined as the candidate combination list. 1 0. The method according to claim 9, wherein the N second combinations are the R combinations. The top N second combinations with the lowest cost in the second combination.

11. Root The method according to any one of claims 5-10, characterized in that determining R second combinations comprises: Determine P weighted derived patterns and Q prediction patterns, where P is a positive integer and Q is a positive integer greater than or equal to K; Based on the P weighted derived patterns and the Q prediction patterns, the R second combinations are constructed, wherein any one of the R second combinations includes one weighted pattern from the P weighted derived patterns. The re-derived mode and K predictions from the Q prediction modes model.

12. The method according to claim 11, characterized in that determining Q prediction modes includes: Determine at least one of the following: a candidate prediction mode list for the current block, a list of alternative prediction modes corresponding to the K prediction modes, and a prediction mode corresponding to the weighted derivation mode. The candidate prediction mode list includes multiple candidate prediction modes, and the list of alternative prediction modes corresponding to any one of the K prediction modes includes at least one alternative prediction mode. Based on the candidate prediction mode list, the alternative prediction mode list corresponding to the K prediction modes, and the weighted derived mode... Determine Q by taking at least one of the prediction modes corresponding to the formula. A prediction pattern.

13. The method according to claim 12, characterized in that determining the candidate prediction mode list corresponding to each of the K prediction modes includes: For any one of the K prediction modes, determine a candidate prediction mode list corresponding to the prediction mode, and at least one of the prediction modes corresponding to the weighted derivation mode; Based on the candidate prediction pattern list and the prediction corresponding to the weighted derived pattern At least one of the patterns, determine the alternative prediction patterns corresponding to the prediction patterns. Test mode list.

14. The method according to claim 12 or 13, wherein determining the candidate prediction mode list comprises: According to the above The prediction pattern used by at least one block adjacent to the previous block, Define the candidate prediction pattern list.

15. The method according to claim 14, characterized in that the method further comprises: If the candidate prediction mode If the preset mode is not included in the list, then the preset mode will be added. Add it to the list of candidate prediction patterns.

16. According to claim 15 The method described above is characterized in that the preset mode includes D C. At least one of the horizontal and vertical modes.

17. The method according to claim 14, wherein the candidate prediction mode list includes at least one of a candidate intra-frame prediction mode list and a candidate inter-frame prediction mode list, the candidate intra-frame prediction mode list including Includes at least one candidate intra-frame prediction mode, the candidate inter-frame prediction mode The list of patterns includes at least one candidate inter-frame prediction pattern.

18. The method according to claim 12 or 13, characterized in that determining the prediction mode corresponding to the weighted derivation mode includes: For the p-th weight derivation pattern among the P weight derivation patterns, determine the prediction pattern corresponding to the p-th weight derivation pattern, where p is a positive integer; According to the P At least one weight export mode corresponds to a weight export mode in the weight export mode. The prediction mode is determined by the prediction mode of the weight derivation mode.

19. The method according to claim 18, wherein if at least one of the prediction modes corresponding to the p-th weighted derivation mode is an intra-frame prediction mode, determining the prediction mode corresponding to the p-th weighted derivation mode includes: Determine the angle index based on the p-th weight derivation pattern. ; The intra-frame prediction mode corresponding to the angle index is determined. It is defined as at least one of the prediction modes corresponding to the p-th weighted derived mode.

20. The method according to claim 18, wherein if at least one of the prediction modes corresponding to the p-th weighted derivation mode is an intra-frame prediction mode, determining the prediction mode corresponding to the p-th weighted derivation mode includes: Determine the intra-prediction mode corresponding to the p-th weighted derived mode; The p-th At least one of the intra-prediction modes corresponding to the weighted derivation mode The p-th weighted derived mode is determined to be at least one of the prediction modes.

21. The method according to claim 20, wherein the intra-frame prediction mode corresponding to the p-th weighted derivation mode includes a prediction angle that is level with the boundary line corresponding to the weighted derivation mode. The intra-frame prediction mode, prediction angle, and weights of the line are derived. The intra-prediction mode corresponding to the boundary line is perpendicular to the mode. At least one of the formula and the planar pattern. 22 According to claim 11, the method is characterized in that Q Less than or equal to the first preset threshold.

23. According to rights The method of claim 11, characterized in that the size of Q is related to the size of the current block and / or Shape-related.

24. The claim 23 The method is characterized in that, if the size of the current block is greater than a first value, then Q is greater than or equal to... At the second preset threshold.

25. According to claim 23 The method is characterized in that, if the size of the current block is less than or equal to a first value, then Q is less than a third preset threshold.

26. The claim 11 The method, characterized in that the step of determining P weighted derived modules Formulas, including: From the preset M weight derivation modes, select P weight derivation modes, where M is a positive integer greater than or equal to P.

27. The method according to claim 26, characterized in that the step of deriving the modulus from the preset M weights... In the formula, the selected P weight derivation modes include: The weight export patterns corresponding to the preset division angle and / or preset offset are removed from the M weight export patterns to obtain the P weight export patterns.

28. The method according to claim 26, characterized in that the step of selecting from the preset M weights In the export mode, select the P weight export modes, including include: Determine the filtering conditions corresponding to the current block; Based on the filtering criteria, select the P weights from the M weight derivation patterns. Export mode.

29. The claim 28 The method is characterized in that the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block.

30. The method according to claim 29, The characteristic is that the filtering conditions include an array, the array... The group comprises M elements, each of which corresponds one-to-one with one of the M weight derivation modes. The element corresponding to each weight derivation mode is used to indicate whether the weight derivation mode is available.

31. The method according to claim 11, wherein constructing the R second combinations based on the P weighted derived patterns and the Q prediction patterns comprises: Select S weight derivation patterns from the P weight derivation patterns. S is a positive integer less than or equal to P; From the Q T prediction patterns are selected from the prediction patterns, where T is a positive integer less than or equal to Q; Based on the S weighted derivation patterns and the T prediction patterns, the R second combinations are formed.

32. The method according to claim 31, wherein selecting S weight derivation patterns from the P weight derivation patterns comprises: For the i-th weight-derived pattern among the P weight-derived patterns, the weights of K second prediction patterns on the template are determined based on the i-th weight-derived pattern. The K second prediction patterns are any K prediction patterns from the Q prediction patterns. are positive integers from 1 to P; If the K prediction modes If the weight of any prediction mode in the template is less than the first preset value, then the i-th weighted derivation mode is removed from the P weighted derivation modes to obtain the S weighted derivation modes.

33. The method according to claim 31, characterized in that selecting S weight derivation patterns from the P weight derivation patterns includes: For the i-th weight export mode among the P weight export modes Formula, determine the use of the i-th weight derivation mode for the... The cost of using the template for prediction, where i is a positive integer from 1 to P; Based on the cost corresponding to the i-th weight derivation pattern, select the S weight derivation patterns from the P weight derivation patterns.

34. The method according to claim 33, characterized in that, selecting the S weight derivation modes from the P weight derivation modes based on the cost corresponding to the i-th weight derivation mode includes: If the cost corresponding to the i-th weight derivation mode is less than the second The preset value is then selected from the P weighted derivation modes. The weight export pattern is similar to the i-th weight export pattern; Based on the i-th weight derivation pattern and the similar weight derivation patterns of the i-th weight derivation pattern, the S weight derivation patterns are determined.

35. The method according to claim 33, characterized in that, selecting the S weight derivation modes from the P weight derivation modes based on the cost corresponding to the i-th weight derivation mode includes: If the cost corresponding to the i-th weighted derivation mode is greater than the third preset value, then from the P weighted derivation modes... Remove the i-th weight export mode in the weight export mode. The formula, and the similar weight export patterns of the i-th weight export pattern, are used to obtain at least one weight export pattern after elimination. Based on the at least one weight derivation pattern after elimination, the S weight derivation patterns are determined.

36. The method according to claim 31, wherein selecting T prediction modes from the Q prediction modes comprises: Needle For the i-th prediction mode among the Q prediction modes, determine The cost of using the i-th prediction mode to predict the template, where i is a positive integer from 1 to Q; Based on the cost corresponding to the i-th prediction mode, select the T prediction modes from the Q prediction modes.

37. The method according to claim 36, characterized in that, in the step of selecting the T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode, include: If the cost corresponding to the i-th prediction mode is small For the fourth preset value, a prediction mode similar to the i-th prediction mode is selected from the Q prediction modes; Based on the i-th prediction pattern and the similar prediction patterns of the i-th prediction pattern, the T prediction patterns are determined.

38. The method according to claim 36, wherein selecting the T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode comprises: If the i-th If the cost corresponding to the prediction model is greater than the fifth preset value, then from the... Remove the i-th prediction mode and its similar prediction modes from the Q prediction modes to obtain at least one prediction mode after removal. Based on the at least one prediction pattern after elimination, the T prediction patterns are determined.

39. The method according to claim 31, wherein constructing the R second combinations based on the P weighted derived patterns and the Q prediction patterns comprises: For the i-th weight derivation mode among the P weight derivation modes, determine the cost of using the i-th weight derivation mode and the j-th prediction mode among the Q prediction modes to predict the template; The cost corresponding to the combination of the i-th weight derivation mode and the j-th prediction mode If the value is greater than the sixth preset value, then the predicted mode is removed from the Q predicted modes. j prediction patterns and similar prediction patterns of the j-th prediction pattern are used to obtain at least one prediction pattern after elimination. Based on the i-th weighted derived pattern and the at least one prediction pattern after elimination, construct the R second combinations.

40. The method according to any one of claims 1-10, characterized in that the step of deriving the mode based on the first weight and the K first prediction modes... The formula is used to predict the current block, resulting in the prediction for the current block. Values, including: According to the first weight guide The pattern is generated to determine the weights of the predicted values; According to the K first prediction models The formula is used to determine the K predicted values; Based on the K predicted values The weights of the K predicted values ​​are weighted to obtain the predicted value of the current block. Measured value.

41. The method according to claim 40, wherein the weights of the predicted values ​​are a weight matrix.

42. According to claim 1 The method according to any one of the following 10, characterized in that the first index is adopted The bitstream is encoded using variable-length encoding.

43. The method according to any one of claims 2-10, wherein if the number of candidate combinations included in the candidate combination list is less than a fourth preset threshold, the first index is encoded into the code stream using a fixed-length encoding method.

44. According to claims 1-10 The method described in any one of the embodiments is characterized in that the method further includes include: Decode the bitstream to obtain at least one flag, the at least one flag being used to indicate that decoding is performed using a first combination; Place Decoding the bitstream yields the first index, which includes: If the above At least one flag indicates that when decoding is performed using the first combination, the bitstream is decoded to obtain the first... One index.

45. The method according to claim 44, wherein the at least one flag includes a sequence-level flag, a graph flag, and a sequence-level flag. At least one of image-level markers, slice-level markers, unit-level markers, and block-level markers.

46. ​​A video encoding method, characterized in that, package include: Determine a first combination, the first combination including a first Weighted derivation pattern and K first prediction patterns; The current block is predicted based on the first weighted derivation mode and the K first prediction modes to obtain the predicted value of the current block; Based on the predicted value of the current block, a bitstream is obtained, the bitstream including a first index. Used to indicate the first combination.

47. According to the rights The method described in claim 46 is characterized in that determining the first combination includes: Determine a candidate combination list, the candidate combination list containing It includes multiple candidate combinations, each of which includes a weighted derived mode and K prediction modes. Mode; From the list of candidate combinations, determine the first... A combination.

48. The method according to claim 47, wherein determining the candidate combination list comprises: Construct the candidate combination list.

49. The method according to claim 48, wherein constructing the candidate combination list comprises: Based on the template of the current block, construct the candidate combination list.

50. The method according to claim 49, wherein constructing the candidate combination list based on the template of the current block comprises: Determine R second combinations, each of the R second combinations comprising a weighted derived mode and K prediction modes, and any two combinations of the R second combinations comprising... The weighted derivation pattern and the K prediction patterns are not entirely the same. R is a positive integer greater than 1; For any of the R second combinations, the template is predicted using the weighted derivation mode and K prediction modes in the second combination to obtain the template prediction value corresponding to the second combination. Based on the template prediction values ​​corresponding to each of the R second combinations, the candidate combinations are constructed. List.

51. The method according to claim 50 The feature is that, constructing the candidate combination list based on the template prediction values ​​corresponding to each of the R second combinations includes: The cost corresponding to the second combination is determined based on the template prediction value and the reconstructed value of the template. According to each of the R second combinations The cost corresponding to the two combinations is used to construct the candidate combination list.

52. The method according to claim 51, wherein constructing the candidate combination list based on the cost corresponding to each of the R second combinations comprises: According to the Rth The cost corresponding to each second combination in the two combinations, for the R combinations The second group is sorted; The sorted R second combinations are determined as the candidate combination list.

53. The method according to claim 52, characterized in that, sorting the R second combinations according to the cost corresponding to each of the R second combinations includes: According to the cost in ascending order, for the Rth... Sort the two groups together.

54. The method according to claim 51, characterized in that, the Based on the cost corresponding to each of the R second combinations, construct the... The list of candidate combinations includes: Based on the cost corresponding to the second combination, select N second combinations from the R second combinations; The list of the N second combinations is determined as the candidate combination list.

55. The method according to claim 54, wherein the N second combinations are the top N second combinations with the lowest cost among the R second combinations.

56. The claim 49-55 The method described in the above article is characterized in that, in determining the Rth... Two combinations, including: Determine P weighted derived patterns and Q prediction patterns, where P is a positive integer and Q is a positive integer greater than or equal to K; Based on the P weighted derived patterns and the Q prediction patterns, the R second combinations are constructed, and any one of the R second combinations includes one weighted derived pattern from the P weighted derived patterns and K prediction patterns from the Q prediction patterns.

57. The method according to claim 56, characterized in that determining Q prediction patterns includes: Determine the candidate prediction mode list for the current block, and the K prediction modes respectively. List of alternative prediction modes and corresponding weighted derivation modes At least one of the prediction modes, the candidate prediction mode list includes multiple candidate prediction modes, and the alternative prediction mode list corresponding to any one of the K prediction modes includes at least one alternative prediction mode. The Q prediction modes are determined based on at least one of the candidate prediction mode list, the alternative prediction mode list corresponding to the K prediction modes, and the prediction mode corresponding to the weighted derivation mode.

58. Root The method according to claim 57, characterized in that, determining the The list of candidate prediction modes corresponding to the K prediction modes includes: For any one of the K prediction modes, determine the candidate prediction corresponding to that prediction mode. A list of patterns, and the prediction patterns corresponding to the weighted derived patterns. At least one of them; Based on at least one of the candidate prediction mode list and the prediction mode corresponding to the weighted derivation mode, determine the prediction mode corresponding to the prediction mode. List of alternative prediction models.

59. According to claim 5 The method described in 7 or 58, characterized in that, in determining the candidate prediction mode... The list includes: Based on at least the current block adjacent to The prediction pattern used by a block determines the list of candidate prediction patterns.

60. The method according to claim 59, characterized in that the method further comprises: If the preset mode is not included in the candidate prediction mode list, then the preset mode is added to the candidate prediction mode list. Test mode list.

61. The method according to claim 60 The method is characterized in that the preset mode includes at least one of DC, horizontal mode, and vertical mode.

62. The method according to claim 59, wherein the candidate prediction mode list includes at least one of a candidate intra-frame prediction mode list and a candidate inter-frame prediction mode list, and the candidate intra-frame prediction mode list includes at least one candidate intra-frame prediction mode. The candidate inter-frame prediction mode list includes at least one candidate Inter-frame prediction mode.

63. The method according to claim 57 or 58, characterized in that determining the prediction mode corresponding to the weighted derivation mode includes: For the p-th weight derivation pattern among the P weight derivation patterns, determine the prediction pattern corresponding to the p-th weight derivation pattern, where p is a positive integer; Based on the P weight derivation patterns, at least one weight The prediction mode corresponding to the re-derived mode is used to determine the weighted derivative. The prediction pattern corresponding to the output pattern.

64. The method according to claim 63, characterized in that, if at least one of the prediction modes corresponding to the p-th weighted derived mode is an intra-frame prediction mode, determining the prediction mode corresponding to the p-th weighted derived mode includes: Determine the angle index based on the p-th weighted derivation pattern; The intra-frame prediction mode corresponding to the angle index is determined as the p-th... At least one of the prediction modes corresponding to the weighted derivation mode.

65. The method according to claim 63, characterized in that, if at least one of the prediction modes corresponding to the p-th weighted derivation mode is an intra-frame prediction mode, determining the prediction mode corresponding to the p-th weighted derivation mode includes: Determine the p-th weight derivation The intra-frame prediction mode corresponding to the mode; The p-th weight Intra-prediction mode corresponding to re-export mode At least one, determined to be the p-th weight derivation mode pair At least one of the corresponding prediction patterns.

66. According to claim 6 The method described in 5 is characterized in that the p-th weight The intra-prediction mode corresponding to the exported mode includes the boundary line between the prediction angle and the weighted exported mode. Parallel intra-frame prediction mode, prediction angle, and the weighted guidance At least one of the intra-prediction mode and planar mode whose boundary line is perpendicular to the output mode.

67. The method according to claim 56, wherein the feature is... The characteristic is that Q is less than or equal to a first preset threshold.

68. The method according to claim 56, wherein the size of Q is related to the size of the current block and / or... Or related to shape.

69. The claim 68 The method is characterized in that, if the size of the current block is greater than a first value, then Q is greater than or equal to a second preset threshold.

70. The method according to claim 68, characterized in that, if the size of the current block is less than or equal to a first value... When Q is less than the third preset threshold, then Q is less than the third preset threshold.

71. Root The method according to claim 56, characterized in that determining the P weight derivation patterns includes: From the preset M weight derivation modes, select P weight derivation modes, where M is a positive integer greater than or equal to P.

72. According to the rights The method of claim 71, characterized in that the from From the preset M weight export modes, select the P weight export modes, including: Remove the preset dividing angle from the M weighted derivation modes. The weight export mode corresponding to the degree and / or preset offset is obtained. To the P weighted export modes.

73. The method according to claim 71, characterized in that, selecting the P weight derivation modes from the preset M weight derivation modes includes: Determine the current The filtering criteria corresponding to the block; Based on the filtering criteria, from From the M weight export modes, select the P weight export modes.

74. The method according to claim 73, wherein the filtering conditions corresponding to the current block include filtering conditions corresponding to the size of the current block and / or filtering conditions corresponding to the shape of the current block.

75. The method according to claim 74, wherein the filtering conditions comprise an array, the array comprising M elements, the M elements... Each element corresponds one-to-one with one of the M weighted derivation patterns. The element corresponding to the weight export mode is used to indicate whether the weight export mode is available.

76. The method according to claim 56, wherein constructing the R second combinations based on the P weighted derived patterns and the Q prediction patterns comprises: Select S weight derivation patterns from the P weight derivation patterns, where S is a positive integer less than or equal to P; Select T prediction patterns from the Q prediction patterns, where T is a positive integer less than or equal to Q; Based on the S weighted derivation patterns and the T prediction patterns, the R second combinations are formed.

77. According to the rights The method described in claim 76 is characterized in that the step of... Select S weight export patterns from P weight export patterns, including: For the i-th weight-derived pattern among the P weight-derived patterns, the weights of K second prediction patterns on the template are determined based on the i-th weight-derived pattern. The K second prediction patterns are any K prediction patterns among the Q prediction patterns, and i is a positive integer from 1 to P. If any of the K prediction modes predicts When the weight of the pattern on the template is less than a first preset value, Then, the i-th weight export pattern is removed from the P weight export patterns to obtain the S weight export patterns.

78. The method according to claim 76, wherein selecting S weight derivation patterns from the P weight derivation patterns comprises: For the i-th weight derivation pattern among the P weight derivation patterns, determine the cost of using the i-th weight derivation pattern to predict the template, where i is a positive integer from 1 to P; According to the above The cost corresponding to the i-th weighted derivation pattern, from the P... Select the S weight export modes from the weight export modes.

79. The method according to claim 78, wherein selecting the S weight derivation modes from the P weight derivation modes based on the cost corresponding to the i-th weight derivation mode comprises: If the cost corresponding to the i-th weight derivation mode is less than the second preset value, then a weight derivation mode similar to the i-th weight derivation mode is selected from the P weight derivation modes. Based on the i-th weight, the derived pattern and the i-th weight Similar weight derivation patterns of each weight derivation pattern are used to determine the weight derivation patterns. S weight derivation modes are described.

80. The method according to claim 78, characterized in that, selecting the S weight derivation modes from the P weight derivation modes based on the cost corresponding to the i-th weight derivation mode includes: If the cost corresponding to the i-th weight derivation pattern is greater than the third preset value, then it is removed from the P weight derivation patterns. The i-th weight derivation mode, and the i-th weight The similar weighted export patterns of the re-exported patterns are used to obtain at least one weighted export pattern after elimination. Based on the at least one weight derivation pattern after elimination, the S weight derivation patterns are determined.

81. The method according to claim 76, wherein selecting T prediction modes from the Q prediction modes comprises: For the i-th prediction mode among the Q prediction modes, determine which i-th prediction mode to use. The cost of each prediction pattern when predicting the template, Let i be a positive integer from 1 to Q; Based on the cost corresponding to the i-th prediction mode, select the T prediction modes from the Q prediction modes.

82. The method according to claim 81, characterized in that, selecting the T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode includes: If the cost corresponding to the i-th prediction mode is less than the fourth preset value, then select from the Q prediction modes. Prediction patterns similar to the i-th prediction pattern; root Based on the i-th prediction pattern and the similar prediction patterns of the i-th prediction pattern, determine the T prediction patterns.

83. The method according to claim 81, characterized in that, selecting the T prediction modes from the Q prediction modes based on the cost corresponding to the i-th prediction mode includes: If the cost corresponding to the i-th prediction mode is greater than the fifth preset value, then the i-th prediction mode and its similar prediction modes are removed from the Q prediction modes to obtain at least one prediction mode after removal. Based on the at least one prediction pattern after elimination, the T prediction patterns are determined.

84. The method according to claim 76, characterized in that, the step according to... The P weighted derivation patterns and the Q prediction patterns are used to construct the Rth prediction pattern. Two combinations, including: For the i-th weight derivation mode among the P weight derivation modes, determine the cost of using the i-th weight derivation mode and the j-th prediction mode among the Q prediction modes to predict the template; If the cost corresponding to the combination of the i-th weighted derivation mode and the j-th prediction mode is greater than the sixth preset value, then the i-th weighted derivation mode is removed from the Q prediction modes. j prediction patterns, and the phase of the j-th prediction pattern Similar to the prediction pattern, at least one is obtained after elimination. One prediction pattern; Based on the i-th weight derivation mode and the removal... At least one prediction pattern is used to construct the R second combinations.

85. According to the claims The method according to any one of 46-55, characterized in that the step according to the The first weighted derivation mode and the K first prediction modes predict the current block to obtain the predicted value of the current block, including: Based on the first weighted derivation mode, determine the prediction. The weight of the value; Based on the K first prediction patterns, determine the K predictions. Measured value; The predicted value of the current block is obtained by weighting the K predicted values ​​according to their respective weights.

86. The method according to claim 85, wherein the weights of the predicted values ​​are a weight matrix.

87. According to claim 46 The method described in any one of -55, characterized in that, The method also includes: The first element is encoded into the bitstream using a variable-length encoding method.

88. The claim 47-55 The method described in the above article is characterized in that, the The method also includes include: If the number of candidate combinations included in the candidate combination list is less than the fourth preset threshold, then the first index is encoded into the bitstream using a fixed-length encoding method.

89. According to claim 4 The method according to any one of 6-55, characterized in that the method further comprises: Determine at least one flag, said at least one flag being used for Indicates whether to use the first combination for encoding; Determining the first combination includes: If the at least one flag indicates that the first combination is used for encoding, then... Define the first combination.

90. According to the right Requirement 8 The method described in 9 is characterized in that the at least one flag includes a sequence-level flag, an image-level flag, a slice-level flag, and a single flag. At least one of the meta-level flags and the block-level flags.

91. A video decoding device, characterized in that it comprises: The decoding unit is used to decode the bitstream. To the first index, the first index is used to indicate a first combination consisting of a weighted derived mode and K prediction modes, where K is a positive integer greater than 1; Confirm A determining unit, used to determine the first index The first weighted derived pattern and K first prediction patterns included in the first combination are determined. The prediction unit is configured to predict the current block based on the first weighted derivation pattern and the K first prediction patterns, and obtain the predicted value of the current block. 。 92. A video encoding device, characterized in that... The sign lies in ,include: Determining unit, used to determine Define a first combination, which includes a first weighted derived pattern and K first prediction patterns; A prediction unit is configured to derive a pattern based on the first weight and the K first prediction patterns for the current... The previous block is used for prediction to obtain the predicted value of the current block. ; An encoding unit is configured to obtain a bitstream based on the prediction value of the current block, the bitstream including a first index, the first index being used to indicate the first... combination.

93. An electron The device is characterized by including a processor and a memory; The memory shown is used to store computer programs; The processor is used to call and run programs stored in the memory. A computer program for implementing the method described in any one of claims 1 to 45 or 46 to 90.

94. A video encoding and decoding system, characterized in that it comprises: a video encoder and a video decoder; The video decoder is used to implement the method described in any one of claims 1 to 45; The video encoder is used to implement the method described in any one of claims 46 to 90.

95. A computer-readable storage medium, characterized in that it is used for storing a computer program; The computer program causes the computer to perform the method as described in any one of claims 1 to 45 or 46 to 90.

96. A bitstream, characterized in that the bitstream includes a first index, the first index being used to indicate a first combination consisting of a weighted derived mode and K prediction modes, wherein K is a positive integer greater than 1.