Video coding and decoding method and device, computer readable medium and electronic equipment

By adaptively selecting the reference weight export function based on the code stream information, 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.

CN119496890APending Publication Date: 2025-02-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311051402.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-20
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In the prior art, a fixed linear function is 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

The reference weight derived function used by the code stream information obtained by decoding is determined, so that the code block can adaptively select the appropriate weight derived function, thereby deriveing ​​a more accurate weight matrix.

Benefits of technology

The encoding and decoding performance is improved, so that more accurate weight matrix can be derived for different encoding blocks, thereby improving the efficiency of encoding and decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496890A_ABST
    Figure CN119496890A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video encoding and decoding method and device, a computer readable medium and electronic equipment. The video decoding method comprises the following steps: decoding a video code stream, and determining a reference weight derivation function used by a coding block adopting a weighted prediction mode according to code stream information obtained by decoding; calculating a reference weight corresponding to the coding block according to the reference weight derivation function; determining a weight matrix corresponding to the coding block according to the reference weight; and performing weighted prediction according to the weight matrix to obtain a predicted value corresponding to the coding block. According to the technical scheme provided by the embodiment of the invention, the coding block can adaptively select the reference weight derivation function, and indication is carried out through the code stream information, so that a more accurate weight matrix can be derived for different coding blocks, and the coding and decoding performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer and communication technology, and in particular to a video encoding and decoding method, device, computer-readable medium and electronic device. Background Art

[0002] In relevant audio and video standards (such as the second stage of AVS3), Angular Weighted Prediction AWP (Angular Weighted Prediction) technology and SAWP (Spatial Angular Weighted Prediction) technology are used. These prediction technologies use weight masks to weight two prediction blocks to achieve the combination of different parts of the prediction blocks. These prediction technologies can be closer to the boundaries of different objects or the boundaries of different motion areas than block division, so they can effectively improve compression performance. In order to enable pixel values ​​to change smoothly at the boundary of the prediction block combination, the weight matrix of these prediction technologies has a transition zone (i.e., a mixed area) near the division boundary. In the related technology, the weights in this transition zone are derived according to a fixed linear function, but the use of 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

[0003] The embodiments of the present application provide a video encoding and decoding method, device, computer-readable medium and electronic device, so that the coding block can adaptively select a reference weight derivation function and indicate it through 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.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a video decoding method is provided, including: decoding a video bitstream, determining a reference weight derivation function used by a coding block adopting a weighted prediction mode according to the bitstream information obtained by decoding; calculating a reference weight corresponding to the coding block according to the reference weight derivation function; determining a weight matrix corresponding to the coding block according to the reference weight; and performing weighted prediction according to the weight matrix to obtain a prediction value corresponding to the coding block.

[0006] According to one aspect of an embodiment of the present application, a video encoding method is provided, including: determining a reference weight derivation function used by a block to be encoded in a weighted prediction mode; calculating a reference weight corresponding to the block to be encoded according to the reference weight derivation function; determining a weight matrix corresponding to the block to be encoded according to the reference weight; performing weighted prediction according to the weight matrix to obtain a prediction value corresponding to the block to be encoded, and encoding the block to be encoded according to the prediction value.

[0007] According to one aspect of an embodiment of the present application, a video decoding device is provided, including: a decoding unit, configured to decode a video code stream, and determine a reference weight derivation function used by a coding block adopting a weighted prediction mode according to the decoded code stream information; a calculation unit, configured to calculate a reference weight corresponding to the coding block according to the reference weight derivation function; a determination unit, configured to determine a weight matrix corresponding to the coding block according to the reference weight; and a processing unit, configured to perform weighted prediction according to the weight matrix to obtain a prediction value corresponding to the coding block.

[0008] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit is configured to determine the reference weight derivation function used by the coding block using the weighted prediction mode according to at least one of the following methods: determining the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding; determining the reference weight derivation function used by the coding block using the weighted prediction mode in an implicit manner according to the bit stream information obtained by decoding.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current sequence according to the value of the sequence weight index information contained in the sequence header information obtained by decoding.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the sequence header information also includes a sequence weight flag, and the sequence weight flag is used to indicate whether the current sequence allows the selection of a reference weight derivation function; if the sequence weight flag indicates that the current sequence allows the selection of a reference weight derivation function, the sequence weight index information is decoded from the video bitstream.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the sequence header information also includes function parameter index information; the function parameter index information 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.

[0012] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current image according to the value of the image weight index information contained in the decoded image header information.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the image header information also includes an image weight flag, and the image weight flag is used to indicate whether the current image allows the selection of a reference weight derivation function; if the image weight flag indicates that the current image allows the selection of a reference weight derivation function, the image weight index information is decoded from the video code stream.

[0014] In some embodiments of the present application, based on the aforementioned scheme, the image header information also includes function parameter index information; the function parameter index information 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.

[0015] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current slice according to the value of the slice weight index information contained in the slice header information obtained by decoding.

[0016] In some embodiments of the present application, based on the aforementioned scheme, the slice header information also includes a slice weight flag, and the slice weight flag is used to indicate whether the current slice allows the selection of a reference weight derivation function; if the slice weight flag indicates that the current slice allows the selection of a reference weight derivation function, the slice weight index information is decoded from the video bitstream.

[0017] In some embodiments of the present application, based on the aforementioned scheme, the header information also includes function parameter index information; the function parameter index information 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.

[0018] In some embodiments of the present application, based on the above-mentioned solution, the decoding unit determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including:

[0019] Determining a reference weight derivation function used by a coding block adopting an angle weighted prediction mode according to the explicit index information obtained by decoding; or

[0020] Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a spatial angular weighted prediction mode; or

[0021] Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting an angle weighted prediction mode and a coding block adopting a spatial angle weighted prediction mode; or

[0022] The reference weight derivation function used by the coding block adopting the angle weighted prediction mode and the reference weight derivation function used by the coding block adopting the spatial angle weighted prediction mode are determined according to the explicit index information obtained by decoding.

[0023] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block adopting the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block according to the value of the reference weight index information contained in the block-level information obtained by decoding.

[0024] In some embodiments of the present application, based on the aforementioned scheme, the processing unit is further configured to: if the value of the reference weight index information is first decoded from the video bitstream, determine the maximum available weight mode number of the weighted prediction mode adopted by the coding block according to the value of the reference weight index information; or

[0025] If the weight mode number of the weighted prediction mode adopted by the coding block is first decoded from the video bitstream, then the maximum number of available reference weight derivation functions is determined according to the weight mode number;

[0026] The weight mode number is represented by at least one of weight position index information and weight angle index information.

[0027] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block adopting the weighted prediction mode according to the explicit index information obtained by decoding, including: calculating the costs corresponding to the use of multiple reference weight derivation functions set by the coding block according to the block-level information obtained by decoding, sorting the multiple reference weight derivation functions according to the costs to obtain a reference weight derivation function list; and selecting the reference weight derivation function used by the coding block from the reference weight derivation function list according to the order index information contained in the block-level information.

[0028] In some embodiments of the present application, based on the aforementioned scheme, the processing unit is further configured to: determine the weight mode number of the weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate the value of the reference weight index information according to the weight mode number, and determine the function parameters of the reference weight derivation function used by the coding block according to the value of the reference weight index information; or determine the function parameters of the reference weight derivation function used by the coding block according to the value of the reference weight index information contained in the block-level information obtained by decoding.

[0029] In some embodiments of the present application, based on the aforementioned scheme, the decoded bitstream information also includes mixed area length index information, and the mixed area length index information is used to indicate the length of the mixed area to which the reference weight derivation function is applicable; or according to the decoded bitstream information, the length of the mixed area to which the reference weight derivation function is applicable is determined in an implicit manner; wherein, the reference weight derivation functions used for mixed areas of different lengths are the same or different; and the function parameters of the reference weight derivation functions used for mixed areas of different lengths are the same or different.

[0030] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit determines the reference weight derivation function used by the coding block adopting the weighted prediction mode in an implicit manner according to the decoded bit stream information, including: if it is determined according to the decoded bit stream information that the coding block adopts the angle weighted prediction mode, then it is determined that the coding block uses the set first reference weight derivation function; if it is determined according to the decoded bit stream information that the coding block adopts the spatial angle weighted prediction mode, then it is determined that the coding block uses the set second reference weight derivation function.

[0031] In some embodiments of the present application, based on the above-mentioned solution, the decoding unit determines the reference weight derivation function used by the coding block using the weighted prediction mode in an implicit manner according to the decoded bitstream information, including:

[0032] Determine a weight mode number of a weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate a value of reference weight index information according to the weight mode number, and determine a reference weight derivation function set used by the coding block according to the value of the reference weight index information; or

[0033] If it is determined according to the decoded 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 function set; or

[0034] Determining, according to the size of the coding block contained in the decoded bitstream information, a reference weight derivation function set used by the coding block, wherein coding blocks of different sizes use different reference weight derivation functions; or

[0035] Calculate, according to the decoded block-level information, the costs corresponding to the use of various reference weight derivation functions set for the coding block, and use the reference weight derivation function with the minimum corresponding cost as the reference weight derivation function used by the coding block; or

[0036] According to the block-level information obtained by decoding, the costs corresponding to the multiple reference weight derivation functions used by the coding block are calculated, the multiple reference weight derivation functions are sorted according to the costs, and the weight derivation function ranked in the set order is selected as the reference weight derivation function used by the coding block.

[0037] In some embodiments of the present application, based on the aforementioned scheme, the determination unit is configured to: calculate a weight matrix corresponding to the coding block according to the reference weight and the weight prediction angle used by the coding block; or

[0038] According to the reference weight and the prediction angle used by the coding block, a candidate weight matrix corresponding to the coding block is calculated, and the candidate weight matrix is ​​mapped according to a set weight mapping table to obtain a weight matrix corresponding to the coding block.

[0039] In some embodiments of the present application, based on the aforementioned scheme, the reference weight derivation function is selected from the following functions: linear function, sigmoid function, hyperbolic function, trigonometric function, exponential-based function, polynomial-based function, and piecewise function.

[0040] In some embodiments of the present application, based on the aforementioned solution, the reference weight derivation function is used to indicate a mapping relationship table between a target distance and a reference weight, wherein the target distance is the distance between a sample point and a mixed boundary;

