Video encoding method and apparatus, video decoding method and apparatus, and computer-readable medium and electronic device

By adaptively selecting the reference weight export method in video encoding technology, the problem that fixed linear functions cannot adapt to the characteristics of different encoding blocks is solved, and more accurate weight matrix export and codec performance are improved.

WO2025124044A1PCT designated stage expired Publication Date: 2025-06-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/131399
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-12
Filing Date
2024-11-11
Publication Date
2025-06-19

AI Technical Summary

Technical Problem

In the existing video encoding technology, fixed linear functions are used to derive the weight matrix in the weighted prediction mode, and cannot adapt to the characteristics of different encoding blocks, affecting the improvement of encoding performance.

Method used

By adaptively selecting the reference weight export method in the encoding block, determining the reference weight export method of the encoding block based on the code stream information, and calculating a more accurate weight matrix, thereby improving the encoding and decoding performance.

Benefits of technology

The adaptive derivation of the weight matrix by encoding blocks is realized, which improves the encoding and decoding performance and adapts to the characteristics of different encoding blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024131399_19062025_PF_FP_ABST
    Figure CN2024131399_19062025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a video encoding method and apparatus, a video decoding method and apparatus, and a computer-readable medium and an electronic device. The video decoding method comprises: performing decoding processing on a video bitstream, so as to obtain bitstream information (S1310); if a coding block using a weighted prediction mode allows adaptively exporting a reference weight, determining a reference weight export mode for the coding block on the basis of the bitstream information (S1320); on the basis of the reference weight export mode, calculating a reference weight corresponding to the coding block, and on the basis of the reference weight, determining a weight matrix corresponding to the coding block (S1330); and performing weighted prediction on the basis of the weight matrix, so as to obtain a predicted value corresponding to the coding block (S1340). By means of the technical solution in the embodiments of the present application, a reference weight export mode can be adaptively selected, such that a different coding block can export a more accurate weight matrix, thereby facilitating an improvement in the encoding performance and decoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

Video Coding and Decoding Method, Device, Computer Readable Medium and Electronic Device This application claims the priority of a Chinese patent application with the application number 202311706617.0 and the invention title "Video Coding and Decoding Method, Device, Computer Readable Medium and Electronic Device", which was filed with the Chinese Patent Office on December 12, 2023. The entire content of this application is incorporated herein by reference in its entirety. Technical Field This application relates to the field of computer and communication technologies. Specifically, it relates to a video coding and decoding method, device, computer readable medium and electronic device. Background Art In related audio and video standards (such as the second phase of AVS3), the Angular Weighted Prediction (AWP) technology and the Spatial Angular Weighted Prediction (SAWP) technology are adopted. These prediction technologies use a weight mask to weight two prediction blocks to achieve the combination of different parts of the prediction block. These prediction technologies can be closer to the boundaries of different objects or different motion regions than block partitioning, so they can effectively improve the compression performance. In order to make the pixel values change smoothly at the combination boundary of the prediction blocks, there is a transition zone (i.e., a mixing region) near the partitioning boundary in the weight matrix of these prediction technologies. In the related art, the weights in this transition zone are derived according to a fixed linear function, but using a fixed linear function cannot adapt to all coding blocks, which will affect the improvement of coding performance to a certain extent. Summary of the Invention Embodiments of this application provide a video coding and decoding method, device, computer readable medium and electronic device, enabling coding blocks to adaptively select a reference weight derivation method, thereby enabling more accurate weight matrices to be derived for different coding blocks, which is beneficial to improving coding and decoding performance. Other features and advantages of this application will become apparent through the following detailed description, or will be partially learned through the practice of this application. According to one aspect of the embodiments of this application, a video decoding method is provided, which is executed by a processor and includes: performing decoding processing on a video bitstream to obtain bitstream information; if the coding block using the weighted prediction mode allows adaptive derivation of the reference weight, determining the reference weight derivation method of the coding block according to the bitstream information; calculating the reference weight corresponding to the coding block according to the reference weight derivation method, and determining the weight matrix corresponding to the coding block according to the reference weight; performing weighted prediction according to the weight matrix to obtain the predicted value corresponding to the coding block. According to one aspect of the embodiments of the present application, there is provided a video encoding method, which is executed by a processor and includes: if an encoding block using a weighted prediction mode allows adaptive derivation of reference weights, determining a reference weight derivation method used for the encoding block; calculating a reference weight corresponding to the encoding block according to the reference weight derivation method; determining a weight matrix corresponding to the encoding block according to the reference weight; performing weighted prediction according to the weight matrix to obtain a predicted value corresponding to the encoding block, and encoding the encoding block according to the predicted value. According to one aspect of the embodiments of the present application, there is provided a video decoding apparatus, including: a decoding unit configured to perform decoding processing on a video bitstream to obtain bitstream information; a determining unit configured to, if an encoding block using a weighted prediction mode allows adaptive derivation of reference weights, determine a reference weight derivation method for the encoding block according to the bitstream information; a calculating unit configured to calculate a reference weight corresponding to the encoding block according to the reference weight derivation method and determine a weight matrix corresponding to the encoding block according to the reference weight; a processing unit configured to perform weighted prediction according to the weight matrix to obtain a predicted value corresponding to the encoding block. According to one aspect of the embodiments of the present application, there is provided a video encoding apparatus, including: a processing unit configured to, if an encoding block using a weighted prediction mode allows adaptive derivation of reference weights, determine a reference weight derivation method used for the encoding block; a calculating unit configured to calculate a reference weight corresponding to the encoding block according to the reference weight derivation method; a determining unit configured to determine a weight matrix corresponding to the encoding block according to the reference weight; an encoding unit configured to perform weighted prediction according to the weight matrix to obtain a predicted value corresponding to the encoding block, and encode the encoding block according to the predicted value. According to one aspect of the embodiments of the present application, there is provided a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the above embodiments is implemented. According to one aspect of the embodiments of the present application, there is provided an electronic device, including: one or more processors; a storage device for storing one or more computer programs, and when the one or more computer programs are executed by the one or more processors, the electronic device implements the method described in the above embodiments. According to one aspect of the embodiments of the present application, there is provided a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the methods provided in the above various alternative embodiments. In the technical solutions provided by some embodiments of the present application, when an encoding block adopting a weighted prediction mode allows for adaptive derivation of reference weights, the reference weight derivation method for the encoding block is determined according to the bitstream information, then the reference weight corresponding to the encoding block is calculated according to the reference weight derivation method, and the weight matrix corresponding to the encoding block is determined according to the reference weight, so as to perform weighted prediction according to the weight matrix to obtain the predicted value corresponding to the encoding block, enabling the encoding block to adaptively select the reference weight derivation method (such as selecting different reference weight derivation functions or function parameters, etc.), and being indicated by the bitstream information. Furthermore, a more accurate weight matrix can be derived for different encoding blocks, which is beneficial to improving the encoding and decoding performance. It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied; FIG. 2 shows a schematic diagram of the placement of a video encoding device and a video decoding device in a streaming system; FIG. 3 shows a basic flowchart of a video encoder; FIG. 4 shows a schematic diagram of a block partitioning structure in the HEVC standard; FIG. 5 shows a schematic diagram of a block partitioning structure in the AVS3 standard; FIG. 6 shows a schematic diagram of the angular prediction direction in the intra prediction mode; FIG. 7 shows a schematic diagram of intra prediction; FIG. 8 shows a schematic diagram of inter prediction; FIG. 9 shows a schematic diagram of the prediction process of the AWP mode; FIG. 10 shows a schematic diagram of 8 weight generation angles; FIG. 11 shows a schematic diagram of 7 reference weight prediction positions; FIG. 12 shows a schematic diagram of the angular partition of the angular weighted prediction mode; FIG. 13 shows a flowchart of a video decoding method according to an embodiment of the present application; FIG. 14 shows a flowchart of a video encoding method according to an embodiment of the present application; FIG. 15 shows a schematic diagram of the image of a reference weight derivation function in the form of a sigmoid function according to an embodiment of the present application; FIG. 16 shows a schematic diagram of the image of a reference weight derivation function in the form of a hyperbolic tangent function according to an embodiment of the present application; FIG. 17 shows a schematic diagram of the image of a reference weight derivation function in the form of a cosine function according to an embodiment of the present application; FIG. 18 shows a block diagram of a video decoding apparatus according to an embodiment of the present application; FIG. 19 shows a block diagram of a video encoding apparatus according to an embodiment of the present application; FIG. 20 shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners Now, example embodiments will be described in a more comprehensive manner with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to these examples; rather, these embodiments are provided to make the present application more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied. As shown in FIG. 1, the system architecture 100 includes a plurality of terminal devices, and the terminal devices can communicate with each other through, for example, a network 150. For example, the system architecture 100 may include a first terminal device 110 and a second terminal device 120 interconnected through the network 150. In the embodiment of FIG. 1, the first terminal device 110 and the second terminal device 120 perform unidirectional data transmission. For example, the first terminal device 110 can encode video data (such as a video picture stream collected by the terminal device 110) for transmission to the second terminal device 120 through the network 150. The encoded video data is transmitted in the form of one or more encoded video bitstreams. The second terminal device 120 can receive the encoded video data from the network 150, decode the encoded video data to recover the video data, and display video pictures according to the recovered video data. In an embodiment of the present application, the system architecture 100 may include a third terminal device 130 and a fourth terminal device 140 that perform bidirectional transmission of encoded video data, and such bidirectional transmission may occur, for example, during a video conference. For bidirectional data transmission, each of the third terminal device 130 and the fourth terminal device 140 can encode video data (such as a video picture stream collected by the terminal device) for transmission to the other of the third terminal device 130 and the fourth terminal device 140 through the network 150. Each of the third terminal device 130 and the fourth terminal device 140 can also receive the encoded video data transmitted by the other of the third terminal device 130 and the fourth terminal device 140, decode the encoded video data to recover the video data, and display video pictures on an accessible display device according to the recovered video data. In the embodiment shown in FIG. 1, the first terminal device 110, the second terminal device 120, the third terminal device 130, and the fourth terminal device 140 may be servers or terminals, but the principles disclosed in this application are not limited thereto. The server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart voice interaction device, a smart watch, smart home appliances, a vehicle-mounted terminal, an aircraft, etc., but is not limited thereto. The network 150 shown in FIG. 1 represents any number of networks for transmitting encoded video data between the first terminal device 110, the second terminal device 120, the third terminal device 130, and the fourth terminal device 140, including, for example, wired and / or wireless communication networks. The communication network 150 may exchange data in circuit-switched and / or packet-switched channels. The network may include a telecommunications network, a local area network, a wide area network, and / or the Internet. For the purposes of this application, unless otherwise explained below, the architecture and topology of the network 150 may be irrelevant to the operations disclosed in this application. In an embodiment of this application, FIG. 2 shows the placement of a video encoding device and a video decoding device in a streaming environment. The subject matter disclosed in this application is equally applicable to other video-supported applications, including, for example, video conferencing, digital TV (television), storing compressed video on digital media such as CDs, DVDs, memory sticks, etc. The streaming system may include an acquisition subsystem 213. The acquisition subsystem 213 may include a video source 201 such as a digital camera, and the video source creates an uncompressed video picture stream 202. In the embodiment, the video picture stream 202 includes samples taken by the digital camera. Compared with the encoded video data 204 (or encoded video bitstream 204), the video picture stream 202 is depicted as a thick line to emphasize the high-data-volume video picture stream. The video picture stream 202 may be processed by an electronic device 220, and the electronic device 220 includes a video encoding device 203 coupled to the video source 201. The video encoding device 203 may include hardware, software, or a combination of hardware and software to implement or carry out aspects of the disclosed subject matter described in more detail below. Compared with the video picture stream 202, the encoded video data 204 (or encoded video bitstream 204) is depicted as a thin line to Emphasize the encoded video data 204 (or encoded video bitstream 204) with a lower data volume, which can be stored on the streaming server 205 for future use. One or more streaming client subsystems, such as client subsystem 206 and client subsystem 208 in FIG. 2, can access the streaming server 205 to retrieve copies 207 and 209 of the encoded video data 204. The client subsystem 206 can include, for example, a video decoding device 210 in the electronic device 230. The video decoding device 210 decodes the incoming copy 207 of the encoded video data and generates an output video picture stream 211 that can be presented on a display 212 (such as a display screen) or another presentation device. In some streaming systems, the encoded video data 204, video data 207, and video data 209 (such as video bitstreams) can be encoded according to certain video coding / compression standards. It should be noted that the electronic device 220 and the electronic device 230 may include other components not shown in the figure. For example, the electronic device 220 may include a video decoding device, and the electronic device 230 may also include a video encoding device. In an embodiment of the present application, taking the international video coding standards HEVC (High Efficiency Video Coding) and VVC (Versatile Video Coding), and the Chinese national video coding standard AVS as examples, when a video frame image is input, according to a block size, the video frame image is divided into several non-overlapping processing units, and each processing unit will perform similar compression operations. This processing unit is called a CTU (Coding Tree Unit), or an LCU (Largest Coding Unit). The CTU can be further divided more finely to obtain one or more basic coding units CU (Coding Unit), and the CU is the most basic element in a coding link. In another embodiment, this processing unit can also be called an encoded slice (i.e., Tile), which is a rectangular area of a multimedia data frame that can be independently decoded and encoded. Among them, in the AV1 standard, the encoded slice can be further divided more finely to obtain one or more largest coding blocks (Superblock, abbreviated as SB). The SB is the starting point of block division and can be further divided into multiple sub-blocks, and then the largest coding block is further divided to obtain one or more blocks (Block). Each block is the most basic element in a coding link. Optionally, an SB can contain several Bs. The above-mentioned partitioning method for video frame images can be called a block partition structure. The following introduces some concepts in the encoding process: Predictive Coding: Predictive coding includes methods such as intra-frame prediction and inter-frame prediction. After the original video signal is predicted by the selected reconstructed video signal, a residual video signal is obtained. The encoding end needs to decide which predictive coding mode to select for the current coding unit (or coding block) and inform the decoding end. Among them, intra-frame prediction means that the predicted signal comes from the region that has been encoded and reconstructed within the same image; inter-frame prediction means that the predicted signal comes from other images that have been encoded and are different from the current image (referred to as reference images). Transform & Quantization: After the residual video signal undergoes transformation operations such as DFT (Discrete Fourier Transform) and DCT (Discrete Cosine Transform), the signal is converted into the transform domain, which is called transform coefficients. The transform coefficients are further subjected to a lossy quantization operation, losing certain information, so that the quantized signal is conducive to compressed representation. In some video coding standards, there may be more than one transformation method to choose from. Therefore, the encoding end also needs to select one of the transformation methods for the current coding unit (or coding block) and inform the decoding end. The fineness of quantization is usually determined by the quantization parameter (QP). A larger QP value means that a larger range of coefficients will be quantized to the same output, so it usually brings greater distortion and a lower bit rate; on the contrary, a smaller QP value means that a smaller range of coefficients will be quantized to the same output, so it usually brings less distortion and a corresponding higher bit rate. Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically compressed encoded according to the frequency of each value, and finally a binary (0 or 1) compressed bitstream is output. At the same time, other information generated during encoding, such as the selected coding mode, motion vector data, etc., also needs to be entropy encoded to reduce the bit rate. Statistical coding is a lossless coding method that can effectively reduce the bit rate required to represent the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC). The context-based binary arithmetic coding (CABAC) process mainly consists of three steps: binarization, context modeling, and binary arithmetic coding. After binarizing the input syntax element, the binary data can be encoded through the regular coding mode and the bypass coding mode. In the bypass coding mode, there is no need to assign a specific probability model to each binary bit. The input binary bit bin value is directly encoded using a simple bypass encoder to speed up the entire encoding and decoding process. Generally, different syntax elements are not completely independent, and the same syntax element itself also has a certain degree of memory. Therefore, according to the conditional entropy theory, using other already encoded syntax elements for conditional coding can further improve the coding performance compared to independent coding or memoryless coding. The information of these already encoded symbols used as conditions is called context. In the regular coding mode, the binary bits of the syntax element enter the context modeler sequentially. The encoder assigns an appropriate probability model to each input binary bit according to the values of the previously encoded syntax elements or binary bits. This process is called context modeling. The context model corresponding to the syntax element can be located through ctxIdxInc (context index increment) and ctxIdxStart (context index start). After sending the bin value and the assigned probability model into the binary arithmetic encoder for encoding, the context model needs to be updated according to the bin value, which is the adaptive process in coding. Loop Filtering: The signal after transformation and quantization will obtain the reconstructed image through operations such as inverse quantization, inverse transformation, and prediction compensation. Compared with the original image, due to the influence of quantization, some information in the reconstructed image is different from the original image, that is, the reconstructed image will produce distortion. Therefore, filtering operations can be performed on the reconstructed image, such as deblocking filters (Deblocking filter, abbreviated as DB), SAO (Sample Adaptive Offset), or ALF (Adaptive Loop Filter), etc. These filters can effectively reduce the distortion degree caused by quantization. Since these filtered reconstructed images will be used as references for subsequent encoded images to predict future image signals, the above filtering operations are also called loop filtering, that is, filtering operations within the coding loop. In an embodiment of the present application, Figure 3 shows a basic flowchart of a video encoder, which is described by taking intra prediction as an example. Among them, the original image signal s k [x,y] and the predicted image signal Perform a difference operation to obtain the residual signal u k [x, y], the residual signal u k [x, y] After transformation and quantization processing, quantization coefficients are obtained. On the one hand, the entropy-coded bitstream is obtained through entropy coding. On the other hand, the reconstructed residual signal u' is obtained through inverse quantization and inverse transformation processing k [x, y], the predicted image signal And the reconstructed residual signal u' k [x, y] is superimposed to generate an image signal The image signal On the one hand, it is input to the intra-mode decision module and the intra-prediction module for intra-prediction processing. On the other hand, the reconstructed image signal s' is output through loop filtering k [x, y], the reconstructed image signal s' k [x, y] can be used as a reference image for the next frame for motion estimation and motion compensation prediction. Then, based on the result s' of the motion compensation prediction r [x + m x , y + m y and the intra-prediction result Obtain the predicted image signal for the next frame And continue to repeat the above process until the encoding is completed. Based on the above encoding process, at the decoding end, for each coding unit (or coding block), after obtaining the compressed bitstream (i.e., the bitstream), entropy decoding is performed to obtain various mode information and quantization coefficients. Then the quantization coefficients are processed through inverse quantization and inverse transformation to obtain the residual signal. On the other hand, according to the known coding mode information, the prediction signal corresponding to the coding unit (or coding block) can be obtained. Then, after adding the residual signal and the prediction signal, the reconstructed signal is obtained. The reconstructed signal is then processed through operations such as loop filtering to generate the final output signal. Currently, mainstream video coding standards, such as HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding), AVS3, AV1 (Alliance for Open Media Video 1, the first-generation video coding standard developed by the Alliance for Open Media), and AV2 (Alliance for Open Media Video 2, the second-generation video coding standard developed by the Alliance for Open Media), all adopt a block-based hybrid coding framework. Specifically, the original video data is divided into a series of coding blocks, and video coding methods such as prediction, transformation, and entropy coding are combined to achieve video data compression. In the block-based hybrid coding framework, the video image is divided into several non-overlapping processing units for video compression processing, and this processing unit is called CTU (Coding Tree Unit). The CTU can also be further divided more finely to obtain one or more basic coding units, called CUs (Coding Unit). Each CU is the most basic element in a coding process, and each CU can choose different coding modes. Figure 4 shows a schematic diagram of a block division structure in the HEVC standard. A CTU can be divided downward in the form of a quadtree. The AVS3 standard adopts a basic block division structure of QT (Quad-Tree) + BT (Binary-Tree) + EQT (Extended Quad-Tree). Specifically, the representation method of the QT+BT+EQT basic block division structure in the AVS3 bitstream is shown in Figure 5. For a CU, first determine whether to use QT for division. If QT is used, directly perform QT division; if QT is not used, further determine whether not to divide. If not, end; if division is required, further determine whether to use EQT or BT. At the same time, whether EQT or BT is used, it is necessary to determine whether it is a horizontal division or a vertical division. The block division starts from the LCU and makes a recursive division decision from top to bottom. During the recursive process, the optimal division method and coding mode are determined by optimization at the coding end. Intra prediction is a commonly used prediction coding technique. Intra prediction is based on the correlation existing in the spatial domain of the pixels of a video image, and derives the predicted value of the current coding block from the adjacent encoded regions. The second phase of AVS3 adopted the Extended Intra Prediction Mode (EIPM for short). In the previous generation AVS2, there were a total of 33 intra prediction modes, including 30 angular prediction modes and 3 special prediction modes (Plane prediction mode, DC prediction mode, and Bilinear prediction mode), using 2 MPM (Most Probable Mode) encodings, and the remaining modes using 5-bit fixed-length encodings. To support more refined angular prediction, the angular prediction modes in AVS3 are extended to 62, as shown in Figure 6, and the newly added angular prediction mode numbers are from 34 to 65. When the angular prediction mode is adopted, the pixel points within the current prediction block use the reference pixel values at the corresponding positions on the reference pixel row or column as the predicted values according to the direction corresponding to the angle of the prediction mode. As shown in Figure 7, for the pixel point P in the prediction block, first, according to the prediction angle in the figure, the position of the reference pixel is determined from the previously encoded pixel row above, and then the reference pixel value is used as the predicted value of the pixel point P. It should be noted that: the reference pixel positions pointed to by not all pixel positions are at integer pixel precision. For example, the reference pixel position of the pixel point P in Figure 7 is at a sub-pixel position between pixels B and C, so the predicted pixel value at this position needs to be obtained by interpolating the surrounding pixels. To improve the efficiency of intra prediction, on-chip memory is usually used to store the reference pixels for intra prediction. As shown in Figure 8, inter prediction utilizes the correlation in the video temporal domain, and uses the pixels of adjacent encoded images to predict the pixels of the current image, so as to effectively remove the redundancy in the video temporal domain and can effectively save the bits of the encoded residual data. Among them, P represents the current frame, Pr represents the reference frame, B represents the current coding block, and Br represents the reference block of B. The coordinates of B' in the reference frame are the same as the coordinates of B in the current frame, the coordinates of Br are (x r , y r ), the coordinates of B' are (x, y), and the displacement between the current coding block and its reference block is called the motion vector (i.e., MV), where MV = (x r - x, y r - y). The second phase of AVS3 also adopted the AWP mode for inter-frame prediction and the SAWP for intra-frame prediction. As shown in Figure 9, the AWP mode derives the weight value for each pixel position by means of the intra-frame angular prediction idea: first, set the reference weight values at the surrounding positions (integer pixel positions and sub-pixel positions) of the current block, and then use the angular prediction method to obtain the weight value corresponding to each pixel position, and finally, through the obtained weights, perform weighted prediction on two different inter-frame prediction values. The SAWP adopts a similar method to derive weights to perform weighted prediction on two intra-frame prediction values. The following is an introduction to the AWP mode: The minimum block size supported by the angular weighted prediction mode is 8, and the maximum block size is 64. A total of 8 angles are supported. As shown in Figure 10, there are five absolute values of the slopes of these 8 angles, which are {horizontal, vertical, 1, 2, 1 / 2}. As shown in Figure 11, each angle supports 7 reference weight configurations. Therefore, for each block, the number of modes of the angular weighted mode is 56 in total. The reference weight configuration is the distribution function of the reference weight value obtained according to the reference weight index value, and non-strictly monotonically increasing function assignment is performed based on the 8 equal division point positions of the effective length of the reference weight. The effective length of the reference weight is calculated from the prediction angle and the current block size. As shown in Figure 12, the angles supported by the angular weighted prediction mode are divided into 4 partitions, namely angle partition 0, angle partition 1, angle partition 2, and angle partition 3. According to the different regions where the angles are located, the formula for deriving the per-pixel weight is slightly different Specifically, there is an AwpIndex in the bitstream to indicate the weight mode used by the current coding block. The relevant parameters of the angular weighted mode are confirmed according to the following formula based on the AwpIndex. stepIndex = (AwpIndex >> 3) - 3 modAngNum = AwpIndex % 8 angleAreaIndex = modAngNum >> 1 Among them, ">>" in the above formula represents the right shift operation. After obtaining the above parameters, the weight matrix of the angular weighted mode can be derived according to these parameters by the following method: First, calculate the effective length vL of the reference weight. The length vL of the reference weight is represented in 1 / 2 pixel precision. For the first 4 angles (that is, the cases where the angle area indicator angleAreaIndex is equal to 0 and 1), the reference weight is 1 column to the left of the current block; for the last 4 angles (that is, the cases where the angle area indicator angleAreaIndex is equal to 2 and 3), the reference weight is 1 row above the current block. If the width of the current block is W and the height is H, then the effective length vL is calculated in the manner shown in Table 1: Table 1 Among them, "<<" in Table 1 represents a left shift operation. After calculating the effective length vL of the reference weight, fill the reference weight Lw at each sample point position x (x ≤ vL) in the following manner. Among them, PictureAwpRefineIndex is the picture header index that controls whether to adjust the reference weight. Lw[x] = Clip3(0, 8, (x - fP) << shift) shift = PictureAwpRefineIndex? 2 : 0 o = PictureAwpRefineIndex? 3 : 1 Among them, the value of fP is determined according to Table 2 below: Table 2 Secondly, fill the luminance weight matrix according to the reference weight. Let the luminance weight matrix be BwLuma(x, y), then BwLuma(x, y) = Lw[tP]. Among them, for the SAWP mode or the AWP mode in B frames, the value of tP is determined according to Table 3 below: Table 3 For the AWP mode in P frames, the value of tP is determined according to Table 4 below: Table 4 After obtaining the luminance weight matrix, fill the chrominance weight matrix BwChroma(x, y) according to the luminance weight matrix. Among them, for the SAWP mode or the AWP mode in B frames, derive the chrominance weight matrix according to the following formula: BwChroma[x][y] = BwLuma[x << 1][y << 1] For the AWP mode in P frames, derive the chrominance weight matrix according to the following formula: BwChroma[x][y] = BwLuma[(x >> 2) << 3][(y >> 2) << 3] Finally, calculate the weighted prediction value pred according to the derived weight matrix and the prediction value x,y . pred x,y = predA x,y * w x,y + predB x,y *(1 - w x,y ) Among them, predA x,y and predB x,yTwo predicted values representing weighted prediction, w x,y represents the weight value at (x, y). When the weight is 0, the predicted value is predB x,y ; when the weight is the maximum value 1, the predicted value is predA x,y . In video coding, the weight is quantized to an integer to reduce floating-point operations. Let the range of the weight be [0, m], and the value of m is set according to the precision of the weight. For example, if the weight is represented using 3 bits, then m = 8. Then the weighted predicted value pred x,y can be expressed by the formula: pred x,y =(predA x,y *w x,y +predB x,y *(8 - w x,y ) + 4) >> 3 where, when the weight is 0, the predicted value is predB x,y ; when the weight is the maximum value m, the predicted value is predA x,y . In AWP and SAWP, the weight matrix w x,y is derived from the reference weight. Let the range of the mixing region of the reference weight be L, and its range can be confirmed according to the starting position and the ending position (p0, p1), and the values of p0 and p1 can be the same or different. Among them, the reference weight w i can be derived according to the following formula: or From the above formula, it can be seen that in the mixing region, the reference weight w = f(d). In specific implementation, for a function with a value range greater than the weight value range, the clip function can be used to clip the function, that is, w = clip(0, m, f(d)). Or, integer-form weights can also be used to reduce complexity. Let the position of the mixing region be c, and the distance d from the sample point x i on the reference weight to the mixing region. d can be determined according to the distance between the current sample point and the mixing region, that is, d = x i - c. Or d can also be calculated according to the range of the mixing region. Assuming that offset is the offset from the center position to the starting position, then d can be expressed as: d = x i - p0 + offset. Among them, d can be represented by a preset precision integer. For example, d can use, including but not limited to, 8-pixel precision, 4-pixel precision, 2-pixel precision, 1-pixel precision, 1 / 2-pixel precision, 1 / 4-pixel precision, or 1 / 64-pixel precision, etc. At the same time, the weight quantized to an integer can be obtained according to the following formula: w q = round(m * f(d)); or calculate using the following formula: w q = clip(0, m, round(m * f(d q ))) Among them, m is the maximum weight value, round() is the rounding function, and f(d) is a function derived from the reference weight. In the related art, the reference weight derivation function is a fixed linear function. However, using a fixed linear function cannot adapt to all coding blocks, which will affect the improvement of coding performance to a certain extent. Based on this, the technical solution of the embodiment of the present application enables the coding block to adaptively select the reference weight derivation method (such as selecting different reference weight derivation functions or function parameters, etc.), and is indicated by the bitstream information, so that a more accurate weight matrix can be derived for different coding blocks, which is beneficial to improving the encoding and decoding performance. The implementation details of the technical solution of the embodiment of the present application are elaborated in detail below: FIG. 13 shows a flowchart of a video decoding method according to an embodiment of the present application. The video decoding method can be executed by a device with computing and processing capabilities, such as a terminal device or a server. Referring to FIG. 13, the video decoding method at least includes steps S1310 to S1340, which are introduced in detail as follows: In step S1310, the video bitstream is decoded to obtain bitstream information. In an embodiment of the present application, the video bitstream is a bitstream obtained by encoding a video image frame sequence. Among them, the video image frame sequence includes a series of images, and each image can be further divided into slices (or patches), and the slice can be further divided into a series of LCUs (or CTUs), and the LCU contains several CUs. The video image frames are encoded in units of blocks during encoding. The coding block in the embodiment of the present application can be a CU, or a block smaller than the CU, such as a smaller block obtained by dividing the CU. In step S1320, if the coding block using the weighted prediction mode allows adaptive derivation of the reference weight, the reference weight derivation method of the coding block is determined according to the bitstream information. Optionally, the coded blocks that adopt the weighted prediction mode in the embodiments of the present application may be coded blocks that adopt the angular weighted prediction mode, such as coded blocks that adopt the AWP prediction mode or coded blocks that adopt the SAWP prediction mode. In some alternative embodiments, it is possible to determine whether the coded blocks that adopt the weighted prediction mode in the current sequence are allowed to adaptively derive reference weights according to the sequence header flag bit included in the sequence header information. For example, if the value of the sequence header flag bit is 1, it indicates that the coded blocks that adopt the weighted prediction mode in the current sequence are allowed to adaptively derive reference weights; if the value of the sequence header flag bit is 0, it indicates that the coded blocks that adopt the weighted prediction mode in the current sequence are not allowed to adaptively derive reference weights. In some alternative embodiments, it is possible to determine whether the coded blocks that adopt the weighted prediction mode in the current picture are allowed to adaptively derive reference weights according to the picture header flag bit included in the picture header information. For example, if the value of the picture header flag bit is 1, it indicates that the coded blocks that adopt the weighted prediction mode in the current picture are allowed to adaptively derive reference weights; if the value of the picture header flag bit is 0, it indicates that the coded blocks that adopt the weighted prediction mode in the current picture are not allowed to adaptively derive reference weights. In some alternative embodiments, it is possible to determine whether the coded blocks that adopt the weighted prediction mode in the current slice are allowed to adaptively derive reference weights according to the slice header flag bit included in the slice header information. For example, if the value of the slice header flag bit is 1, it indicates that the coded blocks that adopt the weighted prediction mode in the current slice are allowed to adaptively derive reference weights; if the value of the slice header flag bit is 0, it indicates that the coded blocks that adopt the weighted prediction mode in the current slice are not allowed to adaptively derive reference weights. In some alternative embodiments, it is possible to determine whether the coded blocks that adopt the weighted prediction mode therein are allowed to adaptively derive reference weights according to the type of the picture frame. For example, if the type of the picture frame is a non-P frame (i.e., an I frame or a B frame), then the coded blocks that adopt the weighted prediction mode therein are allowed to adaptively derive reference weights; if the type of the picture frame is a P frame, then the coded blocks that adopt the weighted prediction mode therein are not allowed to adaptively derive reference weights. In some alternative embodiments, it is also possible to determine whether the coded blocks are allowed to adaptively derive reference weights according to two or more of the sequence header flag bit included in the sequence header information, the picture header flag bit included in the picture header information, the slice header flag bit included in the slice header information, and the type of the picture frame. For example, it is possible to determine whether the coding block allows adaptive derivation of reference weights based on the sequence header flag bit and the picture header flag bit. Specifically, if the values of both the sequence header flag bit and the picture header flag bit are 1, it indicates that the coding blocks using the weighted prediction mode in the current picture allow adaptive derivation of reference weights; if the value of the sequence header flag bit is 1 and the value of the picture header flag bit is 0, it indicates that the coding blocks using the weighted prediction mode in the current picture do not allow adaptive derivation of reference weights; if the value of the sequence header flag bit is 0, regardless of the value of the picture header flag bit (in fact, it is not necessary to decode the value of the picture header flag bit), it can be considered that the coding blocks using the weighted prediction mode in the current sequence do not allow adaptive derivation of reference weights. In some alternative embodiments, it is possible to determine whether the coding block allows adaptive derivation of reference weights based on at least one flag bit included in the bitstream information. Among them, when the at least one flag bit is a first value, it indicates that the coding block allows adaptive derivation of reference weights; when the at least one flag bit is other values, it indicates that the coding block determines the reference weights in the following manner: using a specified reference weight, using a specified reference weight derivation function, or using specified function parameters. It should be noted that the at least one flag bit can be a flag bit in the sequence header information, a flag bit in the picture header information, a flag bit in the slice header information, a flag bit in the block-level information, or a combination of the flag bits included in these information. Specifically, for example, the at least one flag bit includes a flag bit. When the value of this flag bit is 0, it can indicate that the corresponding coding block uses a specified reference weight 1; when the value of this flag bit is 1, it can indicate that the corresponding coding block uses a specified reference weight 2; when the value of this flag bit is 2, it can indicate that the corresponding coding block allows adaptive derivation of reference weights. In some alternative embodiments, the reference weight derivation method of the coding block refers to various methods used to derive the reference weights of the coding block, such as the reference weight derivation function adopted by the coding block, the function parameters adopted by the coding block, the weight array used to derive the reference weights, the distance transformation amount used to transform the distance from the reference weight sample points to the mixing region, etc. In some alternative embodiments, the above reference weight derivation function is selected from the following functions: linear function, sigmoid function, hyperbolic function, trigonometric function, exponential-based function, polynomial-based function, piecewise function, other non-linear functions. Optionally, the function parameters adopted by the coding block are the parameters of the reference weight derivation function. Optionally, the weight array for exporting the reference weight contains multiple set reference weight values. After obtaining the distance between the reference weight sample point and the mixing region, the corresponding reference weight value can be found in the weight array according to this distance, and then used as the reference weight value of the coding block. This distance can be the distance from the reference weight sample point to the starting position of the mixing region, the distance from the reference weight sample point to the central position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region, etc. Optionally, the distance transformation amount for transforming the distance from the reference weight sample point to the mixing region can be the number of bits for shifting the distance from the reference weight sample point to the mixing region to the left or right, etc. In some optional embodiments, determining the reference weight derivation method for the coding block using the weighted prediction mode according to the bitstream information may include: Determining the reference weight derivation method for the coding block using the weighted prediction mode according to the explicit index information in the bitstream information; or, determining the reference weight derivation method for the coding block using the weighted prediction mode in an implicit manner according to the bitstream information; or, determining the reference weight derivation method for the coding block according to the information determined in an implicit manner and the explicit index information in the bitstream information, where the information determined in an implicit manner is the information determined according to the bitstream information. In an embodiment of the present application, the reference weight derivation method for the coding block can be determined through the explicit index information in the sequence header information. Specifically, according to the value of the sequence header angular weighted prediction mode index information included in the decoded sequence header information, the reference weight derivation function used by the coding block using the weighted prediction mode in the current sequence can be determined (that is, the reference weight derivation method is the reference weight derivation function). For example, a reference weight derivation function list is set, and the reference weight derivation function used by the current sequence is indicated through the sequence header angular weighted prediction mode index information. In an embodiment of the present application, the sequence header information may include two flags. For example, it includes a sequence header angular weighted prediction mode flag for indicating whether the AWP mode can be used and a sequence header adaptive angular weighted prediction mode flag for indicating whether the current sequence allows adaptive derivation of the reference weight. In this case, if the sequence header angular weighted prediction mode flag indicates that the current sequence allows the use of the AWP mode, the sequence header adaptive angular weighted prediction mode flag is decoded from the video bitstream to determine whether the current sequence allows adaptive derivation of the reference weight; if the sequence header angular weighted prediction mode flag indicates that the current sequence does not allow the use of the AWP mode, there is no need to decode the sequence header adaptive angular weighted prediction mode flag from the video bitstream. Optionally, the sequence header information may include function parameter index information, which is used to indicate the function parameters used by the reference weight derivation function; or the function parameter index information is used to indicate the index position where the function parameters used by the reference weight derivation function are located (for example, there is a function parameter list, and a function parameter is selected from the function parameter list through the function parameter index information). It should be noted that: the sequence header information may simultaneously include the sequence header angular weighted prediction mode index information and the function parameter index information for indicating the reference weight derivation function, or may also include one of the sequence header angular weighted prediction mode index information and the function parameter index information. If only the function parameter index information is included, then the default reference weight derivation function can be used. If only the sequence header angular weighted prediction mode index information is included, then the default function parameters can be used. In an embodiment of the present application, the reference weight derivation method of the coding block can be determined through the display index information in the picture header information. Specifically, according to the value of the picture header angular weighted prediction mode index information included in the decoded picture header information, the reference weight derivation function used by the coding block adopting the weighted prediction mode in the current picture can be determined (that is, the reference weight derivation method is the reference weight derivation function). For example, a reference weight derivation function list is set, and the reference weight derivation function used by the current picture is indicated through the picture header angular weighted prediction mode index information. In an embodiment of the present application, the picture header information may include two flags, such as the picture header angular weighted prediction mode flag for indicating whether the AWP mode can be used and the picture header adaptive angular weighted prediction mode flag for indicating whether the current picture allows adaptive derivation of the reference weight. In this case, if the picture header angular weighted prediction mode flag indicates that the current picture allows the use of the AWP mode, the picture header adaptive angular weighted prediction mode flag is decoded from the video bitstream to determine whether the current picture allows adaptive derivation of the reference weight; if the picture header angular weighted prediction mode flag indicates that the current picture does not allow the use of the AWP mode, there is no need to decode the picture header adaptive angular weighted prediction mode flag from the video bitstream. Optionally, the image header information may include function parameter index information, which is used to indicate the function parameters used by the reference weight derivation function; or the function parameter index information is used to indicate the index position where the function parameters used by the reference weight derivation function are located (for example, there is a function parameter list, and a function parameter is selected from the function parameter list through the function parameter index information). It should be noted that: the image header information may simultaneously include the image header angle weighted prediction mode index information and the function parameter index information for indicating the reference weight derivation function, or may also include one of the image header angle weighted prediction mode index information and the function parameter index information. If only the function parameter index information is included, the default reference weight derivation function can be used. If only the image header angle weighted prediction mode index information is included, the default function parameters can be used. In an embodiment of the present application, the reference weight derivation method of the coding block can be determined through the display index information in the header information. Specifically, according to the value of the header angle weighted prediction mode index information included in the decoded header information, the reference weight derivation function used by the coding block adopting the weighted prediction mode in the current slice can be determined (that is, the reference weight derivation method is the reference weight derivation function). For example, a reference weight derivation function list is set, and the reference weight derivation function used by the current slice is indicated through the header angle weighted prediction mode index information. In an embodiment of the present application, the header information may include two flags, such as the header angle weighted prediction mode flag for indicating whether the AWP mode can be used and the header adaptive angle weighted prediction mode flag for indicating whether the current slice allows adaptive derivation of the reference weight. In this case, if the header angle weighted prediction mode flag indicates that the current slice allows the use of the AWP mode, the header adaptive angle weighted prediction mode flag is decoded from the video bitstream to determine whether the current slice allows adaptive derivation of the reference weight; if the header angle weighted prediction mode flag indicates that the current slice does not allow the use of the AWP mode, there is no need to decode the header adaptive angle weighted prediction mode flag from the video bitstream. Optionally, the header information may include function parameter index information, which is used to indicate the function parameters used by the reference weight derivation function; or the function parameter index information is used to indicate the index position of the function parameters used by the reference weight derivation function (for example, there is a function parameter list, and a function parameter is selected from the function parameter list through the function parameter index information). It is worth noting that the header information may include both the header angle weighted prediction mode index information and the function parameter index information for indicating the reference weight derivation function, or may include one of the header angle weighted prediction mode index information and the function parameter index information. If only the function parameter index information is included, the default reference weight derivation function can be used. If only the header angle weighted prediction mode index information is included, the default function parameters can be used. It should be noted that when the reference weight derivation method of the coding block is indicated by one or more of the sequence header information, the image header information and the slice header information, it may be valid only for the coding block adopting the AWP prediction mode, that is, it is only used to determine the reference weight derivation method of the coding block adopting the AWP prediction mode; or it may be valid only for the coding block adopting the SAWP prediction mode, that is, it is only used to determine the reference weight derivation method of the coding block adopting the SAWP prediction mode; or it may be valid for the coding blocks adopting the AWP prediction mode and the SAWP prediction mode at the same time, that is, it is used to determine the reference weight derivation method of the coding blocks adopting the AWP prediction mode and the SAWP prediction mode at the same time; or it can be indicated separately for the coding blocks adopting the AWP prediction mode and the SAWP prediction mode. In one embodiment of the present application, the reference weight derivation method of the coding block can be determined by the value of the display index information in the block-level information. In some optional embodiments, the block-level index information may include a function information index, a reference weight position index, and a prediction angle index. Among them, the function information index is used to indicate the reference weight derivation function used by the coding block (specifically, it may indicate the content of the reference weight derivation function, or it may indicate the parameters of the reference weight derivation function), the reference weight position index is used to indicate the position of the reference weight mixed area (specifically, it may indicate the starting position, center position, or end position of the mixed area, etc.), and the prediction angle index is used to indicate the weight prediction angle of the coding block. It should be noted that the position of the reference weight mixed area is used when calculating the reference weight of the coding block; the weight prediction angle is used when calculating the weight matrix of the coding block. In some alternative embodiments, the block-level index information may include a function information index and a prediction mode index. Among them, the prediction mode index is used to indicate the angular weighted prediction mode adopted by the coded block, and can be used to calculate the reference weight position index and the prediction angle index. For example, the remainder of the prediction mode index divided by the number of prediction angles can be used as the prediction angle index; the ratio of the prediction mode index to the number of prediction angles can be used as the reference weight position index. In some alternative embodiments, the block-level index information may include a hybrid mode index, which is used to calculate the function information index, the reference weight position index, and the prediction angle index. That is, in this embodiment, the function information index, the reference weight position index, and the prediction angle index can be calculated through one index. For example, the remainder of the hybrid mode index divided by the number of prediction modes is used as the prediction mode index, the ratio of the hybrid mode index to the number of prediction modes is used as the function information index, the remainder of the prediction mode index divided by the number of prediction angles is used as the prediction angle index; the ratio of the prediction mode index to the number of prediction angles is used as the reference weight position index. In some alternative embodiments, the block-level index information may include a first flag bit for indicating the reference weight derivation method. Then, according to the value of the first flag bit, the reference weight derivation function adopted by the coded block can be determined (that is, the reference weight derivation method is used to represent the reference weight derivation function). Among them, different values of the first flag bit correspond to different reference weight derivation functions. For example, if the value of the first flag bit is 0, it means that the coded block adopts the reference weight derivation function 1; if the value of the first flag bit is 1, it means that the coded block adopts the reference weight derivation function 2. In some alternative embodiments, the block-level index information may include a second flag bit for indicating the reference weight derivation method. Then, according to the value of the second flag bit, the weight array used to derive the reference weight can be determined (that is, the reference weight derivation method is used to represent the weight array). The weight array contains multiple set reference weight values; among them, the weight array is used to select the corresponding reference weight value as the reference weight of the coded block according to the distance from the reference weight sample point to the mixing region (this distance can be the distance from the reference weight sample point to the starting position of the mixing region, or the distance from the reference weight sample point to the center position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region), and different values of the second flag bit correspond to different weight arrays. For example, if the value of the second flag bit is 0, it means using the weight array 1; if the value of the second flag bit is 1, it means using the weight array 2. In some alternative embodiments, the block-level index information may include a third flag bit for indicating the reference weight derivation method. Then, the distance transformation amount can be determined according to the value of the third flag bit (i.e., the reference weight derivation method is used to represent the distance transformation amount). The distance transformation amount is used to transform the distance from the reference weight sample point to the mixing region (this distance can be the distance from the reference weight sample point to the starting position of the mixing region, or the distance from the reference weight sample point to the central position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region) (such as shifting left or right, etc.) to obtain a transformed distance value. Among them, the transformed distance value is used to select a corresponding reference weight value from a set weight array as the reference weight of the coding block. The weight array contains multiple set reference weight values. Different values of the third flag bit correspond to different distance transformation amounts. For example, if the value of the third flag bit is 0, it means the distance transformation amount is 2; if the value of the third flag bit is 1, it means the distance transformation amount is 1. In some alternative embodiments, the block-level index information in the bitstream information may further include a fourth flag bit for indicating the reference weight derivation method. Then, according to the value of the fourth flag bit, the function parameters used by the coding block when using a specified reference weight derivation function can be determined (i.e., the reference weight derivation method is used to represent the function parameters). Among them, different values of the fourth flag bit correspond to different function parameters. For example, if the specified reference weight derivation function is the sigmoid function, then the value of the fourth flag bit is used to indicate the parameter value of a specified parameter in the sigmoid function. In some alternative embodiments, the block-level index information in the bitstream information may further include a fifth flag bit. The value of the fifth flag bit is used to indicate a distance offset amount, and the distance offset amount is used to adjust the distance from the reference weight sample point to the mixing region (this distance can be the distance from the reference weight sample point to the starting position of the mixing region, or the distance from the reference weight sample point to the central position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region). Among them, different values of the fifth flag bit correspond to different distance offset amounts. That is, the technical solution of this embodiment can apply an offset amount to the distance from the reference weight sample point to the mixing region through the fifth flag bit. In one embodiment of the present application, determining the reference weight derivation method of the coding block in an implicit manner may be determined according to the weighted prediction mode adopted by the coding block. For example, if it is determined according to the bitstream information that the coding block adopts an angular weighted prediction mode, it is determined that the coding block uses a set first reference weight derivation method; if it is determined according to the bitstream information that the coding block adopts a spatial angular weighted prediction mode, it is determined that the coding block uses a set first reference weight derivation method. The first reference weight derivation method and the second reference weight derivation method may be different or the same. In one embodiment of the present application, the method for implicitly determining the reference weight derivation method of a coding block may be: determining the weight mode number of the weighted prediction mode adopted by the coding block according to the block-level information in the bitstream information, calculating the value of the reference weight index information according to the weight mode number, and determining the set of reference weight derivation methods (such as a set of reference weight derivation functions) used by the coding block according to the value of the reference weight index information. It should be noted that the set of reference weight derivation functions may include one or more reference weight derivation functions. If only one reference weight derivation function is included, then this one reference weight derivation function is used as the reference weight derivation function of the coding block; if multiple reference weight derivation functions are included, then one of them may be selected (such as selected according to cost or other methods) as the reference weight derivation function used by the coding block. In one embodiment of the present application, the method for implicitly determining the reference weight derivation method of a coding block may be: if it is determined according to the bitstream information that the coding block is a coding block of a set size, then determining that the coding block uses a set set of reference weight derivation methods (such as a set of reference weight derivation functions). That is, in this embodiment, for a coding block of a set size, the set of reference weight derivation methods used by it can be preset. Optionally, the set of reference weight derivation methods may include one or more reference weight derivation functions. In one embodiment of the present application, the method for implicitly determining the reference weight derivation method of a coding block may be: determining the set of reference weight derivation methods (such as a set of reference weight derivation functions) used by the coding block according to the size of the coding block included in the bitstream information, where coding blocks of different sizes use different reference weight derivation methods. Optionally, the set of reference weight derivation methods may include one or more reference weight derivation functions. In one embodiment of the present application, the method for implicitly determining the reference weight derivation method of a coding block may be: calculating the costs corresponding to various set reference weight derivation methods used by the coding block according to the block-level information in the bitstream information, and using the reference weight derivation method with the minimum corresponding cost as the reference weight derivation method used by the coding block. In one embodiment of the present application, the method for implicitly determining the reference weight derivation method of a coding block may be: calculating the costs respectively corresponding to multiple set reference weight derivation methods used by the coding block according to the block-level information in the bitstream information, sorting the multiple reference weight derivation methods according to the costs, and selecting the weight derivation method ranked in the set order as the reference weight derivation method used by the coding block. In one embodiment of the present application, the method for deriving the reference weight of the coding block includes the method for deriving the reference weight of the luminance component of the coding block and the method for deriving the reference weight of the chrominance component of the coding block, and the method for deriving the reference weight of the luminance component of the coding block is different from the method for deriving the reference weight of the chrominance component of the coding block. For example, the method for implicitly determining the reference weight derivation method of the coding block may be determined according to the color component of the coding block. For example, a set first reference weight derivation method (such as a first reference weight derivation function) is used for the luminance component of the coding block, and a set second reference weight derivation method (such as a second reference weight derivation function) is used for the chrominance component of the coding block. The first reference weight derivation method and the second reference weight derivation method may be different, or may be the same. It can be seen that in the embodiments of the present application, the method for deriving the reference weight of the coding block can be indicated by explicit index information in the sequence header information, picture header information, slice header information, and block-level information, and the method for deriving the reference weight of the coding block can also be determined implicitly based on the block-level information. In actual use, these methods can be used alone or in combination with any number of them. For example, when determining the method for deriving the reference weight of the coding block by implicit means and the explicit index information in the bitstream information according to the bitstream information, the method for deriving the reference weight that is allowed to be used (such as a set of allowed reference weight derivation methods or a quantity, etc.) can be determined by implicit means according to the bitstream information, and then the method for deriving the reference weight of the coding block can be selected from the allowed reference weight derivation methods according to the explicit index information in the bitstream information. Continuing to refer to FIG. 13, in step S1330, the reference weight corresponding to the coding block is calculated according to the reference weight derivation method, and the weight matrix corresponding to the coding block is determined according to the reference weight. In some alternative embodiments, calculating the reference weight corresponding to the coding block according to the reference weight derivation method may be calculating the reference weight corresponding to the coding block based on the distance from the reference weight sample point to the mixing region according to the reference weight derivation method. Among them, the distance from the reference weight sample point to the mixing region is the distance from the reference weight sample point to the center of the mixing region, or the distance from the reference weight sample point to the mixing region is the distance from the reference weight sample point to the starting point of the mixing region, or the distance from the reference weight sample point to the mixing region is the distance from the reference weight sample point to the end position of the mixing region. Of course, a set offset may also be added based on these distances. In some alternative embodiments, the block-level index information in the bitstream information may include a fifth flag bit, and the value of the fifth flag bit is used to indicate a distance offset, and the distance offset is used to adjust the distance from the reference weighted sample to the mixing region (the distance may be the distance from the reference weighted sample to the starting position of the mixing region, or the distance from the reference weighted sample to the center position of the mixing region, or the distance from the reference weighted sample to the ending position of the mixing region); wherein, different values of the fifth flag bit correspond to different distance offsets. That is, the technical solution of this embodiment can apply an offset to the distance from the reference weighted sample to the mixing region through the fifth flag bit. In some alternative embodiments, the process of calculating the reference weight corresponding to the coding block according to the reference weight derivation method may be that if the distance from the reference weighted sample in the coding block to the mixing region is between the set minimum distance and the set maximum distance, then calculate the reference weight of the coding block according to the reference weight derivation method; if the distance from the reference weighted sample to the mixing region is less than the minimum distance, then set the reference weight to the minimum reference weight; if the distance from the reference weighted sample to the mixing region is greater than the maximum distance, then set the reference weight to the maximum reference weight. The technical solution of this embodiment can also limit the value of the reference weight, wherein, the distance from the reference weighted sample to the mixing region may be the distance from the reference weighted sample to the starting position of the mixing region, or the distance from the reference weighted sample to the center position of the mixing region, or the distance from the reference weighted sample to the ending position of the mixing region. In some alternative embodiments, different reference weight derivation methods correspond to different minimum distances and maximum distances. For example, reference weight derivation method 1 corresponds to a set of minimum distance and maximum distance; reference weight derivation method 2 corresponds to another set of minimum distance and maximum distance. In some alternative embodiments, determining the weight matrix corresponding to the coding block according to the reference weight may be calculating the weight matrix corresponding to the coding block according to the reference weight and the weight prediction angle used by the coding block. The specific calculation process may refer to the introduction in the foregoing embodiments and will not be elaborated here. In some alternative embodiments, the weight matrix corresponding to the coding block determined according to the reference weight may be to calculate the candidate weight matrix corresponding to the coding block according to the reference weight and the prediction angle used by the coding block (the calculation process of the candidate weight matrix is similar to the process of calculating the weight matrix corresponding to the coding block according to the reference weight and the weight prediction angle used by the coding block in the foregoing embodiments), and perform a mapping process on the candidate weight matrix according to the set weight mapping table to obtain the weight matrix corresponding to the coding block. The technical solution of this embodiment performs a mapping process on the calculated weight matrix. In actual implementation, for example, there are two reference weight derivation functions (illustrated by taking a linear function and a sigmoid function as examples). These two functions can obtain two weight values (w1, w2) for the same independent variable d (the distance between the sample point and the mixing region). Then, for different d, a mapping table from weight w1 to w2 can be obtained. In this case, the codec only needs to store one reference weight derivation function and related parameters. Thus, assuming that the linear function and related parameters are stored, then if it is necessary to use the sigmoid function to derive the reference weight, the linear function can be used for calculation and then mapped through this mapping table to obtain it. This method can reduce the space occupied by storing multiple functions and can reduce the amount of calculation, which is beneficial to improving the coding and decoding performance. In some alternative embodiments, the reference weight corresponding to the coding block is: the weight obtained by performing a rounding process on the weight calculated according to the reference weight derivation method according to a specified rounding method; wherein, the specified rounding method includes one of rounding, ceiling, and floor. In other words, after calculating the weight according to the reference weight derivation method, it can be rounded according to the specified rounding method; wherein, the specified rounding method includes one of rounding, ceiling, and floor. In some alternative embodiments, the reference weight corresponding to the coding block is: the weight obtained by performing a quantization process on the weight calculated according to the reference weight derivation method; wherein, different reference weight derivation methods correspond to different quantization intervals. In other words, after calculating the weight according to the reference weight derivation method, it can be quantized; wherein, different reference weight derivation methods correspond to different quantization intervals. Among them, the quantization process of the reference weight is to adjust the value of the reference weight to the set quantization interval, such as shrinking or expanding by a specified multiple. In some alternative embodiments, the reference weight corresponding to the coding block is: the weight obtained by performing a clipping process on the weight calculated according to the reference weight derivation method according to the set maximum reference weight and minimum reference weight, and the clipping process is used to limit the reference weight between the maximum reference weight and the minimum reference weight. In other words, after the weight is calculated according to the reference weight derivation method, it can be clipped according to the set maximum reference weight and minimum reference weight to ensure that the reference weight is limited between the maximum reference weight and the minimum reference weight. Among them, clipping the reference weight means that when the value of the reference weight is less than the minimum reference weight, the set minimum reference weight is used; when the value of the reference weight is greater than the maximum reference weight, the set maximum reference weight is used; when the value of the reference weight is between the minimum reference weight and the maximum reference weight, the calculated reference weight value is used. In step S1340, weighted prediction is performed according to the weight matrix to obtain the predicted value corresponding to the coding block. In some optional embodiments, the process of performing weighted prediction according to the weight matrix to obtain the predicted value corresponding to the coding block can refer to the introduction in the foregoing embodiments and will not be elaborated here. FIG. 14 shows a flowchart of a video coding method according to an embodiment of the present application. The video coding method can be executed by a device with computing and processing capabilities, such as a terminal device or a server. Referring to FIG. 14, the video coding method at least includes steps S1410 to S1440, which are introduced in detail as follows: In step S1410, if the coding block to be coded using the weighted prediction mode allows adaptive derivation of the reference weight, the reference weight derivation method used by the coding block to be coded is determined. In step S1420, the reference weight corresponding to the coding block to be coded is calculated according to the determined reference weight derivation method. In step S1430, the weight matrix corresponding to the coding block to be coded is determined according to the reference weight. In step S1440, weighted prediction is performed according to the weight matrix to obtain the predicted value corresponding to the coding block to be coded, and the coding block to be coded is coded according to the predicted value. It should be noted that the specific processing process at the coding end is similar to that at the decoding end and will not be elaborated here. Among them, if the coding end needs to indicate the reference weight derivation method (such as the reference weight derivation function) through explicit index information, then it needs to be coded in the video bitstream. In summary, the technical solution of the embodiment of the present application enables the coding block to adaptively select the reference weight derivation method and is indicated through the bitstream information, thereby enabling a more accurate weight matrix to be derived for different coding blocks, which is beneficial to improving the coding and decoding performance. The following elaborates in detail the implementation details of the technical solution of the embodiment of the present application from the perspective of the decoding end again: In the embodiment of the present application, the reference weight derivation function is extended, and multiple reference weight derivation functions can be used, which are specifically as follows: In the following function, d represents the distance between the sample point and the mixing region, which can be the distance between the sample point and the starting position of the mixing region, the distance between the sample point and the midpoint position of the mixing region, or of course the distance between the sample point and the ending position of the mixing region, etc. Of course, an offset value can also be added based on these distances. Optionally, the distance represented by d can be directional. For example, if the sample point position is pos and the mixing region is c, and the value of d is pos - c, then a negative value of d indicates that it is on the left side of the mixing region, and a positive value of d indicates that it is on the right side of the mixing region. Of course, the distance represented by d can also be non-directional, and then the absolute value of the distance can be calculated through abs(pos - c). In an embodiment of the present application, the reference weight derivation function can use a linear function, for example: w = s * (d + k); where s and k are parameter values of the function, and these parameter values can be preset values or can be indicated by bitstream information. In an embodiment of the present application, the reference weight derivation function can use a sigmoid function, for example: where s and k are parameter values of the function, and these parameter values can be preset values or can be indicated by bitstream information. For example, when s = 2, the function graph is shown in Figure 15, and the weight of the mixing region can be set according to the function values corresponding to [-2, 2]. In an embodiment of the present application, the reference weight derivation function can use a hyperbolic function, for example, the tanh function can be used: w = 0.5 * tanh(s * d) + 0.5; where s is the parameter value of the function, and this parameter value can be a preset value or can be indicated by bitstream information. For example, when s = 1.3, the function graph is shown in Figure 16, and the weight of the mixing region can be set according to the function values corresponding to [-2, 2]. In an embodiment of the present application, the reference weight derivation function can use a form based on a trigonometric function, such as a form based on a cosine function: where s is the parameter value of the function, and this parameter value can be a preset value or can be indicated by bitstream information. For example, when s = 0.5, the function graph is shown in Figure 17, and the weight of the mixing region can be set according to the function values corresponding to [-2, 2]. In an embodiment of the present application, the reference weight derivation function can use an exponential-based function. For example, if d is less than 0, then w = e s1(d-s2) ; if d is greater than or equal to 0, then where s1 and s2 are parameter values of the function, and these parameter values can be preset values or can be indicated by bitstream information. For example, s1 = 2, If s2 = 0.3465735, then the weights of the mixed region can be set according to the function values corresponding to [-2, 2]. In an embodiment of the present application, the reference weight derivation function can use a polynomial-based function, such as a polynomial with a quadratic power. In an embodiment of the present application, the reference weight derivation function can use a piecewise function to derive weights. Different weight derivation functions are used according to the value of d. For example, when d is less than or equal to 0, the sigmoid function is used; otherwise, a linear function is used. In an embodiment of the present application, the method of looking up a table can also be used to generate the reference weights when deriving the reference weights. For example, one or more lookup tables can be generated according to a preset precision. The lookup table stores the mapping relationship between d and the function value. During the weight derivation process, the reference weight is confirmed by looking up the function value corresponding to d, without the need to derive the reference weight through the above function. Optionally, when constructing the lookup table, further adjustments can be made based on the rounded weights, such as +1, -1, +2, -2, etc. It should be noted that d in the embodiments of the present application can use different precisions, such as 8-pixel precision, 4-pixel precision, 2-pixel precision, 1-pixel precision, 1 / 2-pixel precision, 1 / 4-pixel precision, or 1 / 64-pixel precision, etc. Based on the above reference weight derivation function, the main processing flow of the embodiments of the present application includes: Process 1: Decode the bitstream, and determine the reference weight derivation method according to the information in the bitstream (where the following methods and the methods in each method can be used alone or in combination) Method 1: Decode the sequence header information In an embodiment of the present application, there is an index seq_awp_index in the sequence header indicating the reference weight derivation method used for the current sequence. Among them, there is a preset list that determines a series of optional reference weight derivation methods (such as reference weight derivation functions). The method with the index seq_awp_index in the preset list is determined as the reference weight derivation method used for the current sequence. In an example, as shown in Table 5: Table 5 Referring to Table 5, different values of seq_awp_index indicate the use of different reference weight derivation methods. Optionally, the descriptor of seq_awp_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). In one embodiment of the present application, there is a sequence header angle weighted prediction mode flag seq_awp_flag and a sequence header adaptive angle weighted prediction mode flag seq_awp_adt_flag in the sequence header. Among them, seq_awp_flag indicates whether the current sequence allows the use of the AWP mode, and seq_awp_adt_flag indicates whether the use of an adaptive reference weight derivation method (i.e., the method proposed in the embodiment of the present application, which can be denoted as AWP-ADT) is allowed. In one example, as shown in Table 6 (x in Table 6 indicates no decoding): Table 6 Referring to Table 6, seq_awp_flag can be a binary variable. A value of 1 indicates that the current sequence allows the use of the AWP mode; a value of 0 indicates that the use of the AWP mode is not allowed. seq_awp_adt_flag can be a binary variable. A value of 1 indicates that the AWP-ADT mode is allowed; a value of 0 indicates that the AWP-ADT mode is not allowed. The decoding processes of seq_awp_flag and seq_awp_adt_flag are shown in Table 7: Table 7 Referring to Table 7, first decode seq_awp_flag. If seq_awp_flag indicates that the current sequence allows the use of the AWP mode, then decode seq_awp_adt_flag; if seq_awp_flag indicates that the current sequence does not allow the use of the AWP mode, then there is no need to decode seq_awp_adt_flag. Among them, the descriptors of seq_awp_flag and seq_awp_adt_flag can both be u(1), that is, 1-bit unsigned integers. The value of SeqAwpFlag is equal to the value of seq_awp_flag. If seq_awp_flag does not exist in the bitstream, the value of SeqAwpFlag is 0. Optionally, there is information in the sequence header indicating the function parameters of the reference weight derivation function. Specifically, the information of the function parameters can be directly decoded; or there is a list that stipulates the order of the function parameters, and the information of the function parameters can be determined from this list according to a decoded index seq_param_index. In one example, as shown in Table 8: Table 8 As shown in Table 8, different values of seq_param_index indicate parameters for using different reference weight derivation functions. Optionally, the descriptor of seq_param_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). Method 2: Decoding image header information In an embodiment of the present application, there is an index pic_awp_index in the image header indicating the reference weight derivation method used for the current image. Among them, there is a preset list that determines a series of optional reference weight derivation methods (such as reference weight derivation functions). The method with the index pic_awp_index in the preset list is determined as the reference weight derivation method used for the current image. In one example, as shown in Table 9: Table 9 As shown in Table 9, different values of pic_awp_index indicate different reference weight derivation methods. Optionally, the descriptor of pic_awp_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). In an embodiment of the present application, there is an image header angle weighted prediction mode flag pic_awp_flag and an image header adaptive angle weighted prediction mode flag pic_awp_adt_flag in the image header. Among them, pic_awp_flag indicates whether the current image allows the use of the AWP mode, and pic_awp_adt_flag indicates whether the use of an adaptive reference weight derivation method (i.e., AWP-ADT) is allowed. In one example, as shown in Table 10 (x in Table 10 indicates no decoding): Table 10 As shown in Table 10, pic_awp_flag can be a binary variable, and a value of 1 indicates that the current image allows the use of the AWP mode; a value of 0 indicates that the use of the AWP mode is not allowed. pic_awp_adt_flag can be a binary variable, and a value of 1 indicates that the use of the AWP-ADT mode is allowed; a value of 0 indicates that the use of the AWP-ADT mode is not allowed. The decoding process of pic_awp_flag and pic_awp_adt_flag is shown in Table 11: Table 11 As shown in Table 11, first decode pic_awp_flag. If pic_awp_flag indicates that the AWP mode is allowed for the current image, then decode pic_awp_adt_flag; if pic_awp_flag indicates that the AWP mode is not allowed for the current image, then there is no need to decode pic_awp_adt_flag. Among them, the descriptors of pic_awp_flag and pic_awp_adt_flag can both be u(1), that is, 1-bit unsigned integers. The value of PicAwpFlag is equal to the value of pic_awp_flag. If pic_awp_flag does not exist in the bitstream, the value of PicAwpFlag is 0. Optionally, there is an index in the picture header indicating the function parameters of the reference weight derivation function. Specifically, the information of the function parameters can be directly decoded; or there is a list specifying the order of the function parameters, and the information of the function parameters can be determined from this list according to a decoded index pic_param_index. In one example, as shown in Table 12: Table 12 As shown in Table 12, different values of pic_param_index indicate the parameters of different reference weight derivation functions. Optionally, the descriptor of pic_param_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). Optionally, the reference weight derivation method can be determined according to the picture type. For example, only when the picture type is a specific picture type (such as a non-P frame), it is necessary to decode the index to determine the reference weight derivation method. Method 3: Decode the picture header information In an embodiment of the present application, there is an index slice_awp_index in the picture header (patch or slice) indicating the reference weight derivation method used for the current slice. Among them, there is a preset list determining a series of optional reference weight derivation methods (such as reference weight derivation functions), and the method with the index slice_awp_index in the preset list is determined as the reference weight derivation function used for the current slice. In one example, as shown in Table 13: Table 13 As shown in Table 13, different values of slice_awp_index indicate different reference weight derivation methods. Optionally, the descriptor of slice_awp_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). In one embodiment of the present application, there is a slice angle weighted prediction mode flag slice_awp_flag and a slice adaptive angle weighted prediction mode flag slice_awp_adt_flag in the slice header. Among them, slice_awp_flag indicates whether the current slice allows the use of the AWP mode, and slice_awp_adt_flag indicates whether the use of an adaptive reference weight derivation method (i.e., AWP-ADT) is allowed. In one example, as shown in Table 14 (where x in Table 14 indicates no decoding): Table 14 Referring to Table 14, slice_awp_flag can be a binary variable. A value of 1 indicates that the current slice allows the use of the AWP mode; a value of 0 indicates that the use of the AWP mode is not allowed. slice_awp_adt_flag can be a binary variable. A value of 1 indicates that the AWP-ADT mode is allowed; a value of 0 indicates that the AWP-ADT mode is not allowed. The decoding process of slice_awp_flag and slice_awp_adt_flag is shown in Table 15: Table 15 Referring to Table 15, first decode slice_awp_flag. If slice_awp_flag indicates that the current slice allows the use of the AWP mode, then decode slice_awp_adt_flag; if slice_awp_flag indicates that the current slice does not allow the use of the AWP mode, then there is no need to decode slice_awp_adt_flag. Among them, the descriptors of slice_awp_flag and slice_awp_adt_flag can both be u(1), that is, 1-bit unsigned integers. The value of SliceAwpFlag is equal to the value of slice_awp_flag. If slice_awp_flag does not exist in the bitstream, the value of SliceAwpFlag is 0. Optionally, there is a function parameter in the slice header that indicates the reference weight derivation function. Specifically, the information of the function parameter can be directly decoded; or there is a list that specifies the order of the function parameters, and the information of the function parameter can be determined from this list according to a decoded index slice_param_index. In one example, as shown in Table 16: Table 16 As shown in Table 16, different values of slice_param_index indicate parameters for using different reference weight derivation functions. Optionally, the descriptor of slice_param_index is u(n), that is, an n-bit unsigned integer, and the value of n is set according to the number of reference weight derivation methods, that is, n = ceil(log2(number)). Optionally, the reference weight derivation method can be determined according to the image type. For example, only when the image type is a specific image type (such as a non-P frame), it is necessary to decode the index to determine the reference weight derivation method. In some optional embodiments, the syntax elements at different levels in the above embodiments (i.e., the syntax elements in the sequence header, the syntax elements in the picture header, and the syntax elements in the slice header) can be dependent. If the syntax elements at the higher level do not allow the use of the adaptive angular weighted prediction mode, then the lower level does not allow it either, and there is no need to decode the relevant syntax elements. The following takes the syntax elements in the picture header and the syntax elements in the sequence header as an example for illustration. Table 17 shows the process of decoding the syntax elements: Table 17 As shown in Table 17, pic_awp_adt_flag is decoded only when SeqAwpAdtFlag indicates that the adaptive angular weighted prediction mode (i.e., AWP-ADT) is allowed. Among them, the value of SeqAwpAdtFlag is equal to the value of seq_awp_adt_flag. If seq_awp_adt_flag does not exist in the bitstream, the value of SeqAwpAdtFlag is 0. In some optional embodiments, the non-use of the adaptive angular weighted prediction mode in the above embodiments also includes that the syntax element specifies to use a specific reference weight derivation method. In some optional embodiments, if the syntax elements at the higher level allow the use of the adaptive angular weighted prediction mode, then it is determined whether to use the adaptive angular weighted prediction mode according to the relevant syntax elements at the lower level. The following lists some examples in specific applications: As shown in Table 18 below, it can be indicated by a flag bit (this flag bit can be a flag bit in the sequence header, the picture header, or the slice header information). When the value of this flag bit is 0 and 1, they respectively indicate the use of specific reference weights; when the value of this flag bit is 2, it indicates that the adaptive reference weight derivation method is allowed, and the specific method can be determined according to the block-level information. Table 18 As shown in Table 19 below, it can be indicated by a flag bit (the flag bit can be a flag bit in the sequence header, picture header, or slice header information). When the value of the flag bit is 0, it indicates that the adaptive reference weight derivation method is allowed, and the specific method can be determined according to the block-level information; when the value of the flag bit is 1, it indicates the use of a specific reference weight. Table 19 As shown in Table 20 below, it can be indicated by a flag bit (the flag bit can be a flag bit in the sequence header, picture header, or slice header information). When the value of the flag bit is different, it respectively indicates the use of different reference weight derivation methods (such as reference weight derivation functions). Table 20 As shown in Table 21 below, it can be indicated by a flag bit (the flag bit can be a flag bit in the sequence header, picture header, or slice header information). When the value of the flag bit is different, it respectively indicates the use of different function parameters. Table 21 As shown in Table 22 below, it can be indicated by two flag bits (the flag bit can be a flag bit in the sequence header, picture header, or slice header information). Table 22 It should be noted that the above sequence header, picture header, and slice header information can be used only to determine the reference weight derivation method for the AWP mode; or only to determine the reference weight derivation method for the SAWP mode; or used simultaneously to determine the reference weight derivation methods for both the AWP mode and the SAWP mode. For example, there is seq_awp_index to determine the reference weight derivation methods for AWP and SAWP; or used separately to determine the reference weight derivation methods for the AWP mode and the SAWP mode. For example, there is seq_awp_weight_index to determine the reference weight derivation method for the AWP mode, and there is seq_sawp_weight_index to determine the reference weight derivation method for SAWP. Method 4: Decoding block-level information In an embodiment of the present application, the block-level information can determine the reference weight derivation method through an explicit indexing method. The explicit indexing information in the block-level information can include one or more of the following information: block-level angular weighted prediction mode flag cu_awp_flag, block-level angular weighted prediction mode reference weight parameter index cu_awp_blend_idx, block-level angular weighted prediction mode reference weight step index cu_awp_step_idx, block-level angular weighted prediction mode weight prediction angle index cu_awp_angle_idx. Among them, the block-level angular weighted prediction mode flag cu_awp_flag can be a binary variable. A value of 1 indicates that the current block allows the use of the AWP mode; a value of 0 indicates that the use of the AWP mode is not allowed. The block-level angular weighted prediction mode reference weight parameter index cu_awp_blend_idx represents the reference weight parameter index used by the coded block (i.e., the function information index, which can indicate both the reference weight derivation function and the parameters of the reference weight derivation function); the block-level angular weighted prediction mode reference weight step index cu_awp_step_idx represents the step of the reference weight used by the coded block (i.e., the reference weight position index, which can indicate the starting position, center position, or ending position, etc. of the reference weight blending region); the block-level angular weighted prediction mode weight prediction angle index cu_awp_angle_idx represents the weight prediction angle used by the coded block (i.e., the prediction angle index). In some alternative embodiments, if the current block allows the use of the AWP mode, the indices cu_awp_blend_idx, cu_awp_step_idx, and cu_awp_angle_idx can be decoded from the block-level information. Optionally, as shown in Table 23, an exemplary syntax element decoding process is as follows: Table 23 As shown in Table 23, first decode cu_awp_flag. Only when CuAwpFlag indicates that the AWP mode is allowed and SeqAwpAdtFlag indicates that the current sequence allows the use of the AWP-ADT mode, decode cu_awp_blend_idx; at the same time, if CuAwpFlag indicates that the AWP mode is allowed, then decode cu_awp_step_idx and cu_awp_angle_idx. Among them, the value of CuAwpFlag is equal to the value of cu_awp_flag. If cu_awp_flag does not exist in the bitstream, the value of CuAwpFlag is 0; the value of SeqAwpAdtFlag is equal to the value of seq_awp_adt_flag. If seq_awp_adt_flag does not exist in the bitstream, the value of SeqAwpAdtFlag is 0. Among them, the descriptors of cu_awp_flag, cu_awp_blend_idx, cu_awp_step_idx, and cu_awp_angle_idx are all ae(v), that is, syntax elements of advanced entropy coding. In some alternative embodiments, the index cu_awp_blend_idx and the block-level angular weighted prediction mode weight pattern index cu_awp_mode_idx (i.e., the prediction mode index) can be decoded from the block-level information to indicate cu_awp_angle_idx and cu_awp_step_idx. where cu_awp_angle_idx = cu_awp_mode_idx % awp_angle_num; cu_awp_step_idx = cu_awp_mode_idx / awp_angle_num; awp_angle_num = 8. Optionally, as shown in Table 24, an exemplary syntax element decoding process is as follows: Table 24 As shown in Table 24, first decode cu_awp_flag. Only when CuAwpFlag indicates that the AWP mode is allowed and SeqAwpAdtFlag indicates that the AWP-ADT mode is allowed for the current sequence, then decode cu_awp_blend_idx. At the same time, if CuAwpFlag indicates that the AWP mode is allowed, then decode cu_awp_mode_idx. Among them, the value of CuAwpFlag is equal to the value of cu_awp_flag. If cu_awp_flag does not exist in the bitstream, the value of CuAwpFlag is 0; the value of SeqAwpAdtFlag is equal to the value of seq_awp_adt_flag. If seq_awp_adt_flag does not exist in the bitstream, the value of SeqAwpAdtFlag is 0. Among them, the descriptors of cu_awp_flag, cu_awp_blend_idx, and cu_awp_mode_idx are all ae(v), that is, syntax elements of advanced entropy coding. In some alternative embodiments, a block-level angular weighted prediction mode weight pattern index cu_awp_blend_mode_idx (i.e., the blend mode index) can be decoded from the block-level information to indicate cu_awp_blend_idx, cu_awp_angle_idx, and cu_awp_step_idx. where cu_awp_mode_idx = cu_awp_blend_mode_idx % awp_mode_num; cu_awp_blend_idx = cu_awp_blend_mode_idx / awp_mode_num; cu_awp_angle_idx = cu_awp_mode_idx % awp_angle_num; cu_awp_step_idx = cu_awp_mode_idx / awp_angle_num; awp_angle_num = 8; awp_mode_num = 56. Optionally, as shown in Table 25, an exemplary syntax element decoding process is as follows: Table 25 As shown in Table 25, first decode cu_awp_flag. Only when CuAwpFlag indicates that the AWP mode is allowed to be used and SeqAwpAdtFlag indicates that the AWP-ADT mode is allowed to be used for the current sequence, then decode cu_awp_blend_mode_idx. Among them, the value of CuAwpFlag is equal to the value of cu_awp_flag. If cu_awp_flag does not exist in the bitstream, the value of CuAwpFlag is 0; the value of SeqAwpAdtFlag is equal to the value of seq_awp_adt_flag. If seq_awp_adt_flag does not exist in the bitstream, the value of SeqAwpAdtFlag is 0. Among them, the descriptors of cu_awp_flag and cu_awp_blend_mode_idx are both ae(v), that is, syntax elements of advanced entropy coding. In an embodiment of the present application, cu_awp_blend_idx can be used to indicate a reference weight derivation function. Specifically, as shown in Table 26, different values of cu_awp_blend_idx correspond to different reference weight derivation functions: Table 26 In an embodiment of the present application, cu_awp_blend_idx can be used to indicate a weight array. Specifically, as shown in Table 27, different values of cu_awp_blend_idx correspond to different weight arrays: Table 27 In Table 27, LUT represents an array, and g(d) represents a function related to the distance d from the reference weight sample point to the mixing region, where g(d) = Clip(min, max, d). Here, min and max represent the set minimum and maximum values respectively. d can be the distance from the reference weight sample point to the starting position of the mixing region, or the distance from the reference weight sample point to the center position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region. In an embodiment of the present application, the weight array can also be fixed, and only the scaling of d is indicated by cu_awp_blend_idx. Specifically, as shown in Table 28, different values of cu_awp_blend_idx correspond to different shift values of d: Table 28 In some alternative embodiments, cu_awp_blend_idx can also be expressed as different semantics. For example, it can be expressed as a parameter of the weight derivation function, or it can represent the size of the reference weight mixing region. Of course, the size of the reference weight mixing region can also be indicated by a separate index, or it can be determined implicitly. In some alternative embodiments, there is an index in the coding block (this index can be cu_awp_blend_idx or other names) indicating the parameter of the weight derivation function. For example, for the sigmoid function, the value of parameter s or the index corresponding to parameter s is included in the bitstream. For example, the sigmoid function is expressed as Then, referring to Table 29, the value of parameter s of the weight derivation function is determined according to different index values index: Table 29 In some alternative embodiments, d in the above embodiments represents the distance from the reference weight sample point to the mixing region, and specifically, it can represent the distance from the reference weight sample point to the starting position of the mixing region, or the distance from the reference weight sample point to the center position of the mixing region, or the distance from the reference weight sample point to the ending position of the mixing region. Assume that d represents the distance from the reference weight sample point to the center position cp1 of the mixing region. Then, the value of cp1 can be determined according to the formula cp1 = cp + offset (i.e., an offset offset is added to cp), where cp is the center position of the mixing region determined according to the angular weighting mode. Optionally, cp can be calculated in the manner shown in Table 30: Table 30 Among them, the effective length vL in Table 30 can be calculated in the same way as in Table 1 above. In this case, there may be an index in the coding block (this index can be cu_awp_blend_idx or other names) indicating the value of offset, as shown in Table 31 specifically: Table 31 Assume that d represents the distance from the reference weight sample point to the starting position fp1 of the blending region. Then, the value of fp1 can be determined according to the formula fp1 = fp + offset (that is, an offset offset is added to fp), where fp is the starting position of the blending region determined according to the angular weighting mode. Optionally, fp can be calculated in the way shown in Table 32: Table 32 Among them, the effective length vL in Table 32 can be calculated in the same way as in Table 1 above. In this case, there may be an index in the coding block (this index can be cu_awp_blend_idx or other names) indicating the value of offset, as shown in Table 33 specifically: Table 33 In some alternative embodiments, after the reference weights of the coding block are derived, the reference weight values can use different rounding methods, such as rounding, ceiling, floor, etc. In some alternative embodiments, different reference weight derivation methods may have different quantization precisions. For example, there may be an index in the bitstream (this index can be cu_awp_blend_idx or other names). When this index is equal to 0, it indicates that the reference weight quantization interval is 0 - 16, that is, the reference weight value is quantized into the interval of 0 - 16; when this index is equal to 1, it indicates that the reference weight quantization interval is 0 - 32, that is, the reference weight value is quantized into the interval of 0 - 32. In some alternative embodiments, the reference weight values in the above embodiments can be clipped, for example, clipped by the formula w = clip(min_w, max_w, f(d)), where min_w represents the minimum reference weight and can be 0; max_w represents the maximum reference weight; f(d) represents the reference weight value determined by the reference weight derivation method in the above embodiments. By clipping the reference weight values, the reference weight values can be restricted within a certain range (that is, between the minimum reference weight and the maximum reference weight). In some alternative embodiments, the reference weight values may also be clipped according to the distance d in the above embodiments because the reference weight mixing regions have different sizes. Specifically, assume there is a minimum and maximum value interval [min_d, max_d] for the distance d, and a corresponding weight value interval [min_w, max_w]. The values of min_w and max_w are related to the selected quantization precision. For example, if the quantization precision is [0, 32], then [min_w, max_w] is [0, 32]. In this case, if d is within the interval [min_d, max_d], the determined reference weight derivation method is used for derivation, and the specific method is shown in Table 34 below: Table 34 As shown in Table 34, f(d) represents the reference weight value determined by the reference weight derivation method in the above embodiments; when d is less than min_d, the minimum value min_w is selected for the reference weight value; when d is greater than max_d, the maximum value max_w is selected for the reference weight value. In some alternative embodiments, different reference weight derivation methods may correspond to different min_d, max_d. There may be an index in the bitstream (this index may be cu_awp_blend_idx or other names) indicating the values of min_d, max_d. Specifically, assume d represents the distance from the reference weight sample point to the center position of the mixing region, then the values of min_d, max_d indicated by the index can be as shown in Table 35: Table 35 Assume d represents the distance from the reference weight sample point to the starting position of the mixing region, then the values of min_d, max_d indicated by the index can be as shown in Table 36: Table 36 In an embodiment of the present application, an implicit method may be adopted to confirm the reference weight derivation method used without decoding additional information. For example, it can be determined according to the prediction mode. For example, different reference weight derivation methods (such as using different reference weight derivation functions) can be used for the AWP mode and the SAWP mode. Or the reference weight derivation scheme proposed in the embodiments of the present application can be applied only to the SAWP mode. It can also be determined according to the block size. For example, the technical solution of the embodiments of the present application can be used only for coding blocks of a specific size. For example, the reference weight derivation scheme proposed in the embodiments of the present application is applied only when the block size is greater than 8×8. Or different reference weight derivation methods (such as using different reference weight derivation functions) are used for coding blocks of different sizes. The template matching technique can also be used to select the way of deriving the reference weight. For example, calculate the costs corresponding to different ways of deriving the reference weight, and select the way of deriving the reference weight with the minimum cost. For this case, the ways of deriving the reference weight can also be sorted according to the cost, and then select the way of deriving the reference weight ranked at the set order; or a reference weight derivation method can also be selected from the sorted list through an explicit index information. The way of deriving the reference weight can also be determined according to different color components. For example, different ways of deriving the reference weight can be selected for the luminance component and the chrominance component. In an embodiment of the present application, a method combining explicit and implicit methods can be adopted to confirm the way of deriving the reference weight used. For example, implicitly determine the set or quantity of the ways of deriving the reference weight allowed according to the coding information, and then decode the explicit index to determine the reference weight. Process 2: Determine the reference weight according to the selected way of deriving the reference weight. Specifically, after determining the way of deriving the reference weight, the reference weight of the coding block can be calculated in combination with the distance d from the reference weight sample point to the reference weight mixing region (center position or starting position). Process 3: Derive the weight matrix according to the reference weight. This process is the process of deriving the weight matrix according to the weight prediction angle and the calculated reference weight. Process 4: Perform weighted prediction based on the weight matrix to obtain the predicted value. This process can refer to the introduction in the foregoing embodiments and will not be elaborated here. The following introduces an embodiment of a specific application scenario of the present application: In a specific application scenario of the present application, an explicit method can be adopted to confirm the way of deriving the reference weight of the current block. Specifically, as shown in Table 37, it is indicated by an index in the sequence header information and the image header information respectively The way of deriving the reference weight used: Table 37 If the current adaptive reference weight derivation method is allowed (i.e., seq_awp_idx is 1 and pic_awp_idx is 0), then decode a parameter cu_awp_blend_idx that indicates the reference weight derivation method (i.e., using the weight array method as shown in Table 41 below, and cu_awp_blend_idx indicates the value of shift), and decode an index cu_awp_mode_idx (i.e., the prediction mode index) that indicates the reference weight position (i.e., cu_awp_step_idx) and the weight prediction angle (i.e., cu_awp_angle_idx). Among them, the number of weight prediction angles awp_angle_num is 8. Among them, cu_awp_angle_idx = cu_awp_mode_idx % awp_angle_num; cu_awp_step_idx = cu_awp_mode_idx / awp_angle_num. In an embodiment of the present application, assume that [min_w, max_w] is [0, 32], and d represents the distance from the reference weight sample point to the starting position fp1 of the blending region. Then, the value of fp1 can be determined according to the formula fp1 = fp + offset (i.e., adding an offset offset to fp), where fp is the starting position of the blending region determined according to the angle weighting mode, and the distance d = x - fp1 (x represents the reference weight sample point). There can be an index in the coding block (this index can be cu_awp_blend_idx or other names) that indicates the value of offset, as shown in Table 38 specifically: Table 38 At the same time, determine the values of min_d and max_d according to the index in the coding block (this index can be cu_awp_blend_idx or other names), as shown in Table 39 specifically: Table 39 Then, determine the reference weight value according to the value of d, Table 40 and Table 41 below. Table 40 shows the reference weight values determined according to different intervals of d: Table 40 Among them, f(d) in Table 40 represents the reference weight value determined by the reference weight derivation method indicated by cu_awp_blend_idx; specifically, determine the value of g(d << shift) according to the shift indicated by cu_awp_blend_idx in Table 41 below, and then select the weight value at the corresponding position in the weight array as the reference weight value of the coding block: Table 41 Assume that the weight array contains 33 weight values as shown below. Then, the corresponding weight value found in the weight array according to the value of g(d<<shift) is the calculated reference weight value: where LUT