[0041] Among them, the mapping relationship between the target distance and the reference weight is stored in the mapping relationship table; the reference weight in the mapping relationship table is generated according to the target distance and a preset function, or the reference weight in the mapping relationship table is generated according to the target distance and a preset function and then adjusted.

[0042] According to one aspect of an embodiment of the present application, a video encoding device is provided, including: a processing unit, configured to determine a reference weight derivation function used by a block to be encoded in a weighted prediction mode; a calculation unit, configured to calculate a reference weight corresponding to the block to be encoded according to the reference weight derivation function; a determination unit, configured to determine a weight matrix corresponding to the block to be encoded according to the reference weight; and an encoding unit, 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.

[0043] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the above embodiment is implemented.

[0044] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more computer programs, wherein 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.

[0045] According to one aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising 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 optional embodiments.

[0046] In the technical solutions provided in some embodiments of the present application, a reference weight derivation function used by a coding block adopting a weighted prediction mode is determined according to the decoded bitstream information, and then a reference weight corresponding to the coding block is calculated according to the reference weight derivation function, and a weight matrix corresponding to the coding block is determined according to the reference weight, and weighted prediction is performed according to the determined weight matrix to obtain a prediction value corresponding to the coding block, so that the coding block can adaptively select the reference weight derivation function and indicate it through 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.

[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0049] Figure 2A schematic diagram showing the placement of a video encoding device and a video decoding device in a streaming transmission system;

[0050] Figure 3 shows a basic flow chart of a video encoder;

[0051] Figure 4 A block division structure schematic diagram in the HEVC standard is shown;

[0052] Figure 5 A schematic diagram of a block partition structure in the AVS3 standard is shown;

[0053] Figure 6 A schematic diagram of the angular prediction direction in the intra-frame prediction mode is shown;

[0054] Figure 7 A schematic diagram of intra-frame prediction is shown;

[0055] Figure 8 A schematic diagram of inter-frame prediction is shown;

[0056] Fig. 9 A schematic diagram of the prediction process of the AWP mode is shown;

[0057] Fig.10 A schematic diagram showing 8 weight generation angles;

[0058] Fig.11 A schematic diagram showing 7 reference weight prediction positions;

[0059] Fig.12 A schematic diagram of angle partitioning of an angle weighted prediction mode is shown;

[0060] Fig.13 A flowchart of a video decoding method according to an embodiment of the present application is shown;

[0061] Fig.14 A flowchart of a video encoding method according to an embodiment of the present application is shown;

[0062] Fig.15 A schematic diagram of an image showing a reference weight derivation function in the form of a sigmoid function according to an embodiment of the present application;

[0063] Fig.16 A schematic diagram of an image of a reference weight derivation function based on a hyperbolic tangent function according to an embodiment of the present application is shown;

[0064] Fig.17 A schematic diagram of an image showing a reference weight derivation function based on a cosine function according to an embodiment of the present application is shown;

[0065] Fig.18 A block diagram of a video decoding device according to an embodiment of the present application is shown;

[0066] Fig.19 A block diagram of a video encoding device according to an embodiment of the present application is shown;

[0067] Fig. 20 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0068] The exemplary embodiments are now described in a more comprehensive manner with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be understood as being limited to these examples; on the contrary, the purpose of providing these embodiments is to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.

[0069] In addition, the features, structures or characteristics described in the present application may be combined in one or more embodiments in any suitable manner. In the following description, there are many specific details so that the embodiments of the present application can be fully understood. However, those skilled in the art will appreciate that when implementing the technical scheme of the present application, all the detailed features in the embodiments may not be needed, one or more specific details may be omitted, or other methods, elements, devices, steps, etc. may be adopted.

[0070] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0071] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0072] It should be noted that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0073] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0074] like Figure 1 As shown, the system architecture 100 includes a plurality of terminal devices, which 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. Figure 1 In the embodiment of the present invention, the first terminal device 110 and the second terminal device 120 perform unidirectional data transmission.

[0075] For example, the first terminal device 110 may encode video data (e.g., a video picture stream captured by the terminal device 110) for transmission to the second terminal device 120 via the network 150. The encoded video data is transmitted in the form of one or more encoded video code streams. The second terminal device 120 may receive the encoded video data from the network 150, decode the encoded video data to restore the video data, and display the video picture based on the restored video data.

[0076] In one 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, which may occur during a video conference, for example. For bidirectional data transmission, each of the third terminal device 130 and the fourth terminal device 140 may encode video data (e.g., a video picture stream collected by the terminal device) to transmit to the other terminal device 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 may also receive the encoded video data transmitted by the other terminal device of the third terminal device 130 and the fourth terminal device 140, and may decode the encoded video data to restore the video data, and may display the video picture on an accessible display device according to the restored video data.

[0077] exist Figure 1 In the illustrated embodiment, 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 the present application may not be limited thereto.

[0078] The server can be an independent physical server, or a server cluster or 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 can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart voice interaction device, smart watch, smart home appliance, vehicle terminal, aircraft, etc., but is not limited to these.

[0079] Figure 1 The network 150 shown in the figure represents any number of networks for transmitting the 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 can exchange data in a circuit switching and / or packet switching channel. 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 explained below, the architecture and topology of the network 150 may be irrelevant to the operation disclosed in this application.

[0080] In one embodiment of the present application, Figure 2 The placement of the video encoding device and the video decoding device in the streaming environment is shown. The subject matter disclosed in the present application can be equally applicable to other video-supported applications, including, for example, video conferencing, digital TV (television), storing compressed video on digital media including CD, DVD, memory stick, etc.

[0081] The streaming system may include an acquisition subsystem 213, which may include a video source 201 such as a digital camera, which creates an uncompressed video picture stream 202. In an embodiment, the video picture stream 202 includes samples taken by a digital camera. The video picture stream 202 is depicted as a thick line to emphasize the high data volume of the video picture stream compared to the encoded video data 204 (or the encoded video code stream 204), and the video picture stream 202 can be processed by an electronic device 220, which 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 implement various aspects of the disclosed subject matter as described in more detail below. Compared to the video picture stream 202, the encoded video data 204 (or the encoded video code stream 204) is depicted as a thin line to emphasize the lower data volume of the encoded video data 204 (or the encoded video code stream 204), which can be stored on the streaming server 205 for future use. One or more streaming client subsystems, such as Figure 2 , can access the streaming server 205 to retrieve the 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 (e.g., a display screen) or another presentation device. In some streaming systems, the encoded video data 204, the video data 207, and the video data 209 (e.g., video bitstreams) can be encoded according to certain video encoding / compression standards.

[0082] 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.

[0083] In one embodiment of the present application, taking the international video coding standards HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding), and China's national video coding standard AVS as examples, after a video frame image is input, the video frame image will be divided into several non-overlapping processing units according to a block size, and each processing unit will perform similar compression operations. This processing unit is called CTU (Coding Tree Unit), or LCU (Largest Coding Unit). CTU can continue to be divided more finely to obtain one or more basic coding units CU (Coding Unit), which is the most basic element in a coding link.

[0084] In another embodiment, this processing unit may also be referred to as a coding tile, which is a rectangular area of ​​a multimedia data frame that can be independently decoded and encoded. In the AV1 standard, the coding tile can be further divided into more refined parts to obtain one or more maximum coding blocks (Superblock, SB for short). SB is the starting point of block division and can be further divided into multiple sub-blocks. Then the maximum coding block is further divided to obtain one or more blocks. Each block is the most basic element in a coding link. Optionally, an SB can contain several Bs.

[0085] The above division method of video frame images can be called block partition structure. The following introduces some concepts in the encoding process:

[0086] Predictive Coding: Predictive coding includes intra-frame prediction and inter-frame prediction. The original video signal is predicted by the selected reconstructed video signal to obtain the residual video signal. The encoder needs to decide which predictive coding mode to select for the current coding unit (or coding block) and inform the decoder. Intra-frame prediction means that the predicted signal comes from the area that has been encoded and reconstructed in the same image; inter-frame prediction means that the predicted signal comes from other images that have been encoded and different from the current image (called reference images).

[0087] Transform & Quantization: After the residual video signal is transformed by DFT (Discrete Fourier Transform), DCT (Discrete Cosine Transform), etc., the signal is converted into the transform domain, which is called the transform coefficient. The transform coefficient is further subjected to lossy quantization operation, which loses a certain amount of information, making the quantized signal conducive to compression expression. In some video coding standards, there may be more than one transform method to choose from, so the encoder also needs to select one of the transform methods for the current coding unit (or coding block) and inform the decoder. The degree of quantization is usually determined by the quantization parameter (Quantization Parameter, referred to as QP). A larger QP value means that coefficients with a larger value range will be quantized to the same output, which usually results in greater distortion and lower bit rate; on the contrary, a smaller QP value means that coefficients with a smaller value range will be quantized to the same output, which usually results in less distortion and a higher bit rate.

[0088] Entropy Coding or Statistical Coding: The quantized transform domain signal will be statistically compressed and encoded according to the frequency of occurrence of each value, and finally output as a binary (0 or 1) compressed bit stream. At the same time, the encoding generates other information, such as the selected coding mode, motion vector data, etc., which also need 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 express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).

[0089] The CABAC process mainly includes three steps: binarization, context modeling, and binary arithmetic coding. After the input syntax elements are binarized, the binary data can be encoded through the conventional coding mode and the bypass coding mode. The bypass coding mode does not need to assign a specific probability model to each binary bit. The input binary bit bin value is directly encoded with a simple bypass encoder to speed up the entire encoding and decoding. In general, different syntax elements are not completely independent, and the same syntax element itself has a certain memory. Therefore, according to the conditional entropy theory, conditional encoding using other encoded syntax elements can further improve the encoding performance compared to independent encoding or memoryless encoding. These encoded symbol information used as conditions are called context. In the conventional coding mode, the binary bits of the syntax elements enter the context modeler sequentially. The encoder assigns a suitable probability model to each input binary bit according to the value of the previously encoded syntax element or binary bit. 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 the bin value and the assigned probability model are sent to the binary arithmetic encoder for encoding, the context model needs to be updated according to the bin value, which is the adaptive process in encoding.

[0090] Loop Filtering: The changed and quantized signal will be reconstructed through inverse quantization, inverse transformation and prediction compensation operations to obtain a reconstructed image. Compared with the original image, due to the influence of quantization, some information of the reconstructed image is different from the original image, that is, the reconstructed image will produce distortion. Therefore, the reconstructed image can be filtered, such as deblocking filter (DB), SAO (Sample Adaptive Offset) or ALF (Adaptive Loop Filter) and other filters, which can effectively reduce the degree of distortion caused by quantization. Since these filtered reconstructed images will be used as a reference for subsequent encoded images to predict future image signals, the above filtering operation is also called loop filtering, that is, filtering operation within the encoding loop.

[0091] In one embodiment of the present application, Figure 3 The basic flow chart of a video encoder is shown in FIG. 1 , in which intra-frame prediction is used as an example for explanation. In which the original image signal sk [x,y] and predicted image signal Perform difference operation to obtain the residual signal u k [x,y], residual signal u k [x,y] is transformed and quantized to obtain the quantized coefficients. The quantized coefficients are entropy coded to obtain the encoded bit stream, and the reconstructed residual signal u' is obtained through inverse quantization and inverse transformation. k [x,y], predicted image signal and reconstructed residual signal u' k [x,y] superposition generates image signal Image signal On the one hand, it is input to the intra-frame mode decision module and the intra-frame prediction module for intra-frame prediction processing, and on the other hand, the reconstructed image signal s' is output through loop filtering k [x,y], reconstructed image signal s' k [x,y] can be used as the reference image for the next frame for motion estimation and motion compensation prediction. Then based on the result of motion compensation prediction s' r [x+m x ,y+m y ] and intra prediction results Get the predicted image signal of the next frame And continue to repeat the above process until the encoding is completed.

[0092] Based on the above encoding process, at the decoding end, for each coding unit (or coding block), after obtaining the compressed code stream (i.e., bit stream), entropy decoding is performed to obtain various mode information and quantization coefficients. The quantization coefficients are then dequantized and inversely transformed to obtain a residual signal. On the other hand, based on the known coding mode information, the prediction signal corresponding to the coding unit (or coding block) can be obtained, and then the residual signal and the prediction signal are added to obtain the reconstructed signal. The reconstructed signal is then subjected to loop filtering and other operations to generate the final output signal.

[0093] The current mainstream video coding standards, such as HEVC (High Efficiency Video Coding), VVC (Versatile Video Coding), AVS3, AV1 (Alliance for OpenMedia Video 1, the first generation video coding standard developed by the Open Media Alliance), and AV2 (Alliance for OpenMedia Video 2, the second generation video coding standard developed by the Open Media Alliance), all use a block-based hybrid coding framework. Specifically, the original video data is divided into a series of coding blocks, combined with video coding methods such as prediction, transform and entropy coding to achieve video data compression.

[0094] In the hybrid coding framework based on block division, the video image is divided into several non-overlapping processing units for video compression processing. This processing unit is called CTU (Coding Tree Unit). CTU can be further divided into more refined units to obtain one or more basic coding units, called CU (Coding Unit). Each CU is the most basic element in the coding process, and each CU can choose different coding modes. Figure 4 The figure shows a block division structure diagram in the HEVC standard. A CTU can be divided downward in a 4-tree manner.

[0095] The AVS3 standard adopts the basic block partitioning structure of QT (Quad-Tree) + BT (Binary-Tree) + EQT (Extended Quad-Tree). Specifically, the QT+BT+EQT basic block partitioning structure in AVS3 is represented in the bitstream as follows: Figure 5 As shown. For a CU, first determine whether to use QT for division. If QT is used, QT division is directly performed; if QT is not used, further determine whether to not divide, if not, then end; if division is required, it is necessary to determine whether to use EQT or BT. At the same time, whether EQT or BT is used, it is necessary to determine whether to divide horizontally or vertically. Block division is a recursive division decision made from top to bottom starting from LCU. In the recursive process, the optimal division method and encoding mode are determined by the optimization of the encoding end.

[0096] Intra-frame prediction is a commonly used predictive coding technology. Intra-frame prediction is based on the correlation of pixels of video images in the spatial domain, and derives the predicted value of the current coding block from the adjacent encoded area. The second phase of AVS3 adopted the extended intra-frame angle prediction mode (Extended Intra Prediction Mode, referred to as EIPM). In the previous generation AVS2, there were 33 intra-frame prediction modes, including 30 angle prediction modes and 3 special prediction modes (Plane prediction mode, DC prediction mode and Bilinear prediction mode), which were encoded using 2 MPM (Most Probable Mode) and the remaining modes were encoded using 5-bit fixed-length coding. To support more refined angle prediction, the angle prediction modes are expanded to 62 in AVS3, such as Figure 6 As shown, the newly added angle prediction modes are numbered from 34 to 65.

[0097] When the angle prediction mode is used, the pixel points in the current prediction block use the reference pixel values ​​at the corresponding positions on the reference pixel row or column as the prediction values ​​according to the direction corresponding to the angle of the prediction mode. Figure 7 As shown in the figure, for the pixel point P in the prediction block, firstly, according to the prediction angle in the figure, the position of the reference pixel is determined from the pixel row that has been encoded above, and then the reference pixel value is used as the prediction value of the pixel point P. It should be noted that not all pixel positions point to reference pixel positions with integer pixel accuracy, for example Figure 7 The reference pixel position of the pixel point P is a sub-pixel position between pixels B and C, so the predicted pixel value of this position needs to be obtained by interpolation of surrounding pixels. In order to improve the efficiency of intra-frame prediction, on-chip memory is usually used to store reference pixels for intra-frame prediction.

[0098] like Figure 8 As shown in the figure, inter-frame prediction uses the correlation in the video time domain and uses the pixels of the adjacent coded images to predict the pixels of the current image, so as to effectively remove the temporal redundancy of the video and effectively save the bits of the coded residual data. Wherein, P represents the current frame, Pr represents the reference frame, B represents the current coded block, and Br represents the reference block of B. The coordinates of B' in the reference frame are the same as those 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 (MV), where MV = (x r -x,y r -y).

[0099] The second phase of AVS3 also adopts the AWP mode for inter-frame prediction and the SAWP mode for intra-frame prediction. Fig. 9As shown in the figure, the AWP mode uses the intra-frame angle prediction idea to derive the weight value of each pixel position: first set the reference weight value of the current block surrounding position (whole pixel position and sub-pixel position), and then use the angle prediction method to obtain the weight value corresponding to each pixel position, and then use the obtained weight to achieve weighted prediction of two different inter-frame prediction values. SAWP uses a similar method to derive weights to achieve weighted prediction of 2 intra-frame prediction values. The following is an introduction to the AWP mode:

[0100] The minimum block size supported by the angle weighted prediction mode is 8, the maximum block size is 64, and a total of 8 angles are supported, such as Fig.10 As shown in , there are five absolute values ​​of the slopes of these eight angles, namely {horizontal, vertical, 1, 2, 1 / 2}. Fig.11 As shown in the figure, each angle supports 7 reference weight configurations, so for each block, there are 56 angle weighting modes. The reference weight configuration is a distribution function of the reference weight value obtained according to the reference weight index value, and a non-strictly monotonically increasing function is assigned based on the 8-equal points of the reference weight effective length, where the reference weight effective length is calculated by the predicted angle and the current block size.

[0101] like Fig.12 As shown in the figure, the angles supported by the angle weighted prediction mode are divided into 4 partitions, namely angle partition 0, angle partition 1, angle partition 2 and angle partition 3. The formula for deriving pixel-by-pixel weights is slightly different depending on the area where the angle is located. Specifically, there is AwpIndex in the bitstream to indicate the weight mode used by the current coding block. The relevant parameters of the angle weighted mode are confirmed according to AwpIndex according to the following formula.

[0102] stepIndex=(AwpIndex>>3)-3

[0103] modAngNum = AwpIndex%8

[0104] angleAreaIndex=modAngNum>>1

[0105]

[0106] Wherein, the “>>” in the above formula represents a right shift operation. After obtaining the above parameters, the weight matrix of the angle weighting mode can be derived according to these parameters in the following method:

[0107] First, calculate the effective length vL of the reference weight. The length vL of the reference weight is expressed using 1 / 2 pixel precision. For the first 4 angles (i.e., when the angle area indicator angleAreaIndex is equal to 0 and 1), the reference weight is in the column to the left of the current block; for the last 4 angles (i.e., when the angle area indicator angleAreaIndex is equal to 2 and 3), the reference weight is in the 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 as shown in Table 1:

[0108]

[0109] Table 1

[0110] Wherein, "<<" in Table 1 indicates a left shift operation. After calculating the effective length vL of the reference weight, the reference weight Lw is filled in each sample position x (x≤vL) in the following manner. Wherein PictureAwpRefineIndex is the image header index that controls whether to adjust the reference weight.

[0111] Lw[x]=Clip3(0, 8, (x-fP)<<shift)

[0112] shift=PictureAwpRefineIndex? 2:0

[0113] o=PictureAwpRefineIndex? 3:1

[0114] Wherein, the value of tP is determined according to the following Table 2:

[0115] angleAreaIndex f 0 (vL>>1)-3-o+stepIndex*((vL>>3)-1) 1 (vL>>1)-1-o+stepIndex*((vL>>3)-1)-((W<<1)>>angleIndex) 2 (vL>>1)-1-o+stepIndex*((vL>>3)-1)-((H<<1)>>angleIndex) 3 (vL>>1)-3-o+stepIndex*((vL>>3)-1)

[0116] Table 2

[0117] Secondly, fill the brightness weight matrix according to the reference weights. Suppose the brightness weight matrix is ​​BwLuma(x, y), then BwLuma(x, y) = Lw[tP].

[0118] Wherein, for the SAWP mode or the AWP mode in the B frame, the value of tP is determined according to the following Table 3:

[0119] angleAreaIndex Tp 0 (y<<1)+((x<<1)>angleIndex) 1 (y<<1)-((x<<1)>angleIndex) 2 (x<<1)-((y,<<1)>angleIndex) 3 (x<<1)+((y<<1)>angleIndex)

[0120] Table 3

[0121] For the AWP mode in P frames, the value of tP is determined according to the following Table 4:

[0122] angleAreaIndex Tp 0 ((y>>2)<<3)+4+((((x>>2)<<3)+4)>>angteIndex) 1 ((y>>2)<<3)+4-((((x>>2)<<3)+4)>>angleIndex) 2 ((x>>2)<<3)+4-((((y>>2)<<3)+4)>>angleIndex) 3 ((x>>2)<<3)+4+((((y>>2)<<3)+4)>>angleIndex)