[0033] ={ 1, 1, 1, 2, 2, 2, 3, 4, 5, 5, 7, 8, 9, 11, 12, 14, 16, 18, 20, 21, 23, 24, 25, 27, 27, 28, 29, 30, 30, 30, 31, 31, 31 } After determining the reference weight value, the weight matrix can be derived according to the weight prediction angle (i.e., the value indicated by cu_awp_angle_idx) and the calculated reference weight, and then the prediction value can be obtained by weighted prediction based on the weight matrix. It should be noted that in the above specific application scenario, a parameter indicating the reference weight derivation method, the offset in Table 38, the min_d and max_d in Table 39, and the shift in Table 41 can be indicated by an index cu_awp_blend_idx in the bitstream. In addition, the technical solution of the embodiment of the present application is applicable not only to the AWP mode but also to the SAWP mode. The technical solution of the above embodiment of the present application enables the coding block to adaptively select the reference weight derivation method (such as selecting different reference weight derivation functions or function parameters, etc.) and is indicated by the bitstream information, thereby enabling a more accurate weight matrix to be derived for different coding blocks, which is beneficial to improving the coding and decoding performance. The following introduces the apparatus embodiment of the present application, which can be used to execute the method in the above embodiment of the present application. For the details not disclosed in the apparatus embodiment of the present application, please refer to the above method embodiment of the present application. FIG. 18 shows a block diagram of a video decoding apparatus according to an embodiment of the present application. The video decoding apparatus can be disposed in a device with computing and processing capabilities, such as a terminal device or a server. Referring to FIG. 18, a video decoding apparatus 1800 according to an embodiment of the present application includes: a decoding unit 1802, a determination unit 1804, a calculation unit 1806, and a processing unit 1808. Among them, the decoding unit 1802 is configured to perform decoding processing on the video bitstream to obtain bitstream information; the determining unit 1804 is configured to determine the reference weight derivation method of the coding block according to the bitstream information if the coding block adopting the weighted prediction mode allows adaptive derivation of reference weights; the calculating unit 1806 is configured to calculate the reference weight corresponding to the coding block according to the reference weight derivation method, and determine the weight matrix corresponding to the coding block according to the reference weight; the processing unit 1808 is configured to perform weighted prediction according to the weight matrix to obtain the predicted value corresponding to the coding block. In some embodiments of the present application, based on the foregoing solution, the determining unit 1804 is configured to: determine whether the coding block allows adaptive derivation of reference weights according to at least one of the following parameters included in the bitstream information: the sequence header flag bit included in the sequence header information, the picture header flag bit included in the picture header information, the slice header flag bit included in the slice header information, the type of the picture frame; Among them, the sequence header flag bit is used to indicate whether the current sequence allows adaptive derivation of reference weights; the picture header flag bit is used to indicate whether the current picture allows adaptive derivation of reference weights; the slice header flag bit is used to indicate whether the current slice allows adaptive derivation of reference weights. In some embodiments of the present application, based on the foregoing solution, the determining unit 1804 is configured to: determine whether the coding block allows adaptive derivation of reference weights according to at least one flag bit included in the bitstream information; where when the at least one flag bit is a first value, it indicates that the coding block allows adaptive derivation of reference weights; when the at least one flag bit is other values, it indicates that the coding block determines the reference weight in the following manner: using a specified reference weight, using a specified reference weight derivation function, or using specified function parameters. In some embodiments of the present application, based on the foregoing solution, the determining unit 1804 is configured to: determine the reference weight derivation method of the coding block according to the explicit index information in the bitstream information; or determine the reference weight derivation method of the coding block according to the information determined by an implicit method and the explicit index information in the bitstream information, where the information determined by the implicit method is the information determined according to the bitstream information; or determine the reference weight derivation method of the coding block according to the bitstream information, by an implicit method and the explicit index information in the bitstream information. In some embodiments of the present application, based on the foregoing solution, the determining unit 1804 determines the reference weight derivation method of the coding block according to the explicit index information in the bitstream information, including: determining the reference weight derivation method of the coding block according to the value of the block-level index information obtained by decoding. In some embodiments of the present application, based on the foregoing solution, the block-level index information includes a function information index, a reference weight position index, and a prediction angle index; or the block-level index information includes a function information index and a prediction mode index, where the prediction mode index is used to indicate the angular weighted prediction mode adopted by the coding block and is used to calculate the reference weight position index and the prediction angle index; or the block-level index information includes a hybrid mode index, where the hybrid mode index is used to calculate the function information index, the reference weight position index, and the prediction angle index; wherein, the function information index is used to indicate the reference weight derivation function used by the coding block, the reference weight position index is used to indicate the position of the reference weight mixing region, and the prediction angle index is used to indicate the weight prediction angle of the coding block. In some embodiments of the present application, based on the foregoing solution, the block-level index information includes a first flag bit for indicating the reference weight derivation method; the determining unit 1804 is configured to: determine the reference weight derivation function adopted by the coding block according to the value of the first flag bit, where different values of the first flag bit correspond to different reference weight derivation functions. In some embodiments of the present application, based on the foregoing solution, the block-level index information includes a second flag bit for indicating the reference weight derivation method; the determining unit 1804 is configured to: determine the weight array used to derive the reference weight according to the value of the second flag bit, where the weight array includes a plurality of set reference weight values; different values of the second flag bit correspond to different weight arrays; wherein, the weight array is used to select a corresponding reference weight value from the reference weight samples to the mixing region as the reference weight of the coding block. In some embodiments of the present application, based on the foregoing solution, the block-level index information includes a third flag bit for indicating the reference weight derivation method; the determining unit 1804 is configured to: determine a distance transformation amount according to the value of the third flag bit, where the distance transformation amount is used to transform the distance from the reference weight sample to the mixing region to obtain a transformed distance value; different values of the third flag bit correspond to different distance transformation amounts; wherein, the transformed distance value is used to select a corresponding reference weight value from the set weight array as the reference weight of the coding block, and the weight array includes a plurality of set reference weight values. In some embodiments of the present application, based on the foregoing solution, the block-level index information includes a fourth flag bit for indicating a reference weight derivation method; the determination unit 1804 is configured to: according to the value of the fourth flag bit, determine the function parameters used by the coding block when using a specified reference weight derivation function, where different values of the fourth flag bit correspond to different function parameters. In some embodiments of the present application, based on the foregoing solution, the calculation unit 1806 is configured to: according to the reference weight derivation method, calculate the reference weight corresponding to the coding block based on the distance from the reference weight sample point to the mixing region; where the distance from the reference weight sample point to the mixing region is the distance from the reference weight sample point to the center of the mixing region, or the distance from the reference weight sample point to the mixing region is the distance from the reference weight sample point to the starting point of the mixing region. In some embodiments of the present application, based on the foregoing solution, the block-level index information in the bitstream information includes a fifth flag bit; the value of the fifth flag bit is used to indicate a distance offset, and the distance offset is used to adjust the distance from the reference weight sample point to the mixing region; where different values of the fifth flag bit correspond to different distance offsets. In some embodiments of the present application, based on the foregoing solution, the reference weight corresponding to the coding block is: the weight obtained by rounding the weight calculated according to the reference weight derivation method according to a specified rounding method; where the specified rounding method includes one of rounding, ceiling, and floor. In some embodiments of the present application, based on the foregoing solution, the reference weight corresponding to the coding block is: the weight obtained by quantizing the weight calculated according to the reference weight derivation method; where different reference weight derivation methods correspond to different quantization intervals. In some embodiments of the present application, based on the foregoing solution, the reference weight corresponding to the coding block is: the weight obtained by clipping the weight calculated according to the reference weight derivation method according to a set maximum reference weight and a minimum reference weight, and the clipping process is used to limit the reference weight between the maximum reference weight and the minimum reference weight. In some embodiments of the present application, based on the foregoing solution, the calculation unit 1806 is configured to: if the distance from the reference weight sample point in the coding block to the mixing region is between a set minimum distance and a set maximum distance, then calculate the reference weight of the coding block according to the reference weight derivation method; where if the distance from the reference weight sample point to the mixing region is less than the minimum distance, the reference weight is set to the minimum reference weight; if the distance from the reference weight sample point to the mixing region is greater than the maximum distance, the reference weight is set to the maximum reference weight. In some embodiments of the present application, based on the foregoing solutions, different reference weight derivation methods correspond to different minimum distances and maximum distances. In some embodiments of the present application, based on the foregoing solutions, the determining unit 1804 determines the reference weight derivation method of the coding block according to the information determined in an implicit manner and the explicit index information in the bitstream information, including: If it is determined according to the bitstream information that the coding block adopts an angular weighted prediction mode, it is determined that the coding block uses a set first reference weight derivation method; if it is determined according to the bitstream information that the coding block adopts a spatial angular weighted prediction mode, it is determined that the coding block uses a set second reference weight derivation method; or If it is determined according to the bitstream information that the coding block is a coding block of a set size, it is determined that the coding block uses a set of reference weight derivation methods; or According to the size of the coding block included in the bitstream information, determine the set of reference weight derivation methods used by the coding block, where different sizes of coding blocks use different reference weight derivation methods; or According to the block-level information in the bitstream information, calculate the costs corresponding to various set reference weight derivation methods used by the coding block, and use the reference weight derivation method with the minimum corresponding cost as the reference weight derivation method used by the coding block; or According to the block-level information in the bitstream information, calculate the costs corresponding to multiple set reference weight derivation functions used by the coding block, sort the multiple reference weight derivation methods according to the costs, and select the weight derivation method ranked in a set order as the reference weight derivation method used by the coding block. In some embodiments of the present application, based on the foregoing solutions, the reference weight derivation method of the coding block includes the reference weight derivation method used by the luminance component of the coding block and the reference weight derivation method used by the chrominance component of the coding block, and the reference weight derivation method used by the luminance component of the coding block is different from that of the chrominance component of the coding block. In some embodiments of the present application, based on the foregoing solutions, the determining unit 1804 determines the reference weight derivation method of the coding block according to the bitstream information, in an implicit manner and the explicit index information in the bitstream information, including: determining the allowed reference weight derivation methods in an implicit manner according to the bitstream information; and selecting the reference weight derivation method of the coding block from the allowed reference weight derivation methods according to the explicit index information in the bitstream information. FIG. 19 shows a block diagram of a video encoding apparatus according to an embodiment of the present application. The video encoding apparatus may be disposed in a device having a computing and processing function, such as a terminal device or a server. As shown in FIG. 19, a video encoding apparatus 1900 according to an embodiment of the present application includes: a processing unit 1902, a computing unit 1904, a determining unit 1906, and an encoding unit 1908. Among them, the processing unit 1902 is configured to determine a reference weight derivation method used for the block to be encoded if the block to be encoded using the weighted prediction mode allows adaptive derivation of the reference weight; the computing unit 1904 is configured to calculate a reference weight corresponding to the block to be encoded according to the reference weight derivation method; the determining unit 1906 is configured to determine a weight matrix corresponding to the block to be encoded according to the reference weight; the encoding unit 1908 is configured to perform weighted prediction according to the weight matrix to obtain a predicted value corresponding to the block to be encoded, and perform encoding processing on the block to be encoded according to the predicted value. FIG. 20 shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. The electronic device may be the video decoding apparatus or the video encoding apparatus in the foregoing embodiments. It should be noted that the computer system 2000 of the electronic device shown in FIG. 20 is only an example, and should not bring any limitation to the functions and usage scopes of the embodiments of the present application. As shown in FIG. 20, the computer system 2000 may include a central processing unit (CPU) 2001, which may execute various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2002 or a program loaded from a storage section 2008 into a random access memory (RAM) 2003, such as executing the method described in the foregoing embodiments. In the RAM 2003, various programs and data required for system operation are also stored. The CPU 2001, the ROM 2002, and the RAM 2003 are connected to each other through a bus 2004. An input / output (I / O) interface 2005 is also connected to the bus 2004. The following components can be connected to the I / O interface 2005: an input section 2006 including a keyboard, a mouse, etc.; an output section 2007 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 2008 including a hard disk, etc.; and a communication section 2009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 2009 performs communication processing via a network such as the Internet. A drive 2010 is also connected to the I / O interface 2005 as required. A removable medium 2011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 2010 as required so that a computer program read therefrom can be installed into the storage section 2008 as required. Specifically, according to an embodiment of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product including a computer program carried on a computer-readable medium, and the computer program is used to execute the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 2009, and / or installed from the removable medium 2011. When the computer program is executed by a central processing unit (CPU) 2001, various functions defined in the system of the present application are executed. On the other hand, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist separately without being assembled into the electronic device. The above computer-readable medium carries one or more computer programs, and when the above one or more computer programs are executed by an electronic device, the electronic device implements the method described in the above embodiment. It should be noted that although several modules or units of devices for action execution are mentioned in the above detailed description, such a division is not mandatory. In fact, according to an embodiment of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units. From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable an electronic device to execute the method according to the embodiments of the present application. For example, if the electronic device is a video decoding device, then the video decoding device can execute the video decoding method shown in FIG. 13; again, if the electronic device is a video encoding device, then the video encoding device can execute the video encoding method shown in FIG. 14. After considering the specification and practicing the disclosed embodiments herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application. It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A video decoding method, executed by a processor, characterized in that: include: Decode the video code stream to obtain code stream information; If the coding block using the weighted prediction mode allows adaptive derivation of the reference weight, determining a reference weight derivation method for the coding block according to the bitstream information; Calculating a reference weight corresponding to the coding block according to the reference weight derivation method, and determining a weight matrix corresponding to the coding block according to the reference weight; A weighted prediction is performed according to the weight matrix to obtain a prediction value corresponding to the coding block.