[0123] Table 4

[0124] After the luminance weight matrix is ​​obtained, the chrominance weight matrix BwChroma(x, y) is filled according to the luminance weight matrix.

[0125] Among them, for the SAWP mode or the AWP mode in the B frame, the chrominance weight matrix is ​​derived according to the following formula:

[0126] BwChroma[x][y]=BwLuma[x<<1][y<<1]

[0127] For the AWP mode in P frame, the chrominance weight matrix is ​​derived according to the following formula:

[0128] BwChroma[x][y]=BwLuma[(x>>2)<<3][(y>>2)<<3]

[0129] Finally, based on the derived weight matrix and predicted value, the weighted predicted value pred is calculated x,y .

[0130] pred x,y =predA x,y *w x,y +predB x,y *(1-w x,y )

[0131] Among them, predA x,y With predB x,y Represents the two predicted values ​​of weighted prediction, w x,y Indicates 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 .

[0132] In video coding, weights are quantized into integers to reduce floating-point operations. The weight range is [0, m], and the value of m is set according to the precision of the weight. For example, if the weight is represented by 3 bits, then m = 8. Then the weighted prediction value pred x,y The formula can be expressed as:

[0133] pred x,y =(predA x,y *w x,y +predB x,y *(8-w x,y )+4)>>3

[0134] Among them, 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 .

[0135] The weight matrix w in AWP and SAWP x,y According to the reference weight, let the range of the mixed area of ​​the reference weight be L, and its range can be determined according to the starting position and the end position (p 0 , p 1 ) confirm, p 0 and p 1 The values ​​of can be the same or different. i It can be derived according to the following formula:

[0136]

[0137] or

[0138]

[0139] It can be seen from the above formula that the reference weight w=f(d) in the mixed area.

[0140] In specific implementation, for functions whose value range is larger than the weight value range, the clip function can be used to clip the function, that is, w=clip(0, m, f(d)). Alternatively, integer weights can be used to reduce complexity.

[0141] Assume the position of the dividing boundary is c, and the sample point x on the reference weight is i The distance to the mixed area is d. d can be determined based on the distance between the current sample point and the mixed area, that is, d = x i -c.

[0142] Or d can also be calculated based on the range of the mixed area. Assuming that offset is the offset from the center position to the starting position, d can be expressed as: d = x i -p 0 +offset.

[0143] Wherein, d can be represented by a preset precision integer, for example, d can use, but is 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. At the same time, the weight quantized into an integer can be obtained according to the following formula: q =round(m*f(d)); or use the following formula to calculate:

[0144] w q =clip(0,m,round(m*f(d q )))

[0145] Among them, m is the maximum weight, round() is the integer function, and f(d) is the function derived from the reference weight.

[0146] In the related art, the reference weight derivation function is a fixed linear function, but the use of 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 function and indicate it through the bitstream information, so that a more accurate weight matrix can be derived for different coding blocks, which is conducive to improving the encoding and decoding performance.

[0147] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0148] Fig.13 A flowchart of a video decoding method according to an embodiment of the present application is shown. The video decoding method can be executed by a device with a computing and processing function, such as a terminal device or a server. Fig.13 As shown, the video decoding method at least includes steps S1310 to S1340, which are described in detail as follows:

[0149] In step S1310, the video code stream is decoded, and a reference weight derivation function used by a coding block in a weighted prediction mode is determined according to the decoded code stream information.

[0150] In one embodiment of the present application, a video code stream is a code stream obtained by encoding a sequence of video image frames. The video image frame sequence includes a series of images, each of which can be further divided into slices or patches, and the slices can be divided into a series of LCUs (or CTUs), and the LCU contains a number of CUs. The video image frame is encoded in blocks. The coding block in the embodiment of the present application can be a CU, or a smaller block than a CU, such as a smaller block obtained by dividing a CU.

[0151] Optionally, the coding block adopting the weighted prediction mode in the embodiment of the present application may be a coding block adopting the angle weighted prediction mode, that is, a coding block adopting the AWP prediction mode or a coding block adopting the SAWP prediction mode.

[0152] In some optional embodiments, the reference weight derivation function used by the coding block of the weighted existing mode is selected from the following functions: linear function, sigmoid function, hyperbolic function, trigonometric function, exponential-based function, polynomial-based function, piecewise function, and other nonlinear functions.

[0153] In some optional embodiments, the reference weight derivation function may also be one or more mapping relationship tables for indicating the target distance and the reference weight, where the target distance is the distance between the sample point and the mixed boundary; wherein the mapping relationship table stores the mapping relationship between the target distance and the reference weight; the reference weight in the mapping relationship table is generated based on the target distance and a preset function, or the reference weight in the mapping relationship table is generated based on the target distance and a preset function and then adjusted.

[0154] It should be noted that the distance between the sample point and the mixed boundary can be the distance between the sample point and the starting point of the mixed boundary, the distance between the sample point and the center point of the mixed boundary, and of course the distance between the sample point and the end point of the mixed boundary, etc. Of course, an offset value can also be added to these distances.

[0155] In some optional embodiments, the reference weight derivation function used by the coding block using the weighted prediction mode is determined according to the decoded bitstream information. The reference weight derivation function used by the coding block using the weighted prediction mode may be determined according to the explicit index information obtained by decoding; or the reference weight derivation function used by the coding block using the weighted prediction mode may be determined in an implicit manner according to the decoded bitstream information; or the reference weight derivation function used by the coding block using the weighted prediction mode may be determined in an explicit manner according to the decoded bitstream information and in an implicit manner.

[0156] In one embodiment of the present application, the reference weight derivation function used by the coding block can be determined by the display index information in the sequence header information. Specifically, the reference weight derivation function used by the coding block using the weighted prediction mode in the current sequence can be determined based on the value of the sequence weight index information (such as seq_weight_index) contained in the decoded sequence header information. For example, a reference weight derivation function list is set to indicate the reference weight derivation function used by the current sequence through the sequence weight index information.

[0157] Optionally, the sequence header information may include a sequence weight flag (such as seq_weight_flag), which is used to indicate whether the current sequence allows the selection of a reference weight derivation function. For example, if the value of the sequence weight flag is 1, it indicates that the current sequence allows the selection of a reference weight derivation function; if the value of the sequence weight flag is 0, it indicates that the current sequence does not allow the selection of a reference weight derivation function.

[0158] It should be noted that the sequence header information may include both the sequence weight index information (seq_weight_index) and the sequence weight flag (seq_weight_flag). In this case, if the sequence weight flag indicates that the current sequence allows the selection of the reference weight derivation function, the sequence weight index information is decoded from the video bitstream; if the sequence weight flag indicates that the current sequence does not allow the selection of the reference weight derivation function, there is no need to decode the sequence weight index information from the video bitstream. In another case, the sequence header information may include only one of the sequence weight index information (seq_weight_index) and the sequence weight flag (seq_weight_flag). If it only includes the sequence weight flag (seq_weight_flag), the reference weight derivation function may be determined based on other information in the bitstream (such as one or more of the image header information, the slice header information, and the block-level information).

[0159] Optionally, the sequence header information may also 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).

[0160] In one embodiment of the present application, the reference weight derivation function used by the coding block can be determined by the display index information in the image header information. Specifically, the reference weight derivation function used by the coding block using the weighted prediction mode in the current image can be determined based on the value of the image weight index information (such as pic_weight_index) contained in the decoded image header information. For example, a reference weight derivation function list is set to indicate the reference weight derivation function used by the current image through the image weight index information.

[0161] Optionally, the image header information may include an image weight flag (such as pic_weight_flag), which is used to indicate whether the current image allows the selection of a reference weight derivation function. For example, if the value of the image weight flag is 1, it indicates that the current image allows the selection of a reference weight derivation function; if the value of the image weight flag is 0, it indicates that the current image does not allow the selection of a reference weight derivation function.

[0162] It should be noted that the image header information may include both the image weight index information (pic_weight_index) and the image weight flag (pic_weight_flag). In this case, if the image weight flag indicates that the current image allows the selection of the reference weight derivation function, the image weight index information is decoded from the video bitstream; if the image weight flag indicates that the current image does not allow the selection of the reference weight derivation function, it is not necessary to decode the image weight index information from the video bitstream. In another case, the image header information may include only one of the image weight index information (pic_weight_index) and the image weight flag (pic_weight_flag). If only the image weight flag (pic_weight_flag) is included, the reference weight derivation function may be determined based on other information in the bitstream (such as one or more of the slice header information and the block-level information).

[0163] Optionally, the image header information may also 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).

[0164] In one embodiment of the present application, the reference weight derivation function used by the coding block can be determined by display index information in the slice header information. Specifically, the reference weight derivation function used by the coding block using the weighted prediction mode in the current slice can be determined based on the value of the slice weight index information (such as patch_weight_index) contained in the decoded slice header information. For example, a reference weight derivation function list is set to indicate the reference weight derivation function used by the current slice through the slice weight index information.

[0165] Optionally, the slice header information may include a slice weight flag (such as patch_weight_flag), which is used to indicate whether the current slice is allowed to select a reference weight derivation function. For example, if the value of the slice weight flag is 1, it indicates that the current slice is allowed to select a reference weight derivation function; if the value of the slice weight flag is 0, it indicates that the current slice is not allowed to select a reference weight derivation function.

[0166] It should be noted that the slice header information may include both the slice weight index information (patch_weight_index) and the slice weight flag (patch_weight_flag). In this case, if the slice weight flag indicates that the current slice allows the selection of the reference weight derivation function, the slice weight index information is obtained by decoding from the video bitstream; if the slice weight flag indicates that the current slice does not allow the selection of the reference weight derivation function, it is not necessary to decode from the video bitstream to obtain the slice weight index information. In another case, the slice header information may include only one of the slice weight index information (patch_weight_index) and the slice weight flag (patch_weight_flag). If only the slice weight flag (pic_weight_flag) is included, the reference weight derivation function can be determined based on other information in the bitstream (such as block-level information).

[0167] Optionally, the header information may also 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).

[0168] It should be noted that when the reference weight derivation function used by 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 function used by 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 function used by 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 function used by 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.

[0169] In one embodiment of the present application, the reference weight derivation function used by the coding block can be determined by display index information in the block-level information. Specifically, the reference weight derivation function used by the coding block can be determined according to the value of the reference weight index information (such as ref_weight_idx) contained in the decoded block-level information. For example, a reference weight derivation function list is set to indicate the reference weight derivation function used by the current coding block through the reference weight index information.