2. The video decoding method according to claim 1, characterized in that: Before determining the reference weight derivation method of the coding block according to the bitstream information, the method further includes: Determine whether the coding block allows adaptive derivation of reference weights according to at least one of the following parameters included in the code stream information: The sequence header flag contained in the sequence header information, the image header flag contained in the image header information, the slice header flag contained in the slice header information, and the type of the image frame; Among them, the sequence header flag is used to indicate whether the current sequence allows adaptive derivation of reference weights; the image header flag is used to indicate whether the current image allows adaptive derivation of reference weights; and the slice header flag is used to indicate whether the current slice allows adaptive derivation of reference weights.

3. The video decoding method according to claim 1, characterized in that: Before determining the reference weight derivation method of the coding block according to the bitstream information, the method further includes: Determining whether the coding block allows adaptive derivation of reference weights according to at least one flag bit included in the bitstream information; Wherein, when the at least one flag bit is a first value, it indicates that the coding block allows adaptive derivation of reference weights; When the at least one flag bit is other values, it indicates that the coding block determines the reference weight in the following manner: using a specified reference weight, using a specified reference weight to derive a function, or using a specified function parameter.

4. The video decoding method according to any one of claims 1 to 3, characterized in that: The method of deriving the reference weight of the coding block according to the bitstream information includes: Determining a reference weight derivation method for the coding block according to explicit index information in the bitstream information; or Determining a reference weight derivation method of the coding block in an implicit manner according to the bitstream information; or A reference weight derivation method for the coding block is determined according to information determined in an implicit manner and explicit index information in the code stream information, wherein the information determined in an implicit manner is information determined according to the code stream information.

5. The video decoding method according to claim 4, characterized in that: The determining, according to the explicit index information in the bitstream information, a reference weight derivation method of the coding block includes: A reference weight derivation method for the coding block is determined according to the value of the block-level index information in the code stream information.

6. The video decoding method according to claim 5, characterized in that: The block-level index information includes a function information index, a reference weight position index, and a prediction angle index; or The block-level index information includes a function information index and a prediction mode index, wherein the prediction mode index is used to indicate an angle-weighted prediction mode adopted by the coding block and is used to calculate a reference weight position index and a prediction angle index; or The block-level index information includes a hybrid mode index, and the hybrid mode index is used to calculate a function information index, a reference weight position index, and a prediction angle index; Among them, the function information index is used to indicate the reference weight derivation function used by the coding block, the reference weight position index is used to indicate the position of the reference weight mixing area, and the prediction angle index is used to indicate the weight prediction angle of the coding block.

7. The video decoding method according to claim 5 or 6, characterized in that: The block-level index information includes a first flag bit for indicating a reference weight derivation method; Determining a reference weight derivation method for the coding block according to a value of the block-level index information obtained by decoding, including: A reference weight derivation function used by the coding block is determined according to the value of the first flag bit, wherein different values ​​of the first flag bit correspond to different reference weight derivation functions.