[0170] It should be noted that, when decoding, it is also necessary to decode the weight mode number (i.e., weight_mode, such as AwpIndex, SawpIndex) of the weighted prediction mode (such as the angle weighted prediction mode) adopted by the coding block. Therefore, if the value of the reference weight index information is first decoded from the video bitstream, the maximum available weight mode number of the weighted prediction mode adopted by the coding block can be determined according to the value of the reference weight index information. For example, the correspondence between the value of the reference weight index information and the maximum available weight mode number of the weighted prediction mode can be pre-set, and then the maximum available weight mode number of the weighted prediction mode adopted by the coding block can be determined according to the value of the reference weight index information first decoded.

[0171] If the weight mode number of the weighted prediction mode used by the coding block is first decoded from the video bitstream, then the set of reference weight derivation functions can be determined based on the weight mode number. For example, the correspondence between the weight mode number and the set of reference weight derivation functions can be pre-set, and then the set of reference weight derivation functions can be determined based on the weight mode number obtained by first decoding. In this way, function sets with different numbers, or function sets with the same number but different types, or function sets with different numbers and different types can be determined based on the weight mode number.

[0172] It should be noted that the weight mode number in the above embodiment can be represented by at least one of the weight position index information and the weight angle index information. If the weight mode number is represented only by the weight position index information, there can be 8 types; if the weight mode number is represented only by the weight angle index information, there can be 7 types; if the weight mode number is represented by both the weight position index information and the weight angle index information, there can be 7×8=56 types.

[0173] In one embodiment of the present application, the reference weight derivation function used by the coding block can be determined by another display index information in the block-level information. Specifically, the costs corresponding to the various reference weight derivation functions set by the coding block can be calculated based on the decoded block-level information, and then the various reference weight derivation functions can be sorted according to the costs to obtain a reference weight derivation function list, and then the reference weight derivation function used by the coding block can be selected from the reference weight derivation function list according to the order index information contained in the block-level information.

[0174] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by the coding block adopting the weighted prediction mode can be determined according to the weighted prediction mode adopted by the coding block. For example, if it is determined according to the decoded bitstream information that the coding block adopts the angle weighted prediction mode, the coding block is determined to use the set first reference weight derivation function; if it is determined according to the decoded bitstream information that the coding block adopts the spatial angle weighted prediction mode, the coding block is determined to use the set second reference weight derivation function. The first reference weight derivation function and the second reference weight derivation function may be different, or they may be the same.

[0175] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by the coding block using the weighted prediction mode may be: determining the weight mode number of the weighted prediction mode used by the coding block according to the block-level information obtained by decoding, calculating the value of the reference weight index information according to the weight mode number, and determining the reference weight derivation function set used by the coding block according to the value of the reference weight index information. It should be noted that the reference weight derivation function set may include one or more reference weight derivation functions. If only one reference weight derivation function is included, then this reference weight derivation function is used as the reference weight derivation function used by the coding block; if multiple reference weight derivation functions are included, then one of the multiple reference weight derivation functions may be selected (such as selected according to the cost or selected according to other methods) as the reference weight derivation function used by the coding block.

[0176] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by a coding block using a weighted prediction mode may be: if the coding block is determined to be a coding block of a set size based on the decoded bitstream information, then the coding block is determined to use a set reference weight derivation function set. That is, in this embodiment, for a coding block of a set size, the reference weight derivation function set used by it can be pre-set. Optionally, the reference weight derivation function set may include one or more reference weight derivation functions.

[0177] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by the coding block using the weighted prediction mode may be: according to the size of the coding block contained in the decoded bitstream information, determine the reference weight derivation function set used by the coding block, wherein different sizes of coding blocks use different reference weight derivation functions. Optionally, the reference weight derivation function set may include one or more reference weight derivation functions.

[0178] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by a coding block adopting a weighted prediction mode may be: based on the block-level information obtained by decoding, calculating the costs corresponding to the various reference weight derivation functions set for the coding block, and using the reference weight derivation function with the smallest corresponding cost as the reference weight derivation function used by the coding block.

[0179] In one embodiment of the present application, the process of implicitly determining the reference weight derivation function used by a coding block adopting a weighted prediction mode may be: based on the block-level information obtained by decoding, calculating the costs corresponding to the use of multiple reference weight derivation functions set for the coding block, sorting the multiple reference weight derivation functions according to the costs, and selecting the weight derivation function ranked in the set order as the reference weight derivation function used by the coding block.

[0180] It can be seen that in the embodiments of the present application, the reference weight derivation function used by the coding block can be indicated by explicit index information in the sequence header information, the image header information, the slice header information and the block-level information, and the reference weight derivation function used by the coding block can also be determined by an implicit method based on the block-level information. In actual use, these methods can be used alone or in combination with any number of them.

[0181] For example, explicit index information included in at least one of the sequence header information, the image header information, and the slice header information indicates that a nonlinear function can be used to derive reference weights, and the current coding block determines whether the current coding block uses a linear function or a nonlinear function based on the block size or other implicit methods mentioned in the above embodiments. For another example, explicit index information included in at least one of the sequence header information, the image header information, and the slice header information indicates that multiple functions can be used to derive reference weights, and the current coding block determines the number of functions allowed to be used by the current coding block based on the block size or other implicit methods mentioned in the above embodiments. If the number of available functions is greater than 1, the reference weight derivation function used is determined based on the explicit block-level index information, otherwise (i.e., there is only one available function) the function is directly used.

[0182] In some optional embodiments, the weight mode number of the weighted prediction mode used by the coding block can be determined according to the decoded block-level information, the value of the reference weight index information can be calculated according to the weight mode number, and the function parameters of the reference weight derivation function used by the coding block can be determined according to the value of the reference weight index information; or the function parameters of the reference weight derivation function used by the coding block can be determined according to the value of the reference weight index information contained in the decoded block-level information. That is, in this embodiment, the value of the reference weight index information determined according to the block-level information is used to indicate the function parameters of the reference weight derivation function.

[0183] In some optional embodiments, the decoded bitstream information further includes mixed region length index information, where the mixed region length index information is used to indicate the length of the mixed region to which the reference weight derivation function is applicable; or the length of the mixed region to which the reference weight derivation function is applicable is determined implicitly according to the decoded bitstream information (for example, the length of the mixed region can be implicitly determined by the determined reference weight derivation function or a parameter of the reference weight derivation function);

[0184] Optionally, the reference weight derivation functions used by the mixed regions of different lengths are the same or different; the function parameters of the reference weight derivation functions used by the mixed regions of different lengths are the same or different.

[0185] Continue to refer to Fig.13 As shown, in step S1320, the reference weight corresponding to the coding block is calculated according to the reference weight derivation function.

[0186] Optionally, the reference weight corresponding to the coding block is calculated according to the reference weight derivation function by inputting the distance between the sample point in the coding block and the mixed boundary into the reference weight derivation function to obtain the corresponding reference weight. The distance between the sample point and the mixed boundary can be the distance between the sample point and the starting point of the mixed boundary, or the distance between the sample point and the center point of the mixed boundary, or the distance between the sample point and the end point of the mixed boundary, etc. Of course, an offset value can also be added to these distances.

[0187] In step S1330, a weight matrix corresponding to the coding block is determined according to the reference weight.

[0188] In some optional 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 can refer to the introduction in the above embodiment and will not be repeated here.

[0189] In some optional embodiments, determining the weight matrix corresponding to the coding block according to the reference weight can 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 aforementioned embodiment), and mapping 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 is to map the calculated weight matrix. In actual implementation, for example, there are two reference weight derivation functions (using linear function and sigmoid function as examples), and these two functions can obtain two weight values ​​(w1, w2) for the same independent variable d (the distance between the sample point and the mixed boundary). Then, for different d, a mapping table of weights w1 to w2 can be obtained. In this case, the codec only needs to store a reference weight derivation function and related parameters. Assuming that the linear function and related parameters are stored, if the sigmoid function needs to be used to derive the reference weight, the linear function can be used for calculation and then mapped through the mapping table. This method can reduce the space occupied by storing multiple functions and reduce the amount of calculation, which is beneficial to improving the codec performance.

[0190] In step S1340, weighted prediction is performed according to the weight matrix to obtain a prediction value corresponding to the coding block.

[0191] In some optional embodiments, the process of performing weighted prediction according to the weight matrix to obtain the prediction value corresponding to the coding block can refer to the introduction in the aforementioned embodiments and will not be repeated here.

[0192] In summary, the technical solution of the embodiment of the present application enables the coding block to adaptively select the reference weight derivation function and indicate it through the bitstream information, so that a more accurate weight matrix can be derived for different coding blocks, which is conducive to improving the encoding and decoding performance.

[0193] Fig.14 A flowchart of a video encoding method according to an embodiment of the present application is shown. The video encoding method can be executed by a device with a computing and processing function, such as a terminal device or a server. Fig.14 As shown, the video encoding method at least includes steps S1410 to S1440, which are described in detail as follows:

[0194] In step S1410, a reference weight derivation function used by a block to be encoded in a weighted prediction mode is determined.

[0195] In step S1420, a reference weight corresponding to the block to be encoded is calculated according to a reference weight derivation function.

[0196] In step S1430, a weight matrix corresponding to the block to be encoded is determined according to the reference weight.

[0197] In step S1440, 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.

[0198] It should be noted that the specific processing process of the encoding end is similar to that of the decoding end, and will not be repeated. If the encoding end needs to indicate the reference weight derivation function through explicit index information, it needs to be encoded in the video bitstream.

[0199] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application from the perspective of the decoding end:

[0200] In the embodiment of the present application, the reference weight derivation function is extended, and a variety of reference weight derivation functions can be used, as follows:

[0201] In the following function, d represents the distance between the sample point and the mixed boundary, which can be the distance between the sample point and the starting point of the mixed boundary, the distance between the sample point and the center point of the mixed boundary, or the distance between the sample point and the end point of the mixed boundary. Of course, an offset value can also be added to these distances. Optionally, the distance represented by d can be directional, such as the sample point position is pos, the mixed boundary is c, and the value of d is pos-c, then a negative value of d means it is on the left side of the mixed boundary, and a positive value of d means it is on the right side of the mixed boundary. Of course, the distance represented by d can also be non-directional, so the absolute value of the distance can be calculated by abs(pos-c).

[0202] In one embodiment of the present application, the reference weight derivation function may use a linear function, such as: w=s*(d+k); wherein s and k are parameter values ​​of the function, which may be preset values ​​or indicated by bitstream information.

[0203] In one embodiment of the present application, the reference weight derivation function may use a sigmoid function, such as: Among them, s and k are the parameter values ​​of the function, which can be preset values ​​or indicated by the code stream information. For example, when s=2, the function graph is as follows Fig.15 As shown, the weight of the mixed area can be set according to the function value corresponding to [-2, 2].

[0204] In one embodiment of the present application, the reference weight derivation function may use a hyperbolic function, such as a tanh function: w = 0.5*tanh(s*d)+0.5; where s is a parameter value of the function, which may be a preset value or may be indicated by bitstream information. For example, when s = 1.3, the function graph is as follows Fig.16 As shown, the weight of the mixed area can be set according to the function value corresponding to [-2, 2].

[0205] In one embodiment of the present application, the reference weight derivation function may 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, which can be a preset value or indicated by the bitstream information. For example, when s = 0.5, the function graph is as follows: Fig.17 As shown, the weight of the mixed area can be set according to the function value corresponding to [-2, 2].

[0206] In one embodiment of the present application, the reference weight derivation function may 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 Among them, s1 and s2 are parameter values ​​of the function, which can be preset values ​​or indicated by bitstream information. For example, s1 = 2, s2 = 0.3465735, then the weight of the mixed area can be set according to the function value corresponding to [-2, 2].

[0207] In one embodiment of the present application, the reference weight derivation function may use a polynomial-based function, such as a polynomial with a quadratic power.

[0208] In one embodiment of the present application, the reference weight derivation function can use a piecewise function to derive weights, and different weight derivation functions are used according to the value of d, for example, a sigmoid function is used when d is less than or equal to 0, otherwise a linear function is used.

[0209] In one embodiment of the present application, a table lookup method can also be used to generate the reference weight when deriving it. For example, one or more lookup tables can be generated according to a preset accuracy, and the lookup table stores the mapping relationship between d and the function value. In 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 weight, such as +1, -1, +2, -2, etc.

[0210] It should be noted that d in the embodiments of the present application can use different precisions, such as d can use 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.

[0211] Based on the above reference weight derivation function, the main processing flow of the embodiment of the present application includes:

[0212] Process 1: Decode the bitstream and determine the reference weight derivation function based on the information in the bitstream (the following methods and methods in each method can be used alone or in combination)

[0213] Method 1: Decoding sequence header information

[0214] In one embodiment of the present application, there is an index seq_weight_index in the sequence header indicating the reference weight derivation function to be used. There is a preset list that determines a series of optional reference weight derivation functions. The method indexed as seq_weight_index in the preset list is determined as the reference weight derivation function used by the current sequence.

[0215] Optionally, there is a flag seq_weight_flag in the sequence header to indicate whether to use an improved reference weight derivation method (ie, the method proposed in the embodiment of the present application). If the improved reference weight derivation method is used, seq_weight_index is decoded.

[0216] Optionally, there is information in the sequence header indicating function parameters of the reference weight derivation function. Specifically, the function parameter information can be directly decoded; or there is a list that specifies the order of the function parameters, and the function parameter information can be determined from the list according to a decoded index seq_param_index.

[0217] Method 2: Decode image header information

[0218] In one embodiment of the present application, there is an index pic_weight_index in the image header indicating the reference weight derivation function to be used. There is a preset list that determines a series of optional reference weight derivation functions. The method indexed as pic_weight_index in the preset list is determined as the reference weight derivation function used in the current sequence.

[0219] Optionally, there is a flag pic_weight_flag in the picture header to indicate whether the coding block in the current picture is allowed to select the reference weight derivation function. If allowed, pic_weight_index is decoded.

[0220] Optionally, there is an index in the image 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 specifies the order of the function parameters, and the information of the function parameters can be determined from the list according to a decoded index pic_param_index.

[0221] Method 3: Decoding the header information

[0222] In one embodiment of the present application, there is an index patch_weight_index in the slice header (patch or slice) indicating the reference weight derivation function used. There is a preset list that determines a series of optional reference weight derivation functions, and the method indexed as patch_weight_index in the preset list is determined as the reference weight derivation function used in the current sequence.

[0223] Optionally, there is a flag patch_weight_flag in the slice header to indicate whether the coding block in the current slice is allowed to select the reference weight derivation function. If allowed, pic_weight_index is decoded.

[0224] Optionally, there is an index in the slice header indicating the function parameters of the reference weight derivation function. Specifically, the function parameter information can be directly decoded; or there is a list that specifies the order of the function parameters, and the function parameter information can be determined from the list according to a decoded index patch_param_index.

[0225] It should be noted that the above sequence header, image header and slice header information can be used only to determine the reference weight derivation function of the AWP mode; or only to determine the reference weight derivation function of the SAWP mode; or used to determine the reference weight derivation function of the AWP mode and the SAWP mode at the same time, for example, there is seq_weight_index to determine the reference weight derivation function of the AWP and the SAWP; or used to determine the reference weight derivation function of the AWP mode and the SAWP mode respectively, for example, there is seq_awp_weight_index to determine the reference weight derivation function of the AWP mode, and there is seq_sawp_weight_index to determine the reference weight derivation function of the SAWP.

[0226] Method 4: Decoding block-level information

[0227] In one embodiment of the present application, the code stream is decoded, the current angle weighted prediction mode weight_mode is confirmed, and then the current reference weight derivation function is calculated from the mode. Since there are 7 weight configuration methods and 8 prediction angles in the existing standard, that is, a total of 56 angle weighted prediction modes, one reference weight derivation method is added in the embodiment of the present application, so there are a total of 2*7*8=112 modes. After decoding weight_mode, other parameters can be calculated in the following way:

[0228] ref_weight_idx=weight_mode / 56

[0229] ref_weight_pos_idx=(weight_mode%56) / 8

[0230] weight_angle_idx=(weight_mode%56)%8

[0231] Among them, ref_weight_idx is used to indicate the reference weight derivation function used; ref_weight_pos_idx represents the reference weight position index information; weight_angle_idx represents the weight angle index information, corresponding to modAngNum introduced in the aforementioned embodiment.

[0232] In one embodiment of the present application, the reference weight derivation function can be confirmed by decoding additional index information, such as decoding weight_mode from the bitstream and additionally decoding an index ref_weight_idx to indicate the reference weight derivation function. The other parameters are calculated in the following way:

[0233] ref_weight_pos_idx=weight_mode / 8

[0234] weight_angle_idx=weight_mode%8

[0235] Among them, ref_weight_pos_idx represents the reference weight position index information; weight_angle_idx represents the weight angle index information, corresponding to the modAngNum introduced in the above embodiment.

[0236] Optionally, when decoding the bitstream, if ref_weight_idx is decoded first and then the weight mode number weight_mode is decoded, the maximum number of available weight modes can be confirmed based on ref_weight_idx. If the weight mode number weight_mode is decoded first and then ref_weight_idx is decoded, the maximum number of available reference weight functions can be confirmed based on the weight mode number weight_mode.

[0237] Among them, weight_mode can be represented by at least one of weight position index information and weight angle index information. If weight_mode is represented by weight position index information only, there can be 8 types; if weight_mode is represented by weight angle index information only, there can be 7 types; if weight_mode is represented by both weight position index information and weight angle index information, there can be 7×8=56 types.

[0238] Optionally, when the reference weight derivation function used is indicated by ref_weight_idx, different reference weight derivation functions can be indicated by different values ​​of the index. For example, linear function and sigmoid function are allowed to be used, then if ref_weight_idx is 0, the linear function is used; if ref_weight_idx is 1, the sigmoid function is used.

[0239] For example, if the linear function, sigmoid function 1, and sigmoid function 2 are allowed, then if ref_weight_idx is 0, the linear function is used; if ref_weight_idx is 1, sigmoid function 1 is used; if ref_weight_idx is 2, sigmoid function 2 is used.

[0240] It should be noted that ref_weight_idx may also be used not to indicate the reference weight derivation function, but to indicate the function parameter of the reference weight derivation function. For example, for the sigmoid function including parameter s in the aforementioned embodiment, the bitstream may include the value of parameter s or the index corresponding to parameter s. Assume that there is a parameter list {1 / 2,1,2,4,8}, when the index is 0, s=1 / 2, and when the index is 2, parameter s=2.

[0241] In one embodiment of the present application, there may be an index in the code stream indicating the length of the mixed area, or it may be determined in an implicit manner (for example, according to the reference weight derivation function used, or according to the parameters of the reference weight derivation function). The reference weight may be derived only in the mixed area using the indicated reference weight derivation function, and the length of the mixed area may be an integer, for example, {1, 2, 4, 8, 16} 1 / 2 pixel lengths. Optionally, the weight derivation function parameters may be adjusted accordingly according to the different lengths of the mixed area used; different weight derivation functions may also be used according to the different lengths of the mixed area.

[0242] In one embodiment of the present application, an implicit method may be used to confirm the reference weight derivation function used without decoding additional information.

[0243] For example, it can be determined according to the prediction mode, such as the AWP mode and the SAWP mode can use different reference weight derivation functions. Alternatively, the reference weight derivation method proposed in the embodiment of the present application can be applied only to the SAWP mode.

[0244] It can also be determined according to the block size. For example, the method of the embodiment of the present application can be used only in coding blocks of a specific size. For example, the reference weight derivation method proposed in the embodiment of the present application is applied only when the block size is greater than 8×8. Or different reference weight derivation functions are used for coding blocks of different sizes.

[0245] Template matching technology can also be used to select the reference weight derivation method, such as calculating the costs corresponding to different reference weight derivation functions and selecting the reference weight derivation function with the smallest cost. In this case, the reference weight derivation functions can also be sorted according to the cost, and then the reference weight derivation function in the set order can be selected; or an explicit index information can be used to select a reference weight derivation function from the sorted list.

[0246] Process 2: Derive the reference weights according to the selected reference weight derivation function.

[0247] Specifically, for example, the position of first_pos (the starting point of the mixed area) or center_pos (the center point of the mixed area) can be determined according to ref_weight_pos_idx; then d is calculated according to first_pos (or center_pos), and the reference weight is obtained in combination with the reference weight derivation function.