8. The video decoding method according to any one of claims 5 to 7, characterized in that: The block-level index information includes a second flag bit for indicating a reference weight derivation method; Determining a reference weight derivation method for the coding block according to a value of the block-level index information obtained by decoding, including: Determine, according to the value of the second flag, a weight array used for deriving a reference weight, wherein the weight array includes a plurality of set reference weight values; different values ​​of the second flag correspond to different weight arrays; The weight array is used to select a corresponding reference weight value as the reference weight of the coding block according to the distance from the reference weight sample point to the mixed area.

9. The video decoding method according to any one of claims 5 to 8, characterized in that: The block-level index information includes a third flag bit for indicating a reference weight derivation method; Determining a reference weight derivation method for the coding block according to a value of the block-level index information obtained by decoding, including: Determine a distance transformation amount according to the value of the third flag, wherein the distance transformation amount is used to transform the distance from the reference weight sample point to the mixed area to obtain a transformed distance value; different values ​​of the third flag bit correspond to different distance transformation amounts; The transformed distance value is used to select a corresponding reference weight value from a set weight array as a reference weight of the coding block, and the weight array includes a plurality of set reference weight values.

10. The video decoding method according to any one of claims 5 to 9, characterized in that: The block-level index information includes a fourth flag bit for indicating a reference weight derivation method; Determining a reference weight derivation method for the coding block according to a value of the block-level index information obtained by decoding, including: According to the value of the fourth flag bit, the function parameters adopted by the coding block when using the specified reference weight to derive the function are determined, wherein different values ​​of the fourth flag bit correspond to different function parameters.

11. The video decoding method according to claim 4, characterized in that: The step of determining the reference weight derivation method of the coding block in an implicit manner according to the bitstream information includes: If it is determined according to the bitstream information that the coding block adopts the angle weighted prediction mode, then the coding block is determined to use the set first reference weight derivation method; if it is determined according to the bitstream information that the coding block adopts the spatial angle weighted prediction mode, then the coding block is determined to use the set second reference weight derivation method; or If it is determined according to the bitstream information that the coding block is a coding block of a set size, then determining that the coding block uses a set reference weight derivation method set; or Determine, according to the size of the coding block included in the bitstream information, a reference weight derivation method set used by the coding block, wherein coding blocks of different sizes use different reference weight derivation methods; or Calculate, according to the block-level information in the bitstream information, the costs corresponding to the various reference weight derivation methods set for the coding block, and use the reference weight derivation method with the smallest corresponding cost as the reference weight derivation method used by the coding block; or According to the block-level information in the code stream information, the costs corresponding to the multiple reference weight derivation functions set for the coding block are calculated, the multiple reference weight derivation methods are sorted according to the costs, and the weight derivation method ranked in the set order is selected as the reference weight derivation method used by the coding block.

12. The video decoding method according to claim 4, characterized in that: The determining, according to the information determined in an implicit manner and the explicit index information in the bitstream information, a reference weight derivation method of the coding block includes: Determining, according to the bitstream information, an allowable reference weight derivation method in an implicit manner; A reference weight derivation method for the coding block is selected from the allowed reference weight derivation methods according to the explicit index information.