[0248] Process 3: Derive the weight matrix based on the reference weights.

[0249] The process is to determine the weight angle (ie, weight_angle, which also corresponds to modAngNum in the above embodiment) according to weight_angle_idx, and then obtain the weight matrix according to the weight angle and the reference weight. The specific process can refer to the introduction in the above embodiment.

[0250] Optionally, a weight mapping table can also be confirmed according to ref_weight_idx, and the derived weight matrix can be mapped according to the mapping table to obtain the final weight matrix. For example, the weight matrix calculated by two reference weight derivation functions is one based on the linear function to derive the final weight matrix w1=clip(0,8,8-d), and the other is based on the sigmoid function to derive the final weight matrix For different d, a set of corresponding weights (w1, w2) can be obtained respectively, and then a lookup table from weight w1 to weight w2 can be obtained. For the weight matrix M1 derived according to w1, M1 can be mapped to M2 according to the lookup table.

[0251] Process 4: Perform weighted prediction based on the weight matrix to obtain the predicted value.

[0252] The process can refer to the introduction in the aforementioned embodiment and will not be described in detail.

[0253] The following is an introduction to the specific application scenario embodiments of this application:

[0254] In an application scenario, the technical solution proposed in the embodiment of the present application can be used for the SAWP prediction mode, where d is represented by 1 / 2 pixel. In this application scenario, the mapping function between the linear function and the sigmoid function can be calculated, assuming that the reference weight derived from the linear function is represented by f1(d), and the maximum value is 8; the reference weight derived from the sigmoid function is represented by f2(d), and the maximum value is 16. Then for the case of d = {-4, -3, -2, -1, 0, 1, 2, 3, 4}, the reference weight derived from the linear function is f1(d) = {0, 1, 2, 3, 4, 5, 6, 7, 8}; assuming that the sigmoid function is The value of the function parameter s is equal to 0.9. Then for d = {-4, -3, -2, -1, 0, 1, 2, 3, 4}, the reference weight derived by the sigmoid function is f2(d) = {0, 1, 2, 5, 8, 11, 14, 15, 16}.

[0255] After obtaining f1(d) and f2(d), we can construct a mapping function from f1(d) to f2(d). Then, in the encoding and decoding process, we can first calculate the reference weight clip(0,8,d+4) according to the linear function, and derive the weight matrix BW1 according to the reference weight. Then, we map BW1 to BW2 through the constructed mapping function, and then we can perform weighted prediction according to the following formula:

[0256] (P0*w 0 +P1*(16-w 0 )+8)>>4

[0257] Among them, P0 and P1 represent the two predicted values ​​of weighted prediction; w 0 is the weight obtained by mapping in BW2.

[0258] In another application scenario, the technical solution proposed in the embodiment of the present application can be used for the SAWP prediction mode, where d is represented by 1 / 2 pixel. In this application scenario, the sigmoid function can be used to derive the reference weight. Assume that the sigmoid function is The value of the function parameter s is equal to 0.9, and the maximum value of the reference weight is 16. Then in the encoding and decoding process, after the reference weight is calculated according to the sigmoid function and the weight matrix BW is derived, weighted prediction can be performed according to the following formula:

[0259] (P0*w 0 +P1*(16-w 0 )+8)>>4

[0260] Among them, P0 and P1 represent the two predicted values ​​of weighted prediction; w 0 is the weight in BW.

[0261] The following describes an apparatus embodiment of the present application, which can be used to execute the method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned method embodiment of the present application.

[0262] Fig.18 A block diagram of a video decoding device according to an embodiment of the present application is shown. The video decoding device can be set in a device with a computing and processing function, such as a terminal device or a server.

[0263] Reference Fig.18 As shown, a video decoding device 1800 according to an embodiment of the present application includes: a decoding unit 1802 , a calculating unit 1804 , a determining unit 1806 and a processing unit 1808 .

[0264] Among them, the decoding unit 1802 is configured to decode the video code stream, and determine the reference weight derivation function used by the coding block adopting the weighted prediction mode according to the decoded code stream information; the calculation unit 1804 is configured to calculate the reference weight corresponding to the coding block according to the reference weight derivation function; the determination unit 1806 is configured to 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 prediction value corresponding to the coding block.

[0265] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 is configured to determine the reference weight derivation function used by the coding block using the weighted prediction mode according to at least one of the following methods: determining the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding; determining the reference weight derivation function used by the coding block using the weighted prediction mode in an implicit manner according to the bitstream information obtained by decoding.

[0266] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current sequence according to the value of the sequence weight index information contained in the sequence header information obtained by decoding.

[0267] In some embodiments of the present application, based on the aforementioned scheme, the sequence header information also includes a sequence weight flag, and the sequence weight flag is used to indicate whether the current sequence allows the selection of a reference weight derivation function; if the sequence weight flag indicates that the current sequence allows the selection of a reference weight derivation function, the sequence weight index information is decoded from the video bitstream.

[0268] In some embodiments of the present application, based on the aforementioned scheme, the sequence header information also includes function parameter index information; the function parameter index information 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.

[0269] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current image according to the value of the image weight index information contained in the decoded image header information.

[0270] In some embodiments of the present application, based on the aforementioned scheme, the image header information also includes an image weight flag, and the image weight flag is used to indicate whether the current image allows the selection of a reference weight derivation function; if the image weight flag indicates that the current image allows the selection of a reference weight derivation function, the image weight index information is decoded from the video code stream.

[0271] In some embodiments of the present application, based on the aforementioned scheme, the image header information also includes function parameter index information; the function parameter index information 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.

[0272] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block using the weighted prediction mode in the current slice according to the value of the slice weight index information contained in the slice header information obtained by decoding.

[0273] In some embodiments of the present application, based on the aforementioned scheme, the slice header information also includes a slice weight flag, and the slice weight flag is used to indicate whether the current slice allows the selection of a reference weight derivation function; if the slice weight flag indicates that the current slice allows the selection of a reference weight derivation function, the slice weight index information is decoded from the video bitstream.

[0274] In some embodiments of the present application, based on the aforementioned scheme, the header information also includes function parameter index information; the function parameter index information 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.

[0275] In some embodiments of the present application, based on the above-mentioned solution, the decoding unit 1802 determines the reference weight derivation function used by the coding block using the weighted prediction mode according to the explicit index information obtained by decoding, including:

[0276] Determining a reference weight derivation function used by a coding block adopting an angle weighted prediction mode according to the explicit index information obtained by decoding; or

[0277] Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a spatial angular weighted prediction mode; or

[0278] Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting an angle weighted prediction mode and a coding block adopting a spatial angle weighted prediction mode; or

[0279] The reference weight derivation function used by the coding block adopting the angle weighted prediction mode and the reference weight derivation function used by the coding block adopting the spatial angle weighted prediction mode are determined according to the explicit index information obtained by decoding.

[0280] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block adopting the weighted prediction mode according to the explicit index information obtained by decoding, including: determining the reference weight derivation function used by the coding block according to the value of the reference weight index information contained in the block-level information obtained by decoding.

[0281] In some embodiments of the present application, based on the aforementioned scheme, the processing unit is further configured to: if the value of the reference weight index information is first decoded from the video bitstream, determine the maximum available weight mode number of the weighted prediction mode adopted by the coding block according to the value of the reference weight index information; or

[0282] If the weight mode number of the weighted prediction mode adopted by the coding block is first decoded from the video bitstream, then the maximum number of available reference weight derivation functions is determined according to the weight mode number;

[0283] The weight mode number is represented by at least one of weight position index information and weight angle index information.

[0284] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block adopting the weighted prediction mode according to the explicit index information obtained by decoding, including: calculating the costs corresponding to the use of multiple reference weight derivation functions set by the coding block according to the block-level information obtained by decoding, and sorting the multiple reference weight derivation functions according to the costs to obtain a reference weight derivation function list; and selecting the reference weight derivation function used by the coding block from the reference weight derivation function list according to the order index information contained in the block-level information.

[0285] In some embodiments of the present application, based on the aforementioned scheme, the processing unit is further configured to: determine the weight mode number of the weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate the value of the reference weight index information according to the weight mode number, and determine the function parameters of the reference weight derivation function used by the coding block according to the value of the reference weight index information; or determine the function parameters of the reference weight derivation function used by the coding block according to the value of the reference weight index information contained in the block-level information obtained by decoding.

[0286] In some embodiments of the present application, based on the aforementioned scheme, the decoded bitstream information also includes mixed area length index information, and the mixed area length index information is used to indicate the length of the mixed area to which the reference weight derivation function is applicable; or according to the decoded bitstream information, the length of the mixed area to which the reference weight derivation function is applicable is determined in an implicit manner; wherein, the reference weight derivation functions used for mixed areas of different lengths are the same or different; and the function parameters of the reference weight derivation functions used for mixed areas of different lengths are the same or different.

[0287] In some embodiments of the present application, based on the aforementioned scheme, the decoding unit 1802 determines the reference weight derivation function used by the coding block adopting the weighted prediction mode in an implicit manner according to the decoded bit stream information, including: if it is determined according to the decoded bit stream information that the coding block adopts the angle weighted prediction mode, then it is determined that the coding block uses the set first reference weight derivation function; if it is determined according to the decoded bit stream information that the coding block adopts the spatial angle weighted prediction mode, then it is determined that the coding block uses the set second reference weight derivation function.

[0288] In some embodiments of the present application, based on the above-mentioned solution, the decoding unit 1802 determines the reference weight derivation function used by the coding block using the weighted prediction mode in an implicit manner according to the decoded bitstream information, including:

[0289] Determine a weight mode number of a weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate a value of reference weight index information according to the weight mode number, and determine a reference weight derivation function set used by the coding block according to the value of the reference weight index information; or

[0290] If it is determined according to the decoded 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 function set; or

[0291] Determining, according to the size of the coding block contained in the decoded bitstream information, a reference weight derivation function set used by the coding block, wherein coding blocks of different sizes use different reference weight derivation functions; or

[0292] Calculate, according to the decoded block-level information, the costs corresponding to the use of various reference weight derivation functions set for the coding block, and use the reference weight derivation function with the minimum corresponding cost as the reference weight derivation function used by the coding block; or

[0293] According to the block-level information obtained by decoding, the costs corresponding to the multiple reference weight derivation functions used by the coding block are calculated, the multiple reference weight derivation functions are sorted according to the costs, and the weight derivation function ranked in the set order is selected as the reference weight derivation function used by the coding block.

[0294] In some embodiments of the present application, based on the aforementioned scheme, the determining unit 1806 is configured to: calculate a weight matrix corresponding to the coding block according to the reference weight and the weight prediction angle used by the coding block; or

[0295] According to the reference weight and the prediction angle used by the coding block, a candidate weight matrix corresponding to the coding block is calculated, and the candidate weight matrix is ​​mapped according to a set weight mapping table to obtain a weight matrix corresponding to the coding block.

[0296] In some embodiments of the present application, based on the aforementioned scheme, the reference weight derivation function is selected from the following functions: linear function, sigmoid function, hyperbolic function, trigonometric function, exponential-based function, polynomial-based function, and piecewise function.

[0297] In some embodiments of the present application, based on the aforementioned solution, the reference weight derivation function is used to indicate a mapping relationship table between a target distance and a reference weight, wherein the target distance is the distance between a sample point and a mixed boundary;

[0298] Among them, the mapping relationship between the target distance and the reference weight is stored in the mapping relationship table; the reference weight in the mapping relationship table is generated according to the target distance and a preset function, or the reference weight in the mapping relationship table is generated according to the target distance and a preset function and then adjusted.

[0299] Fig.19 A block diagram of a video encoding device according to an embodiment of the present application is shown. The video encoding device can be set in a device with a computing and processing function, such as a terminal device or a server.

[0300] Reference Fig.19As shown, a video encoding device 1900 according to an embodiment of the present application includes: a processing unit 1902 , a calculating unit 1904 , a determining unit 1906 and an encoding unit 1908 .

[0301] Among them, the processing unit 1902 is configured to determine the reference weight derivation function used by the block to be encoded using the weighted prediction mode; the calculation unit 1904 is configured to calculate the reference weight corresponding to the block to be encoded according to the reference weight derivation function; the determination unit 1906 is configured to determine the 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, obtain the prediction value corresponding to the block to be encoded, and encode the block to be encoded according to the prediction value.

[0302] Fig. 20 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. The electronic device may be a video decoding device or a video encoding device in the aforementioned embodiment.

[0303] It should be noted that Fig. 20 The computer system 2000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0304] like Fig. 20 As shown, the computer system 2000 may include a central processing unit (CPU) 2001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 2002 or the program loaded from the storage part 2008 to the random access memory (RAM) 2003, such as executing the method described in the above embodiment. In the RAM 2003, various programs and data required for system operation are also stored. The CPU 2001, ROM 2002 and 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.

[0305] 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 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 needed. 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 needed, so that a computer program read therefrom is installed into the storage section 2008 as needed.

[0306] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program is used to perform the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 2009, and / or installed from a 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.

[0307] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a computer program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0308] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and a computer program.

[0309] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0310] As another aspect, 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 independently 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.

[0311] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0312] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable an electronic device to execute the method according to the implementation methods of the present application.

[0313] For example, the electronic device may be a video decoding device, and the video decoding device may execute Fig.13 As another example, the electronic device may be a video encoding device, and the video encoding device may perform Fig.14 The video encoding method shown.

[0314] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. 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 common knowledge or customary technical means in the art that are not disclosed in the present application.

[0315] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A video decoding method, characterized in that: include: Decoding the video bitstream, and determining a reference weight derivation function used by a coding block adopting a weighted prediction mode according to the bitstream information obtained by decoding; Calculate the reference weight corresponding to the coding block according to the reference weight derivation function; Determine 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: Determining a reference weight derivation function used by a coding block using a weighted prediction mode according to the decoded bitstream information includes at least one of the following methods: Determine, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a weighted prediction mode; According to the decoded bitstream information, a reference weight derivation function used by a coding block adopting a weighted prediction mode is determined in an implicit manner.

3. The video decoding method according to claim 2, characterized in that: Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a weighted prediction mode, including at least one of the following methods: Determine, according to the value of the sequence weight index information contained in the decoded sequence header information, a reference weight derivation function used by a coding block in a weighted prediction mode in a current sequence; Determine, according to the value of the image weight index information contained in the decoded image header information, a reference weight derivation function used by a coding block in a weighted prediction mode in the current image; According to the value of the slice weight index information contained in the decoded slice header information, a reference weight derivation function used by the coding block in the current slice that adopts the weighted prediction mode is determined.

4. The video decoding method according to claim 3, characterized in that: The sequence header information also includes at least one of a sequence weight flag and function parameter index information; the sequence weight flag is used to indicate whether the current sequence allows the selection of a reference weight derivation function; The function parameter index information 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.

5. The video decoding method according to claim 3, characterized in that: The image header information also includes at least one of an image weight flag and function parameter index information; the image weight flag is used to indicate whether the current image allows the reference weight derivation function to be selected; The function parameter index information 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.

6. The video decoding method according to claim 3, characterized in that: The slice header information also includes at least one of a slice weight flag and function parameter index information; the slice weight flag is used to indicate whether the current slice allows the reference weight derivation function to be selected; The function parameter index information 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.

7. The video decoding method according to any one of claims 2 to 6, characterized in that: Determine, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a weighted prediction mode, including: Determining a reference weight derivation function used by a coding block adopting an angle weighted prediction mode according to the explicit index information obtained by decoding; or Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a spatial angular weighted prediction mode; or Determining, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting an angle weighted prediction mode and a coding block adopting a spatial angle weighted prediction mode; or The reference weight derivation function used by the coding block adopting the angle weighted prediction mode and the reference weight derivation function used by the coding block adopting the spatial angle weighted prediction mode are determined according to the explicit index information obtained by decoding.

8. The video decoding method according to claim 2, characterized in that: Determine, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a weighted prediction mode, including: A reference weight derivation function used by the coding block is determined according to a value of the reference weight index information contained in the decoded block-level information.

9. The video decoding method according to claim 8, characterized in that: The video decoding method further comprises: If the value of the reference weight index information is first decoded from the video bitstream, then the maximum available weight mode number of the weighted prediction mode adopted by the coding block is determined according to the value of the reference weight index information; or If the weight mode number of the weighted prediction mode adopted by the coding block is first decoded from the video bitstream, then the maximum number of available reference weight derivation functions is determined according to the weight mode number; The weight mode number is represented by at least one of weight position index information and weight angle index information.

10. The video decoding method according to claim 2, characterized in that: Determine, according to the explicit index information obtained by decoding, a reference weight derivation function used by a coding block adopting a weighted prediction mode, including: According to the block-level information obtained by decoding, the costs corresponding to the coding block using the set multiple reference weight derivation functions are calculated, and the multiple reference weight derivation functions are sorted according to the costs to obtain a reference weight derivation function list; According to the order index information included in the block-level information, a reference weight derivation function used by the coding block is selected from the reference weight derivation function list.

11. The video decoding method according to claim 1, characterized in that: The video decoding method further includes: Determine a weight mode number of a weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate a value of reference weight index information according to the weight mode number, and determine a function parameter of a reference weight derivation function used by the coding block according to the value of the reference weight index information; or According to the value of the reference weight index information contained in the decoded block-level information, a function parameter of the reference weight derivation function used by the coding block is determined.

12. The video decoding method according to claim 1, characterized in that: The decoded bitstream information further includes mixed region length index information, where the mixed region length index information is used to indicate the length of the mixed region to which the reference weight derivation function is applicable; or the length of the mixed region to which the reference weight derivation function is applicable is determined implicitly according to the decoded bitstream information; Among them, the reference weight derivation functions used by the mixed areas of different lengths are the same or different; the function parameters of the reference weight derivation functions used by the mixed areas of different lengths are the same or different.

13. The video decoding method according to claim 2, characterized in that: According to the decoded bitstream information, the reference weight derivation function used by the coding block using the weighted prediction mode is determined implicitly, including: If it is determined according to the decoded 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 function; if it is determined according to the decoded 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 function; or Determine a weight mode number of a weighted prediction mode adopted by the coding block according to the block-level information obtained by decoding, calculate a value of reference weight index information according to the weight mode number, and determine a reference weight derivation function set used by the coding block according to the value of the reference weight index information; or If it is determined according to the decoded 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 function set; or Determining, according to the size of the coding block contained in the decoded bitstream information, a reference weight derivation function set used by the coding block, wherein coding blocks of different sizes use different reference weight derivation functions; or Calculate, according to the decoded block-level information, the costs corresponding to the use of various reference weight derivation functions set for the coding block, and use the reference weight derivation function with the minimum corresponding cost as the reference weight derivation function used by the coding block; or According to the block-level information obtained by decoding, the costs corresponding to the multiple reference weight derivation functions used by the coding block are calculated, the multiple reference weight derivation functions are sorted according to the costs, and the weight derivation function ranked in the set order is selected as the reference weight derivation function used by the coding block.

14. The video decoding method according to claim 1, characterized in that: Determining a weight matrix corresponding to the coding block according to the reference weight includes: Calculating a weight matrix corresponding to the coding block according to the reference weight and the weight prediction angle used by the coding block; or According to the reference weight and the prediction angle used by the coding block, a candidate weight matrix corresponding to the coding block is calculated, and the candidate weight matrix is ​​mapped according to a set weight mapping table to obtain a weight matrix corresponding to the coding block.

15. The video decoding method according to claim 1, characterized in that: The reference weight derivation function is selected from the following functions: a linear function, a sigmoid function, a hyperbolic function, a trigonometric function, an exponential-based function, a polynomial-based function, and a piecewise function.

16. The video decoding method according to claim 1, characterized in that: The reference weight derivation function is used to indicate a mapping relationship table between a target distance and a reference weight, wherein the target distance is the distance between a sample point and a mixed boundary; Among them, the mapping relationship between the target distance and the reference weight is stored in the mapping relationship table; the reference weight in the mapping relationship table is generated according to the target distance and a preset function, or the reference weight in the mapping relationship table is generated according to the target distance and a preset function and then adjusted.

17. A video encoding method, characterized in that: include: Determining a reference weight derivation function used by a block to be encoded in a weighted prediction mode; Calculate the reference weight corresponding to the block to be encoded according to the reference weight derivation function; 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.

18. 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 16 or the video encoding method according to claim 17 is implemented.

19. 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 16, or the video encoding method described in claim 17.

20. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor of the electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device performs the video decoding method described in any one of claims 1 to 16, or the video encoding method described in claim 17.