13. The method according to any one of claims 1 to 12, characterized in that The reference weight derivation method of the coding block includes a reference weight derivation method adopted by the brightness component of the coding block and a reference weight derivation method adopted by the chrominance component of the coding block. The reference weight derivation method adopted by the brightness component of the coding block is different from the reference weight derivation method adopted by the chrominance component of the coding block.

14. The video decoding method according to any one of claims 1 to 13, characterized in that: The calculating the reference weight corresponding to the coding block according to the reference weight derivation method includes: According to the reference weight derivation method, a reference weight corresponding to the coding block is calculated based on the distance from the reference weight sample point to the mixed area; The distance from the reference weight sample point to the mixed area is the distance from the reference weight sample point to the center of the mixed area, or the distance from the reference weight sample point to the mixed area is the distance from the reference weight sample point to the starting point of the mixed area.

15. The video decoding method according to claim 14, characterized in that: The block-level index information in the bitstream information includes a fifth flag bit; the value of the fifth flag bit is used to indicate a distance offset, and the distance offset is used to adjust the distance from the reference weight sample point to the mixed area; Among them, different values ​​of the fifth flag bit correspond to different distance offsets.

16. The video decoding method according to any one of claims 1 to 13, characterized in that: Calculating the reference weight corresponding to the coding block according to the reference weight derivation method includes: If the distance from the reference weight sample in the coding block to the mixed area is between the set minimum distance value and the set maximum distance value, the reference weight of the coding block is calculated according to the reference weight derivation method; Wherein, if the distance from the reference weight sample point to the mixed area is less than the minimum distance value, the reference weight is set to the minimum reference weight value; If the distance from the reference weight sample point to the mixed area is greater than the maximum distance, the reference weight is set to the maximum reference weight.

17. The video decoding method according to claim 16, characterized in that: Different reference weight derivation methods correspond to different minimum distance values ​​and maximum distance values.

18. The video decoding method according to any one of claims 1 to 17, characterized in that: The reference weight corresponding to the coding block is: The weight calculated according to the reference weight derivation method is rounded according to a specified rounding method to obtain a weight; wherein the specified rounding method includes one of rounding off, rounding up, and rounding down.

19. The video decoding method according to any one of claims 1 to 17, characterized in that: The reference weight corresponding to the coding block is: The weights obtained by quantizing the weights calculated according to the reference weight derivation method; wherein different reference weight derivation methods correspond to different quantization intervals.

20. The video decoding method according to any one of claims 1 to 17, characterized in that: The reference weight corresponding to the coding block is: The weight calculated according to the reference weight derivation method is clipped according to the set reference weight maximum value and reference weight minimum value, and the clipping process is used to limit the reference weight between the reference weight maximum value and the reference weight minimum value.

21. A video encoding method, executed by a processor, characterized in that: include: If the block to be encoded using the weighted prediction mode allows adaptive derivation of reference weights, determining a reference weight derivation method used by the block to be encoded; Calculate the reference weight corresponding to the block to be encoded according to the reference weight derivation method; Determine a weight matrix corresponding to the block to be encoded according to the reference weight; A weighted prediction is performed according to the weight matrix to obtain a prediction value corresponding to the block to be encoded, and encoding processing is performed on the block to be encoded according to the prediction value.

22. A video decoding device, characterized in that: include: A decoding unit, configured to decode the video code stream to obtain code stream information; a determining unit configured to determine a reference weight derivation method for the coding block according to the bitstream information if the coding block adopting the weighted prediction mode allows adaptive derivation of the reference weight; A calculation unit, configured to calculate the reference weight corresponding to the coding block according to the reference weight derivation method, and determine the weight matrix corresponding to the coding block according to the reference weight; The processing unit is configured to perform weighted prediction according to the weight matrix to obtain a prediction value corresponding to the coding block.

23. A video encoding device, characterized in that: include: A processing unit configured to determine a reference weight derivation method used by the block to be encoded if the block to be encoded in the weighted prediction mode allows adaptive derivation of reference weights; A calculation unit, configured to calculate the reference weight corresponding to the to-be-encoded block according to the reference weight derivation method; A determination unit, configured to determine a weight matrix corresponding to the to-be-encoded block according to the reference weight; The encoding unit is configured to perform weighted prediction according to the weight matrix to obtain a prediction value corresponding to the block to be encoded, and perform encoding processing on the block to be encoded according to the prediction value.

24. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the video decoding method according to any one of claims 1 to 20 or the video encoding method according to claim 21 is implemented.

25. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more computer programs, which, when executed by the one or more processors, enables the electronic device to implement the video decoding method described in any one of claims 1 to 20, or the video encoding method described in claim 21.

26. A method for processing a code stream, characterized in that: A video code stream is stored on a non-transitory computer-readable medium, wherein the video code stream is decoded based on the video decoding method according to any one of claims 1 to 20, or generated according to the video encoding method according to claim 21.

Citation Information

Patent Citations

  • Encoding and decoding method, device and equipment

    CN112543323A

  • Coding and decoding method, device and equipment

    CN113794878A

  • Video coding method and device, video decoding method and device, electronic equipment and storage medium

    CN115695812A

  • Intra prediction method, encoder, decoder, and storage medium

    CN116980594A

  • Video encoder, video decoder, video encoding method, video decoding method

    US20210185352A1