Encoding / decoding method, apparatus, and encoding / decoding device

By setting a reasonable target weight value for each pixel position using a weighted prediction angle and reference weight values, the method improves prediction accuracy and coding performance in video coding technologies.

JP2025161991APending Publication Date: 2025-10-24HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2025142438
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2020-06-01
Filing Date
2025-08-28
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Existing video coding technologies face challenges in accurately predicting pixel values, leading to suboptimal prediction performance and coding efficiency due to unreasonable setting of weight values during weighted prediction processes.

Method used

The proposed method sets a reasonable target weight value for each pixel position of the current block by determining a weighted prediction angle and setting reference weight values at peripheral positions outside the block, using a weight conversion rate and start position to derive a target weight value for improved prediction accuracy.

Benefits of technology

This approach enhances prediction accuracy and coding performance by making the predicted values closer to the original pixels, thereby improving overall video coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025161991000001_ABST
    Figure 2025161991000001_ABST
Patent Text Reader

Abstract

To provide an encoding / decoding method, an apparatus, an encoding device and a decoding device.SOLUTION: A method includes steps of obtaining a weighted prediction angle and weight setting parameters, in which the weight setting parameters include a weight conversion rate and a start position of the weight conversion, setting reference weight values at peripheral positions outside the current block on the basis of the weight setting parameters, determining peripheral matching positions pointed to by the pixel position from the peripheral positions outside the current block on the basis of the weighted prediction angle, determining a target weight value for the pixel position on the basis of the reference weight value associated with the peripheral matching position and determining an associated weight value for the pixel position on the basis of the target weight value for the pixel position, determining a first predicted value for the pixel position on the basis of a first prediction mode and determining a second predicted value for the pixel position on the basis of a second prediction mode, and determining a weighted prediction value for the pixel position on the basis of the first predicted value, the target weight value, the second predicted value and the associated weight value.SELECTED DRAWING: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to the field of encoding and decoding technology, and in particular to an encoding and decoding method, apparatus, encoding device and decoding device. [Background technology]

[0002] To save space, all video images are coded before transmission, and complete video coding may include processes such as prediction, transformation, quantization, entropy coding, filtering, etc. The prediction process may include intra-prediction and inter-prediction, where inter-prediction utilizes the temporal correlation of video to predict a current pixel using pixels of adjacent coded images, thereby achieving the goal of effectively removing temporal redundancy in video. Intra-prediction utilizes the spatial correlation of video to predict a current pixel using pixels of coded blocks of images of the current frame, thereby achieving the goal of removing spatial redundancy in video. Summary of the Invention

[0003] In view of this, the present invention provides an encoding / decoding method, apparatus, encoding device and decoding device to improve prediction accuracy.

[0004] The present invention provides an encoding / decoding method, the method including the steps of: when determining to start weighted prediction for a current block, acquiring a weighted prediction angle and a weight setting parameter for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter; for each pixel position of the current block, determining a peripheral matching position indicated by the pixel position from the peripheral positions outside the current block based on the weighted prediction angle; and determining a target weight value for the pixel position based on a value of the current block; determining an associated weight value for the pixel position based on the target weight value for the pixel position; determining a first predicted value for the pixel position based on a first prediction mode of the current block; determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0005] The present invention provides an encoding / decoding device, the device including: an acquisition module for acquiring a weighted prediction angle and a weight setting parameter of a current block when it is determined to start weighted prediction for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; a setting module for setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter; and a setting module for determining, for each pixel position of the current block, a peripheral matching position indicated by the pixel position from the peripheral positions outside the current block based on the weighted prediction angle, and a determination module for determining a target weight value for the pixel position based on a reference weight value associated with a matching position, determining an associated weight value for the pixel position based on the target weight value for the pixel position, determining a first predicted value for the pixel position based on a first prediction mode of the current block, determining a second predicted value for the pixel position based on a second prediction mode of the current block, determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value, and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0006] The present invention provides a decoding device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions executable by the processor, and the processor executes the machine-executable instructions to perform the following steps when it is determined to start weighted prediction for a current block: acquiring a weighted prediction angle and weight setting parameters for the current block, the weight setting parameters including a weight conversion rate and a start position of weight conversion; setting reference weight values ​​at peripheral positions outside the current block based on the weight setting parameters; and, for each pixel position of the current block, calculating a weight value from the peripheral positions outside the current block to a peripheral position indicated by the pixel position based on the weighted prediction angle. determining a matching position; determining a target weight value for the pixel position based on reference weight values ​​associated with the neighboring matching positions; determining an associated weight value for the pixel position based on the target weight value for the pixel position; determining a first predicted value for the pixel position based on a first prediction mode of the current block; determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0007] The present invention provides an encoding device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions executable by the processor, and the processor executes the machine-executable instructions to perform the following steps when it is determined to start weighted prediction for a current block: acquiring a weighted prediction angle and weight setting parameters for the current block, the weight setting parameters including a weight conversion rate and a start position of weight conversion; setting reference weight values ​​at peripheral positions outside the current block based on the weight setting parameters; and, for each pixel position of the current block, calculating a weighted prediction angle from the peripheral positions outside the current block to a peripheral position indicated by the pixel position based on the weighted prediction angle. determining a matching position; determining a target weight value for the pixel position based on reference weight values ​​associated with the neighboring matching positions; determining an associated weight value for the pixel position based on the target weight value for the pixel position; determining a first predicted value for the pixel position based on a first prediction mode of the current block; determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0008] As can be seen from the above technical solutions, the embodiments of the present invention propose an effective method for setting weight values, which can set a reasonable target weight value for each pixel position of the current block, making the predicted value of the current block closer to the original pixels, thereby improving prediction accuracy, improving prediction performance, and improving coding performance. [Brief explanation of the drawings]

[0009] [Figure 1] FIG. 1 is a schematic diagram of a video coding framework. [Figure 2A]FIG. 1 is a schematic diagram of weighted prediction. [Figure 2B] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2C] FIG. 1 is a schematic diagram of weighted prediction. [Figure 3] 1 is a flowchart of an encoding / decoding method according to one embodiment of the present invention. [Figure 4A] 1 is a flowchart of an encoding method in one embodiment of the present invention. [Figure 4B] FIG. 10 is a schematic diagram of peripheral locations outside the current block. [Figure 4C] FIG. 10 is a schematic diagram of peripheral locations outside the current block. [Figure 4D] FIG. 10 is a schematic diagram of peripheral locations outside the current block. [Figure 4E] FIG. 10 is a schematic diagram of peripheral locations outside the current block. [Figure 4F] 1 is a flowchart of a decoding method according to an embodiment of the present invention. [Figure 5] FIG. 10 is a schematic diagram of a weighted prediction angle in one embodiment of the present invention. [Figure 6] FIG. 2 is a schematic diagram of reference weight values ​​of four kinds of weight conversion ratios in one embodiment of the present invention. [Figure 7A] 1 is a flowchart for deriving a weight array in one embodiment of the present invention. [Figure 7B] FIG. 1 is a schematic diagram of weighted prediction angles and angle areas in one embodiment of the present invention. [Figure 7C] FIG. 1 is a schematic diagram of weighted prediction angles and angle areas in one embodiment of the present invention. [Figure 7D] FIG. 1 is a schematic diagram of weighted prediction angles and angle areas in one embodiment of the present invention. [Figure 8A] FIG. 1 is a schematic diagram of an SCC sequence. [Figure 8B] FIG. 1 is a schematic diagram of a natural sequence. [Figure 9] FIG. 2 is a schematic diagram of neighboring blocks of a current block in one embodiment of the present invention. [Figure 10A]1 is a schematic diagram illustrating the configuration of an encoding / decoding device according to one embodiment of the present invention. [Figure 10B] FIG. 2 is a hardware configuration diagram of a decoding device according to an embodiment of the present invention. [Figure 10C] FIG. 10 is a hardware configuration diagram of an encoding device according to another embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0010] The terms used in the embodiments of the present invention are intended to describe particular embodiments only and are not intended to limit the present invention. As used in the embodiments and claims of the present invention, the singular forms "a," "the," and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. The term "and / or" as used herein should also be understood to mean including any or all possible combinations of one or more of the associated listed items. While terms such as "first," "second," and "third" may be used to describe various pieces of information in the embodiments of the present invention, it should be understood that such information should not be limited to these terms. These terms are used only to distinguish between pieces of information of the same type. For example, first information may be referred to as second information, and similarly, second information may be referred to as first information, depending on the context, without departing from the scope of the embodiments of the present invention. Furthermore, the term "if" used may be interpreted as "when," "if," or "responsive to a determination."

[0011] The embodiments of the present invention propose an encoding / decoding method, apparatus and device thereof, which may relate to concepts such as intra prediction, inter prediction and IBC (Intra Block Copy) prediction.

[0012] Intra prediction uses pixels of previously coded blocks of a current image to predict pixels of the current block based on spatial correlation in the video, thereby achieving the goal of reducing spatial redundancy in the video. Multiple prediction modes are defined for intra prediction, each corresponding to a texture direction (except for the DC (Direct Current) mode). For example, when the textures of an image are arranged horizontally, the horizontal prediction mode can better predict image information.

[0013] Inter-prediction is based on the temporal correlation of video. Because video sequences contain relatively strong temporal correlation, inter-prediction predicts pixels of a current image using pixels of adjacent coded images, thereby achieving the purpose of effectively reducing the temporal redundancy of video.

[0014] Intra block copy allows for same-frame reference, and the reference data of the current block comes from the same frame. In the intra block copy technique, the block vector of the current block can be used to obtain a predicted value of the current block. For example, based on the characteristic that there are a large number of textures that appear repeatedly within the same frame of the screen content, when the block vector is used to obtain a predicted value of the current block, the compression efficiency of the screen content sequence can be improved.

[0015] A prediction pixel is a pixel value derived from a pixel that has already been coded and decoded. The residual is obtained from the difference between the original pixel and the prediction pixel, and then residual transformation, quantization, and coefficient coding are performed. An inter-prediction pixel is a pixel value derived from a reference frame for the current block. Because the pixel positions are discrete, the final prediction pixel must be obtained by interpolation. The closer the prediction pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two, and the higher the coding compression performance.

[0016] Motion Vector (MV). In inter-prediction, a motion vector can be used to represent the relative displacement between a current block in a current frame and a reference block in a reference frame. Each divided block transmits a corresponding motion vector to the decoding side. Independently encoding and transmitting the motion vector of each block consumes a large number of bits, especially when there are many small blocks. To reduce the number of bits used to encode a motion vector, the spatial correlation between adjacent blocks can be utilized to predict the motion vector of the current block based on the motion vector of an adjacent coded block, and the prediction difference can be coded, thereby effectively reducing the number of bits representing the motion vector. When coding the motion vector of the current block, the motion vector of the current block can be predicted using the motion vector of an adjacent coded block, and the difference between the predicted value of the motion vector (MVP, Motion Vector Prediction) and the actual estimated value of the motion vector, i.e., the motion vector difference (MVD, Motion Vector Difference), can be coded.

[0017] Motion Information. A motion vector represents a position offset between a current block and a reference block. Therefore, in order to accurately obtain information about a reference block, in addition to the motion vector, reference frame image index information indicating which reference frame image the current block uses is required. In video coding techniques, a single reference frame image list may typically be created for the current frame, and the reference frame image index information indicates which reference frame image in the reference frame image list the current block uses. Furthermore, since many coding techniques support multiple reference frame image lists, a single index value may be used to indicate which reference frame image list is used, and this index value may be referred to as a reference direction. As described above, in video coding techniques, information about motion, such as the motion vector, reference frame image index information, and reference direction, may be collectively referred to as motion information.

[0018] Block vectors (BVs) are used in intra block copy technology, which uses block vectors for motion compensation, i.e., to obtain a predicted value for the current block. Unlike motion vectors, block vectors represent the relative displacement between the current block and the best matching block in the coded blocks of the current frame. Due to the characteristic that there are many repeated textures within the same frame, using block vectors to obtain a predicted value for the current block can significantly improve compression efficiency.

[0019] Intra prediction mode: Intra prediction uses intra prediction mode to perform motion compensation, i.e., intra prediction mode is adopted to obtain a predicted value of the current block. For example, intra prediction mode may include, but is not limited to, planar mode, DC mode, and various angle modes. Planar mode is applied to areas where pixel values ​​change slowly, and uses two linear filters, horizontal and vertical, to obtain the average value of pixels in the two directions as the predicted value of the pixels of the current block. DC mode is applied to large flat areas, and obtains the average value of the pixels surrounding the current block as the predicted value of the current block. There are 33 or 65 angle modes.

[0020] Palette Mode. In palette mode, the pixel values ​​of the current block are represented by a small set of pixel values, i.e., a palette. If the pixel value of a pixel location in the current block is close to a color in the palette, the pixel location is coded with the index value of the corresponding color in the palette. If the pixel value of a pixel location in the current block is not similar to any color in the palette, the pixel location needs to be coded with an "escape pixel" value, directly quantized, and coded into the bitstream. The decoder first obtains a palette, e.g., a palette containing {color A, color B, color C}, and checks whether each pixel location is an escape pixel value. If not, it obtains the index of the pixel location from the bitstream, and then obtains a color from the palette based on the index of the pixel location and assigns it to the pixel location. Otherwise, it analyzes the escape pixel value.

[0021] Rate-Distortion Optimization (RDO) principle. Coding efficiency is evaluated using two metrics: bit rate and PSNR (Peak Signal-to-Noise Ratio). The smaller the bitstream, the higher the compression rate, and the higher the PSNR, the better the quality of the reconstructed image. When selecting a mode, the discriminant essentially takes both factors into account. For example, the cost corresponding to a mode is J(mode) = D + λ * R, where D represents distortion and is typically evaluated using the SSE (sum of squared errors) metric. SSE is the mean squared sum of the difference between the reconstructed image block and the source image, λ is the Lagrange multiplier, and R is the actual number of bits required to encode the image block in that mode, including the sum of bits required for coding mode information, motion information, residuals, etc. When selecting a mode, using the RDO principle to compare and determine the coding mode usually ensures optimal coding performance.

[0022] Video coding framework. The encoding-side processing flow of an embodiment of the present invention can be realized using a video coding framework such as that shown in FIG. 1. The schematic diagram of the video decoding framework is similar to that of FIG. 1 and will not be described again. The decoding-side processing flow of an embodiment of the present invention can be realized using the video decoding framework. Exemplarily, the video coding framework and the video decoding framework may include modules such as intra-prediction / inter-prediction, motion estimation / motion compensation, a reference image buffer, in-loop filtering, reconstruction, transform, quantization, inverse transform, inverse quantization, and an entropy encoder, but are not limited to these. On the encoding side, the encoding-side processing flow can be realized through cooperation between these modules, and on the decoding side, the decoding-side processing flow can be realized through cooperation between these modules.

[0023] For example, the current block may be rectangular, but the edges of real objects are often not rectangular. Therefore, two different objects (e.g., an object in the foreground and an object in the background) often exist at the edge of the object. If the movements of the two objects do not match, rectangular division cannot adequately separate the two objects. Therefore, the current block may be divided into two non-rectangular sub-blocks, and the two non-rectangular sub-blocks may be subjected to weighted prediction. For example, weighted prediction is a method of obtaining a final prediction value by performing a weighting operation using multiple prediction values. The weighted prediction may include weighted prediction that combines inter and intra, weighted prediction that combines inter and inter, weighted prediction that combines intra and intra, etc. Regarding the weight values ​​of the weighted prediction, the same weight value may be set to different pixel positions of the current block, or different weight values ​​may be set to different pixel positions of the current block.

[0024] Shown in FIG. 2A is a schematic diagram of the inter-weighted prediction triangular partition mode (TPM).

[0025] The TPM prediction block is obtained by combining inter prediction block 1 (i.e., inter prediction mode 1 is adopted to obtain inter prediction value 1 for multiple pixel positions) and inter prediction block 2 (i.e., inter prediction mode 2 is adopted to obtain inter prediction value 2 for multiple pixel positions). The TPM prediction block may be divided into two regions / parts, one region may be inter region 1 and the other region may be inter region 2. The TPM prediction block may be distributed rectangularly, or the two inter regions of the TPM prediction block may be distributed non-rectangularly, and the boundary line between the two inter regions (the dashed line in FIG. 2A ) may be the main diagonal or sub-diagonal of the TPM prediction block.

[0026] Each pixel position of the inter region 1 is determined mainly based on the inter prediction value 1 of the inter prediction block 1. For example, the inter prediction value 1 of the inter prediction block 1 at the pixel position and the inter prediction value 2 of the inter prediction block 2 at the pixel position are weighted to obtain a combined prediction value for the pixel position, where the weight value of the inter prediction value 1 is relatively large and the weight value of the inter prediction value 2 is relatively small (may be 0). Each pixel position of the inter region 2 is determined mainly based on the inter prediction value 2 of the inter prediction block 2. For example, the inter prediction value 1 of the inter prediction block 1 at the pixel position and the inter prediction value 2 of the inter prediction block 2 at the pixel position are weighted to obtain a combined prediction value for the pixel position, where the weight value of the inter prediction value 2 is relatively large and the weight value of the inter prediction value 1 is relatively small (may be 0). Then, a TPM prediction block may be constructed using the combined prediction values ​​of each pixel position.

[0027] FIG. 2B shows a schematic diagram of the geometrical partitioning for inter blocks (GEO) mode. The GEO mode is used to divide an inter prediction block into two sub-blocks using one division line. Unlike the TPM mode, the GEO mode can adopt more division directions, and the weighted prediction process of the GEO mode is similar to that of the TPM mode.

[0028] The GEO prediction block is obtained by combining an inter prediction block 1 (i.e., adopting inter prediction mode 1 to obtain inter prediction value 1 for multiple pixel positions) and an inter prediction block 2 (i.e., adopting inter prediction mode 2 to obtain inter prediction value 2 for multiple pixel positions). The GEO prediction block may be divided into two regions / parts, one region may be inter region 1 and the other region may be inter region 2.

[0029] Each pixel position in inter region 1 is determined mainly based on inter prediction value 1 of inter prediction block 1. For example, when weighting inter prediction value 1 of inter prediction block 1 at the pixel position and inter prediction value 2 of inter prediction block 2 at the pixel position, the weight value of inter prediction value 1 is relatively large and the weight value of inter prediction value 2 is relatively small. Each pixel position in inter region 2 is determined mainly based on inter prediction value 2 of inter prediction block 2. For example, when weighting inter prediction value 1 of inter prediction block 1 at the pixel position and inter prediction value 2 of inter prediction block 2 at the pixel position, the weight value of inter prediction value 2 is relatively large and the weight value of inter prediction value 1 is relatively small.

[0030] 2C , pixel positions A, B, and C are located on the lower right side of the dividing line, and pixel positions D, E, and F are located on the upper left side of the dividing line. For pixel positions A, B, and C, the weight relationship of inter-predicted block 2 is B≧A≧C, and the weight relationship of inter-predicted block 1 is C≧A≧B. For pixel positions D, E, and F, the weight relationship of inter-predicted block 1 is D≧F≧E, and the weight relationship of inter-predicted block 2 is E≧F≧D. The above method requires calculating the distance between a pixel position and the dividing line, and then determining the weight of the pixel position.

[0031] In each of the above cases, to realize weighted prediction, it is necessary to determine the weight value of the predicted block corresponding to each pixel position of the current block, and perform weighted prediction based on the weight value corresponding to the pixel position. However, the setting of the weight value depends on the dividing line, and if the setting of the weight value is unreasonable, it may cause problems such as poor prediction effect and poor coding performance.

[0032] In view of this, an embodiment of the present invention proposes a weight value derivation method, which determines a target weight value for each pixel position of the current block based on the reference weight values ​​of neighboring positions outside the current block, and sets a more reasonable target weight value for each pixel position, making the predicted value closer to the original pixel, thereby improving prediction accuracy, improving prediction performance, and improving coding performance.

[0033] Hereinafter, the encoding / decoding method according to the embodiment of the present invention will be described in detail with reference to some specific examples.

[0034] Example 1: Figure 3 shows a flowchart of an encoding / decoding method, which can be applied to the decoding side (which may also be called a video decoder) or the encoding side (which may also be called a video encoder), and the method may include the following steps:

[0035] Step 301: When it is determined to start weighted prediction for a current block, obtain a weighted prediction angle and weight setting parameters for the current block, the weight setting parameters including a weight transformation rate and a start position of the weight transformation. The start position of the weight transformation may be determined by at least one of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block.

[0036] For example, when a current block needs to be predicted, the decoding side or the encoding side may first determine whether to start weighted prediction for the current block. If weighted prediction for the current block is started, the encoding / decoding method of the embodiment of the present invention is adopted, that is, step 301 and subsequent steps are performed. If weighted prediction for the current block is not started, the embodiment of the present invention does not limit the implementation method.

[0037] For example, when it is determined to start weighted prediction for the current block, the weighted prediction angle, weighted prediction position, and weight transformation rate of the current block may be obtained. Then, the start position of the weight transformation for the current block may be determined based on at least one of the weighted prediction angle, weighted prediction position, and size of the current block. In this way, the weighted prediction angle, weight transformation rate, and start position of the weight transformation for the current block can be obtained.

[0038] Step 302: Set reference weight values ​​at peripheral positions outside the current block according to the weight setting parameters of the current block.

[0039] For example, the number of surrounding positions outside the current block may be determined based on the size of the current block and / or the weighted prediction angle of the current block. For example, if it is determined that the number of surrounding positions outside the current block is M based on the size of the current block and / or the weighted prediction angle of the current block, reference weight values ​​are set for the M surrounding positions based on the weight setting parameters of the current block.

[0040] For example, the reference weight values ​​of the neighboring positions outside the current block may be monotonically increasing or monotonically decreasing, for example, the reference weight values ​​of the neighboring positions outside the current block may be 0 0 ... 0 0 2 4 6 8 8 ... 8 8, or the reference weight values ​​of the neighboring positions outside the current block may be 8 8 ... 8 8 6 4 2 0 0 ... 0 0.

[0041] For example, the peripheral positions outside the current block may include integer pixel positions, sub-pixel positions, or integer pixel and sub-pixel positions. The peripheral positions outside the current block may include, but are not limited to, peripheral positions in the top row outside the current block, peripheral positions in the left column outside the current block, peripheral positions in the bottom row outside the current block, or peripheral positions in the right column outside the current block. Of course, the above are merely examples of peripheral positions, and are not limiting.

[0042] In one possible embodiment, the reference weight values ​​of the peripheral positions outside the current block include a reference weight value of the target region, a reference weight value of the first adjacent region of the target region, and a reference weight value of the second adjacent region of the target region, i.e., the peripheral positions outside the current block may be divided into the target region, the first adjacent region of the target region, and the second adjacent region of the target region.

[0043] For example, the reference weight values ​​of the first adjacent region are all the first reference weight value, and the reference weight values ​​of the second adjacent region monotonically increase. Or, the reference weight values ​​of the first adjacent region are all the first reference weight value, and the reference weight values ​​of the second adjacent region monotonically decrease. Or, the reference weight values ​​of the first adjacent region are all the second reference weight value, and the reference weight values ​​of the second adjacent region are all the third reference weight value, and the second reference weight value is different from the third reference weight value. Or, the reference weight values ​​of the first adjacent region monotonically increase, and the reference weight values ​​of the second adjacent region monotonically increase. Or, the reference weight values ​​of the first adjacent region monotonically decrease, and the reference weight values ​​of the second adjacent region monotonically decrease.

[0044] Illustratively, the target region includes one or at least two reference weight values, and when the target region includes at least two reference weight values, the at least two reference weight values ​​of the target region are monotonically increasing or monotonically decreasing.

[0045] Step 303: for each pixel position of the current block, determine a surrounding matching position pointed to by the pixel position from surrounding positions outside the current block based on the weighted prediction angle of the current block, determine a target weight value of the pixel position based on a reference weight value associated with the surrounding matching position, and determine an associated weight value of the pixel position based on the target weight value of the pixel position.

[0046] For example, the weighted prediction angle represents the angle direction of a pixel position within the current block, for example, based on a weighted prediction angle, the angle direction corresponding to the weighted prediction angle points to a certain external peripheral position of the current block. Based on this, for each pixel position of the current block, the angle direction of the pixel position is determined based on the weighted prediction angle, and then a peripheral matching position pointed to by the pixel position is determined from the peripheral position outside the current block based on the angle direction.

[0047] For each pixel position in the current block, after determining the neighboring matching positions indicated by the pixel position, a target weight value for the pixel position is determined based on the reference weight value associated with the neighboring matching positions. For example, the reference weight value associated with the neighboring matching positions is determined as the target weight value for the pixel position. Then, an associated weight value for the pixel position is determined based on the target weight value for the pixel position. For example, the sum of the target weight value and the associated weight value for each pixel position may be a fixed preset value, and therefore the associated weight value may be the difference between the preset value and the target weight value. Assuming the preset value is 8, if the target weight value for a pixel position is 0, the associated weight value for the pixel position is 8; if the target weight value for a pixel position is 1, the associated weight value for the pixel position is 7; if the sum of the target weight value and the associated weight value is 8, this is analogous.

[0048] Step 304: for each pixel position of the current block, determine a first predicted value for the pixel position based on a first prediction mode of the current block, determine a second predicted value for the pixel position based on a second prediction mode of the current block, and determine a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value.

[0049] For example, assuming that the target weight value is a weight value corresponding to a first prediction mode and the associated weight value is a weight value corresponding to a second prediction mode, the weighted predicted value of the pixel position may be (first predicted value of the pixel position * target weight value of the pixel position + second predicted value of the pixel position * associated weight value of the pixel position) / a fixed preset numerical value.

[0050] Alternatively, assuming that the target weight value is a weight value corresponding to the second prediction mode and the associated weight value is a weight value corresponding to the first prediction mode, the weighted predicted value for the pixel position may be (the second predicted value for the pixel position * the target weight value for the pixel position + the first predicted value for the pixel position * the associated weight value for the pixel position) / a fixed preset numerical value.

[0051] Step 305: Determine a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0052] For example, the weighted predictions of all pixel positions in the current block constitute the weighted predictions of the current block.

[0053] As can be seen from the above technical solutions, the embodiments of the present invention propose an effective method for setting weight values, which can set a reasonable target weight value for each pixel position of the current block, so that the predicted value of the current block can be closer to the original pixels, thereby improving prediction accuracy, improving prediction performance, and improving coding performance.

[0054] Example 2: Based on Example 1, another encoding-decoding method is proposed in this embodiment of the present invention. Figure 4A shows a flowchart of the encoding-decoding method, which may be applied to the encoding side, and may include the following steps:

[0055] In step 401, when it is determined to start weighted prediction for the current block, the encoding side obtains the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation ratio of the current block. For example, the encoding side determines whether to start weighted prediction for the current block, and if so, executes step 401 and subsequent steps; otherwise, the present invention does not limit the processing method.

[0056] In one possible embodiment, if the current block satisfies the conditions for starting weighted prediction, the encoding side may decide to start weighted prediction for the current block. If the current block does not satisfy the conditions for starting weighted prediction, the encoding side may decide not to start weighted prediction for the current block. For example, the encoding side may determine whether feature information of the current block satisfies a specific condition. If so, it may decide to start weighted prediction for the current block, and if not, it may decide not to start weighted prediction for the current block. The feature information may include, but is not limited to, one or any combination of the frame type of the current frame in which the current block is located, size information of the current block, and switch control information. The switch control information may include, but is not limited to, one or any combination of sequence level (SPS (Sequence Parameter Set), SH (Sequence Header)) switch control information, picture level (PPS (Picture Parameter Set), PH (Picture Header)) switch control information, slice level (Slice, Tile, Patch) switch control information, largest coding unit level (LCU (Largest Coding Unit), CTU (Coding Tree Unit)) switch control information, or block level (CU (Coding Unit), PU (Prediction Unit), TU (Transform Unit)) switch control information.

[0057] For example, when the feature information is the frame type of the current frame in which the current block is located, the frame type of the current frame in which the current block is located satisfying a specific condition may include, but is not limited to, determining that the frame type satisfies a specific condition if the frame type of the current frame in which the current block is located is a B frame, or determining that the frame type satisfies a specific condition if the frame type of the current frame in which the current block is located is an I frame.

[0058] For example, if the feature information is the size information of the current block, such as the width and height of the current block, satisfying a certain condition can include, but is not limited to, determining that the size information of the current block satisfies the specific condition if the width is equal to or greater than a first width value and the height is equal to or greater than a second height value; determining that the size information of the current block satisfies the specific condition if the width is equal to or greater than a third width value, the height is equal to or greater than a fourth height value, the width is equal to or less than a fifth width value, and the height is equal to or less than a sixth height value; or determining that the size information of the current block satisfies the specific condition if the product of the width and height is equal to or greater than a product value. The values ​​can be set empirically, such as 8, 16, 32, 64, 128, etc. For example, the first width value is 8, the second height value is 8, the third width value is 8, the fourth height value is 8, the fifth width value is 64, the sixth height value is 64, and the product value is 64. As described above, if the width is 8 or more and the height is 8 or more, it is determined that the size information of the current block satisfies a specific condition. Alternatively, if the width is 8 or more, the height is 8 or more, and the width is 64 or less, and the height is 64 or less, it is determined that the size information of the current block satisfies a specific condition. Alternatively, if the product of the width and height is 64 or more, it is determined that the size information of the current block satisfies a specific condition. The above are merely examples and are not limiting.

[0059] For example, if the feature information is size information of the current block, such as the width and height of the current block, the size information of the current block satisfying a certain condition may include, but is not limited to, that the width is greater than or equal to a and less than or equal to b, and that the height is greater than or equal to a and less than or equal to b. a may be less than or equal to 16, and b may be greater than or equal to 16. For example, a is equal to 8, and b is equal to 64, or b is equal to 32.

[0060] For example, if the feature information is switch control information, the switch control information satisfying a particular condition may include, but is not limited to, determining that the switch control information satisfies a particular condition if the switch control information allows the start of weighted prediction for the current block.

[0061] For example, when the feature information is the frame type of the current frame in which the current block is located and size information of the current block, the feature information of the current block may be determined to satisfy a specific condition if the frame type and size information satisfy a specific condition. Or, when the feature information is the frame type of the current frame in which the current block is located and switch control information, the feature information of the current block may be determined to satisfy a specific condition if the frame type and switch control information satisfy a specific condition. Or, when the feature information is the size information and switch control information of the current block, the feature information of the current block may be determined to satisfy a specific condition if the size information and switch control information satisfy a specific condition. Or, when the feature information is the frame type of the current frame in which the current block is located, size information and switch control information of the current block, the feature information of the current block may be determined to satisfy a specific condition if the frame type, size information and switch control information satisfy a specific condition.

[0062] In one possible embodiment, when it is determined to start weighted prediction for the current block, the encoding side may obtain the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation rate of the current block.

[0063] For example, the weighted prediction angle represents the angular direction of a pixel position within the current block. Figure 4B shows the angular direction of pixel positions within the current block (e.g., pixel position 1, pixel position 2, and pixel position 3) based on a certain weighted prediction angle, which points to a certain peripheral position outside the current block. Figure 4C shows the angular direction of pixel positions within the current block (e.g., pixel position 2, pixel position 3, and pixel position 4) based on another weighted prediction angle, which points to a certain peripheral position outside the current block.

[0064] For example, the weighted prediction position (which may be referred to as a distance parameter) is used to set a reference weight value for the neighboring positions outside the current block. For example, as shown in FIG. 4B or 4C, the range of the neighboring positions outside the current block (e.g., the number of neighboring positions outside the current block) is determined based on parameters such as the weighted prediction angle of the current block and the size of the current block.

[0065] The range of the surrounding positions is then divided into N equal parts, where the value of N can be set arbitrarily, for example, 4, 6, or 8. We will use 8 as an example. The weighted prediction position is used to indicate which surrounding position outside the current block should be used as the starting position for the weighted transformation of the current block, and the reference weight value of the surrounding position outside the current block is set based on the starting position for the weighted transformation.

[0066] As shown in FIG. 4D, seven weighted predicted positions can be obtained after dividing all peripheral positions into eight equal parts. Furthermore, if the weighted predicted position is 0, peripheral position a0 (i.e., the peripheral position indicated by dashed line 0; in actual applications, dashed line 0 does not exist; dashed line 0 is an example for ease of understanding; dashed lines 0 to 6 are used to divide all peripheral positions into eight equal parts) may be used as the starting position for weight conversion of peripheral positions outside the current block. By analogy, if the weighted predicted position is 6, peripheral position a6 may be used as the starting position for weight conversion of peripheral positions outside the current block.

[0067] The value of N may be different for different weighted prediction angles, for example, for weighted prediction angle A, the value of N is 6, representing that the range of peripheral positions determined based on weighted prediction angle A is divided into 6 equal parts, and for weighted prediction angle B, the value of N is 8, representing that the range of peripheral positions determined based on weighted prediction angle B is divided into 8 equal parts.

[0068] The value of N may be the same for different weighted prediction angles, and the number of weighted prediction positions may be different when the value of N is the same. For example, for weighted prediction angle A, the value of N is 8, which means that the range of peripheral positions determined based on weighted prediction angle A is divided into eight equal parts, and for weighted prediction angle B, the value of N is 8, which means that the range of peripheral positions determined based on weighted prediction angle B is divided into eight equal parts, but the weighted prediction positions corresponding to weighted prediction angle A select a total of five positions, a1 to a5, and the weighted prediction positions corresponding to weighted prediction angle B select a total of seven positions, b0 to b6.

[0069] The above is an example of dividing the range of the peripheral position into N equal parts, but in actual applications, an unequal division method may be adopted, for example, instead of dividing into N equal parts, the range of the peripheral position may be divided into N parts, and there is no limitation on this.

[0070] After dividing all the surrounding positions into eight equal parts, seven weighted prediction positions can be obtained, and in step 401, the encoding side may obtain one weighted prediction position from the seven weighted prediction positions, or may select some weighted prediction positions (for example, five weighted prediction positions) from the seven weighted prediction positions and obtain one weighted prediction position from the five weighted prediction positions.

[0071] For example, the weight conversion ratio represents the conversion ratio of the reference weight value at a peripheral position outside the current block and is used to represent the change rate of the reference weight value. The weight conversion ratio may be any number other than 0, for example, -4, -2, -1, 1, 2, 4, 0.5, 0.75, 1.5, etc. When the absolute value of the weight conversion ratio is 1, i.e., when the weight conversion ratio is -1 or 1, it is used to represent that the change rate of the reference weight value is 1, and the reference weight value from 0 to 8 should pass through values ​​of 0, 1, 2, 3, 4, 5, 6, 7, 8, etc., and when the reference weight value from 8 to 0 should pass through values ​​of 8, 7, 6, 5, 4, 3, 2, 1, 0, etc. When the absolute value of the weight conversion ratio is 2, i.e., when the weight conversion ratio is -2 or 2, it is used to represent that the change rate of the reference weight value is 2, and the reference weight value from 0 to 8 should pass through values ​​of 0, 2, 4, 6, 8, etc., and when the reference weight value from 8 to 0 should pass through values ​​of 8, 6, 4, 2, 0, etc. When the absolute value of the weight conversion rate is 0.5, i.e., when the weight conversion rate is -0.5 or 0.5, it is used to indicate that the change rate of the reference weight value is 0.5, and the reference weight value from 0 to 8 must pass through values ​​such as 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, etc., and when the reference weight value from 8 to 0 must pass through values ​​such as 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, etc. Of course, the above example is from 0 to 8, and 0 and 8 can be replaced with any number.

[0072] In step 402, the encoding side sets a reference weight value at a peripheral position outside the current block according to the weight conversion rate of the current block and the starting position of the weight conversion.

[0073] For example, the start position of the weight transformation may be determined based on at least one of the parameters of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block. Therefore, the start position of the weight transformation of the current block may be determined based on at least one of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block. Then, reference weight values ​​are set at peripheral positions outside the current block based on the weight transformation rate and the start position of the weight transformation of the current block.

[0074] Step 403: For each pixel position in the current block, the encoding side determines a neighboring matching position from the neighboring positions outside the current block based on the weighted prediction angle of the current block. For ease of distinction, in this embodiment, the neighboring positions outside the current block pointed to by the pixel position may be referred to as the neighboring matching positions of the pixel position.

[0075] For example, since the weighted prediction angle represents the angular direction of a pixel position within the current block, for each pixel position of the current block, the angular direction of the pixel position is determined based on the weighted prediction angle, and then the surrounding matching position of the pixel position is determined from the surrounding positions outside the current block based on the angular direction.

[0076] The peripheral positions outside the current block may include peripheral positions in one row above the current block, for example, a peripheral position in the n1th row above the current block, where n1 may be 1, 2, 3, etc., without limitation. Alternatively, the peripheral positions may include peripheral positions in one column to the left of the current block, for example, a peripheral position in the n2th column to the left of the current block, where n2 may be 1, 2, 3, etc., without limitation. Alternatively, the peripheral positions may include peripheral positions in one row below the current block, for example, a peripheral position in the n3th row below the current block, where n3 may be 1, 2, 3, etc., without limitation. Alternatively, the peripheral positions may include peripheral positions in one column to the right of the current block, for example, a peripheral position in the n4th column to the right of the current block, where n4 may be 1, 2, 3, etc., without limitation.

[0077] The above are merely some examples of peripheral positions and are not limiting. In actual applications, in addition to using peripheral positions outside the current block, internal positions of the current block can also be used, i.e., internal positions of the current block are used to replace peripheral positions outside the current block. For example, an internal position of row n5 within the current block, where n5 can be 1, 2, 3, etc., can be located. Another example is an internal position of column n6 within the current block, where n6 can be 1, 2, 3, etc. The length of an internal position can extend beyond the scope of the current block; for example, the position of row n7 can extend beyond the scope of the current block, i.e., it can extend outward from both sides of the current block. Internal positions of the current block and peripheral positions outside the current block can also be used simultaneously.

[0078] When using the internal position of the current block, or when using the internal position of the current block and a peripheral position outside the current block at the same time, the current block may be divided into two small blocks, one above the other, based on the row in which the internal position is located, or into two small blocks, one left and one right, based on the column in which the internal position is located, and in this case, the two small blocks have the same weighted prediction angle and the same weighted prediction position.

[0079] For example, the peripheral positions outside the current block may be located between pixel positions, i.e., sub-pixel positions, and in this case, the position of the current block cannot be simply described as the xth row, but is located at a sub-pixel position row located between the xth row and the yth row.

[0080] For ease of explanation, the following embodiments will use the peripheral position in the first row from the top outside the current block or the peripheral position in the first column on the left outside the current block as an example, and the implementation methods for other peripheral positions are similar.

[0081] For example, the range of peripheral positions outside the current block may be specified in advance as a certain range, or the range of peripheral positions outside the current block may be determined based on a weighted prediction angle. For example, the peripheral positions indicated by each pixel position inside the current block may be determined based on a weighted prediction angle, and the boundaries of the peripheral positions indicated by all pixel positions may be within the range of peripheral positions outside the current block, and there is no limitation on the range of peripheral positions.

[0082] The peripheral locations outside the current block may include integer pixel locations and / or non-integer pixel locations, which may be sub-pixel locations, such as, but not limited to, 1 / 2 sub-pixel locations, 1 / 4 sub-pixel locations, 3 / 4 sub-pixel locations, etc.

[0083] For example, two surrounding positions outside the current block may correspond to one integer pixel position, or four surrounding positions outside the current block may correspond to one integer pixel position, or one surrounding position outside the current block may correspond to one integer pixel position, or one surrounding position outside the current block may correspond to two integer pixel positions. Of course, the above are merely some examples and are not limiting, and the relationship between the surrounding positions and the integer pixel positions may be set arbitrarily.

[0084] As shown in Figures 4B and 4C, one peripheral position corresponds to one integer pixel position, and as shown in Figure 4E, two peripheral positions correspond to one integer pixel position, and other cases will not be described in this embodiment.

[0085] In step 404, the encoding side determines a target weight value for the pixel position based on the reference weight values ​​associated with the surrounding matching positions.

[0086] For each pixel position in the current block, after determining the surrounding matching positions pointed to by the pixel position, the encoding side determines a reference weight value associated with the surrounding matching position, and determines a target weight value for the pixel position based on the reference weight value associated with the surrounding matching position, for example, determines the reference weight value associated with the surrounding matching position as the target weight value for the pixel position.

[0087] In one possible embodiment, the encoding side determining the target weight value of the pixel position based on the reference weight values ​​associated with the surrounding matching positions may include the following cases.

[0088] Case 1: if the neighboring matching position is an integer pixel position and a reference weight value is set for the integer pixel position, the target weight value for the pixel position is determined based on the reference weight value for the integer pixel position.

[0089] In case 2, if the neighboring matching position is an integer pixel position and no reference weight value is set for the integer pixel position, the target weight value for the pixel position may be determined based on the reference weight values ​​of neighboring positions of the integer pixel position. For example, the target weight value for the pixel position may be obtained by rounding up the reference weight values ​​of the neighboring positions, or by rounding down the reference weight values ​​of the neighboring positions, or the target weight value for the pixel position may be determined by interpolating the reference weight values ​​of the neighboring positions of the integer pixel position, and this is not a limitation.

[0090] Case 3: If the neighboring matching position is a sub-pixel position and a reference weight value is set for the sub-pixel position, the target weight value for the pixel position can be determined based on the reference weight value for the sub-pixel position.

[0091] In case 4, if the neighboring matching position is a sub-pixel position and no reference weight value is set for the sub-pixel position, the target weight value for the pixel position may be determined based on the reference weight values ​​of the neighboring positions of the sub-pixel position. For example, the target weight value for the sub-pixel position may be obtained by rounding up the reference weight values ​​of the neighboring positions, or by rounding down the reference weight values ​​of the neighboring positions, or the target weight value for the sub-pixel position may be determined by interpolating the reference weight values ​​of the neighboring positions of the sub-pixel position, and this is not a limitation.

[0092] In case 5, a target weight value for the pixel position is determined based on multiple reference weight values ​​associated with the surrounding matching positions. For example, if the surrounding matching positions are integer pixel positions or sub-pixel positions, the reference weight values ​​of multiple neighboring positions of the surrounding matching positions are obtained. If a reference weight value is set for the surrounding matching positions, a weighting calculation is performed based on the reference weight value of the surrounding matching positions and the reference weight values ​​of the multiple neighboring positions to obtain a target weight value for the pixel position. If a reference weight value is not set for the surrounding matching positions, a weighting calculation is performed based on the reference weight values ​​of the multiple neighboring positions to obtain a target weight value for the pixel position.

[0093] In step 405, the encoding side determines the associated weight value of the pixel position based on the target weight value of the pixel position.

[0094] For example, for each pixel position, the sum of the target weight value of the pixel position and the associated weight value of the pixel position may be a fixed preset value, i.e., the associated weight value may be the difference between the preset value and the target weight value. Based on this, assuming the preset value is 8, if the target weight value of the pixel position is 2, the associated weight value of the pixel position is 6.

[0095] Step 406: for each pixel position of the current block, the encoding side determines a first predicted value for the pixel position based on the first prediction mode of the current block, and determines a second predicted value for the pixel position based on the second prediction mode of the current block.

[0096] Exemplarily, the first prediction mode may be any of an intra block copy prediction mode, an intra prediction mode, an inter prediction mode, and a palette mode, and the second prediction mode may be any of an intra block copy prediction mode, an intra prediction mode, an inter prediction mode, and a palette mode. For example, the first prediction mode may be an intra block copy prediction mode and the second prediction mode may be an intra block copy prediction mode, or the first prediction mode may be an intra block copy prediction mode and the second prediction mode may be an intra prediction mode, or the first prediction mode may be an intra block copy prediction mode and the second prediction mode may be an inter prediction mode, or the first prediction mode may be an intra block copy prediction mode and the second prediction mode may be a palette mode. In this analogy, there is no limitation regarding both the first prediction mode and the second prediction mode.

[0097] For the process of determining the predicted value based on the first prediction mode and the second prediction mode, see the following examples.

[0098] In step 407, the encoding side determines a weighted prediction value for the pixel position based on the first prediction value for the pixel position, the target weight value for the pixel position, the second prediction value for the pixel position, and the associated weight value for the pixel position.

[0099] For example, the weighted predicted value for the pixel position may be (first predicted value for the pixel position*target weight value for the pixel position+second predicted value for the pixel position*associated weight value for the pixel position) / a fixed preset numerical value.

[0100] In step 408, the encoding side determines a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0101] As can be seen from the above technical solutions, the embodiments of the present invention propose an effective method for setting weight values, which can set a reasonable target weight value for each pixel position of the current block, so that the predicted value of the current block can be closer to the original pixels, thereby improving prediction accuracy, improving prediction performance, and improving coding performance.

[0102] Example 3: Based on Example 1, another encoding-decoding method is proposed in this embodiment of the present invention, as shown in Figure 4F, which is a flowchart of the encoding-decoding method, and the method may be applied to the decoding side, and the method may include the following steps:

[0103] In step 411, when it is determined to start weighted prediction for the current block, the decoding side obtains the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weight transformation ratio of the current block. For example, the decoding side determines whether to start weighted prediction for the current block, and if so, executes step 411 and subsequent steps; if not, the present invention does not limit the processing method.

[0104] In one possible embodiment, the encoding side determines whether the feature information of the current block satisfies a specific condition, and if so, decides to start weighted prediction for the current block. The decoding side also determines whether the feature information of the current block satisfies a specific condition, and if so, decides to start weighted prediction for the current block; if not, decides not to start weighted prediction for the current block. For how the decoding side determines whether to start weighted prediction for the current block based on the feature information, please refer to step 401, and the description thereof will be omitted here.

[0105] In another possible embodiment, the encoding side determines whether the current block supports weighted prediction based on the feature information of the current block. If the current block supports weighted prediction, it may use another method to determine whether to start weighted prediction for the current block, such as using the RDO principle to determine whether to start weighted prediction for the current block. After determining whether to start weighted prediction for the current block, when the encoding side transmits the encoded bitstream of the current block, the encoded bitstream may include a syntax for whether to start weighted prediction, which syntax indicates whether to start weighted prediction for the current block. The decoding side first determines whether the current block supports weighted prediction based on the feature information of the current block. If the current block supports weighted prediction, the decoding side parses the syntax for whether to start weighted prediction from the encoded bitstream and determines whether to start weighted prediction for the current block based on the syntax.

[0106] For example, when it is determined to start weighted prediction for the current block, the decoding side may obtain the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation rate of the current block. For the description of the weighted prediction angle, the weighted prediction position, and the weighted transformation rate, please refer to step 401, and the description thereof will be omitted here.

[0107] In step 412, the decoding side sets a reference weight value at a peripheral position outside the current block based on the weight conversion rate of the current block and the start position of the weight conversion.

[0108] For example, the decoding side may determine the start position of the weight transformation of the current block based on at least one of the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block, and then set reference weight values ​​at peripheral positions outside the current block based on the weight transformation rate and the start position of the weight transformation of the current block.

[0109] Step 413: For each pixel position of the current block, the decoding side determines a peripheral matching position indicated by the pixel position from peripheral positions outside the current block based on the weighted prediction angle of the current block.

[0110] In step 414, the decoding side determines a target weight value for the pixel position based on the reference weight values ​​associated with the surrounding matching positions.

[0111] In step 415, the decoding side determines the associated weight value for the pixel position based on the target weight value for the pixel position.

[0112] Step 416: for each pixel position of the current block, the decoding side determines a first predicted value for the pixel position based on the first prediction mode of the current block, and determines a second predicted value for the pixel position based on the second prediction mode of the current block.

[0113] In step 417, the decoding side determines a weighted prediction value for the pixel position based on the first prediction value for the pixel position, the target weight value for the pixel position, the second prediction value for the pixel position, and the associated weight value for the pixel position.

[0114] In step 418, the decoding side determines a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0115] For example, the implementation process of steps 412 to 418 may refer to steps 402 to 408, with the difference being that steps 412 to 418 are processing flows on the decoding side, not the encoding side, and therefore the description thereof will be omitted here.

[0116] As can be seen from the above technical solution, the embodiment of the present invention proposes an effective method for setting weight values, which can set a reasonable target weight value for each pixel position of the current block, making the predicted value of the current block closer to the original pixels, thereby improving prediction accuracy, improving prediction performance, and improving encoding and decoding performance.

[0117] Example 4: In Examples 1 to 3, weighting processing needs to be performed based on the weighted prediction angle, and such weighting processing method can be referred to as inter-angular weighted prediction (AWP) mode. That is, if the current block supports the AWP mode, Examples 1 to 3 are adopted to predict the current block and obtain the predicted value of the current block.

[0118] Examples 1 to 3 relate to a weighted prediction angle, which may be any angle, for example, any angle within 180 degrees, or any angle within 360 degrees, for example, 10 degrees, 20 degrees, 30 degrees, etc., and there is no limitation regarding this weighted prediction angle.

[0119] In one possible embodiment, the weighted prediction angle may be a horizontal angle (such as angle 2 in FIG. 7B), or the weighted prediction angle may be a vertical angle (such as angle 6 in FIG. 7B), or the absolute value of the gradient of the weighted prediction angle (the absolute value of the gradient of the weighted prediction angle, i.e., the tangent value of the weighted prediction angle) may be 2 to the power of n (n is an integer, e.g., a positive integer, 0, a negative integer, etc.).

[0120] For example, the absolute value of the gradient of the weighted prediction angle may be 1 (i.e., 2 to the power of 0), 2 (i.e., 2 to the power of 1), 1 / 2 (i.e., 2 to the power of -1), 4 (i.e., 2 to the power of 2), 1 / 4 (i.e., 2 to the power of -2), 8 (i.e., 2 to the power of 3), or 1 / 8 (i.e., 2 to the power of -3), etc. For example, eight types of weighted prediction angles are shown in Figure 5, and the absolute values ​​of the gradients of these weighted prediction angles are 2 to the power of n.

[0121] In the embodiments of the present invention, a weighted prediction angle shift operation may be performed. For an example of performing the weighted prediction angle shift operation, please refer to the subsequent embodiments. Therefore, when the absolute value of the gradient of the weighted prediction angle is 2 n , division can be avoided when performing the weighted prediction angle shift operation, thereby making it easier to realize the shift.

[0122] For example, the number of weighted prediction angles supported by different block sizes (i.e., the size of the current block) may be the same or different, for example, block size A supports eight weighted prediction angles, block size B and block size C support six weighted prediction angles, etc.

[0123] Example 5: In the above examples 1 to 3, the encoding side / decoding side needs to set reference weight values ​​to peripheral positions outside the current block based on the weight conversion rate of the current block and the start position of the weight conversion of the current block. In one possible embodiment, a method may be adopted in which a reference weight value for each peripheral position outside the current block is set based on the coordinate value of the peripheral position, the coordinate value of the start position of the weight conversion, and the weight conversion rate.

[0124] For example, for each peripheral position outside the current block, if the peripheral position is located in the upper or lower row outside the current block, the coordinate value of the peripheral position may be the abscissa value, and the coordinate value of the starting position of the weight transformation may be the abscissa value. Alternatively, if the peripheral position is located in the left or right column outside the current block, the coordinate value of the peripheral position may be the ordinate value, and the coordinate value of the starting position of the weight transformation may be the ordinate value.

[0125] For example, the pixel position in the upper left corner of the current block (e.g., the first pixel position in the upper left corner) may be set as the coordinate origin, and the coordinate values ​​(e.g., abscissa values ​​or ordinate values) of the peripheral positions of the current block and the coordinate values ​​(e.g., abscissa values ​​or ordinate values) of the start position of the weight transformation are all coordinate values ​​relative to the coordinate origin. Of course, another pixel position in the current block may be set as the coordinate origin, and the implementation method is similar to the implementation method using the pixel position in the upper left corner as the coordinate origin.

[0126] In one possible embodiment, the difference between the coordinate values ​​of the surrounding positions and the coordinate values ​​of the start position of the weighting transformation is first determined, and then the product of the difference and the weighting transformation rate of the current block is determined. If the product is smaller than a first value (i.e., the minimum value of the reference weight value, e.g., 0), the reference weight value associated with the surrounding positions is determined to be the first value. If the product is greater than a second value (i.e., the maximum value of the reference weight value, e.g., 8), the reference weight value associated with the surrounding positions is determined to be the second value. If the product is greater than or equal to the first value and less than or equal to the second value, the reference weight value associated with the surrounding positions is determined to be the product. In another possible embodiment, the reference weight value associated with the surrounding positions may be determined directly based on the magnitude relationship between the coordinate values ​​of the surrounding positions and the coordinate values ​​of the start position of the weighting transformation. For example, if the coordinate values ​​of the surrounding positions are smaller than the coordinate values ​​of the start position of the weighting transformation, the reference weight value associated with the surrounding positions is determined to be the first value. If the coordinate values ​​of the surrounding positions are greater than or equal to the coordinate values ​​of the start position of the weighting transformation, the reference weight value associated with the surrounding positions is determined to be the second value. For example, if the coordinate value of the peripheral position is smaller than the coordinate value of the starting position of the weighting transformation, the reference weight value associated with the peripheral position is determined to be a second numerical value, and if the coordinate value of the peripheral position is equal to or greater than the coordinate value of the starting position of the weighting transformation, the reference weight value associated with the peripheral position is determined to be a first numerical value.

[0127] For example, both the first and second numerical values ​​may be set empirically, and the first numerical value may be smaller than the second numerical value, but are not limited to both the first and second numerical values. For example, the first numerical value may be the minimum value of a predetermined reference weight value, such as 0, and the second numerical value may be the maximum value of a predetermined reference weight value, such as 8, and of course, 0 and 8 are also merely examples.

[0128] For example, as shown in Fig. 4D, after dividing all the peripheral positions into eight equal parts, seven weighted predicted positions can be obtained. When the weighted predicted position is 0, it represents peripheral position a0, and the coordinate value of the starting position of the weighted transformation is the coordinate value of peripheral position a0. When the weighted predicted position is 1, it represents peripheral position a1, and the coordinate value of the starting position of the weighted transformation is the coordinate value of peripheral position a1. By this analogy, the method for determining the coordinate value of the starting position of the weighted transformation will not be described here.

[0129] Example 6: In Examples 1 to 3, the encoding side / decoding side needs to set reference weight values ​​at peripheral positions outside the current block based on the weight transformation rate of the current block and the start position of the weight transformation of the current block. In one possible embodiment, the following method may be adopted: obtain the weight prediction angle of the current block, the weight transformation rate of the current block, and the weight prediction position of the current block, determine the start position of the weight transformation of the current block based on the weight prediction position of the current block, and determine weight setting parameters based on the start position of the weight transformation and the weight transformation rate, i.e., the weight setting parameters include the start position and the weight transformation rate of the weight transformation, and determine the reference weight values ​​at peripheral positions outside the current block based on the weight setting parameters.

[0130] The process of setting reference weight values ​​at peripheral positions outside the current block will be described below with reference to a specific implementation method.

[0131] First, obtain the reference weight value of the effective number, and then set the reference weight value of the surrounding position outside the current block based on the reference weight value of the effective number.

[0132] For example, the number of neighboring positions outside the current block is a valid number, and a reference weight value of the valid number needs to be obtained. The valid number may be determined based on the size of the current block and / or the weighted prediction angle of the current block. For example, the valid number ValidLength may be determined using a formula: ValidLength=(N+(M>>X))<<1, where N is the height of the current block, M is the width of the current block, and X is the log2 logarithm of the absolute value of the gradient of the weighted prediction angle of the current block, e.g., 0 or 1, and << represents a left shift and >> represents a right shift.

[0133] a << b may be understood in the present invention as shifting a left by b bits in the form of a two's complement integer representation, and this operation is defined when b is a positive number. Briefly speaking, a << b may be understood as multiplying a by 2 to the power of b. a >> b may be understood in the present invention as shifting a right by b bits in the form of a two's complement integer representation, and this operation is defined when b is a positive number. Briefly speaking, a >> b may be understood as dividing a by 2 to the power of b.

[0134] In a possible embodiment, the reference weight value of the significant digits may increase monotonically or decrease monotonically. Alternatively, the reference weight value of the significant digits may first include a plurality of first weight values and then include a plurality of second weight values, or may first include a plurality of second weight values and then include a plurality of first weight values. Hereinafter, several specific cases will be described with reference to.

[0135] Case 1: The reference weight value of the significant digits may increase monotonically or decrease monotonically. For example, the reference weight value of the significant digits may be [8 8... 8 8 7 6 5 4 3 2 1 0 0... 0 0], that is, it decreases monotonically. Also for example, the reference weight value of the significant digits may be [0 0... 0 0 1 2 3 4 5 6 7 8 8... 8 8], that is, it increases monotonically. Of course, the above are only examples and are not limited in this regard.

[0136] Exemplarily, the reference weight value may be set based on a weight setting parameter, and the weight setting parameter may include a weight conversion rate and a start position of the weight conversion. The acquisition method of the weight conversion rate can refer to subsequent embodiments. The start position of the weight conversion may be a value set empirically, or the start position of the weight conversion may be determined from the weight prediction position, or the start position of the weight conversion may be determined from the weight prediction angle and the weight prediction position, and is not limited in this regard.

[0137] The reference weight values ​​of the effective number may monotonically increase or decrease from the first to the last. For example, the maximum value of the reference weight value is M1, the minimum value of the reference weight value is M2, and the reference weight values ​​of the effective number may monotonically decrease from the maximum value M1 to the minimum value M2, or monotonically increase from the minimum value M2 to the maximum value M1. Assuming that M1 is 8 and M2 is 0, the multiple reference weight values ​​may monotonically decrease from 8 to 0, or monotonically increase from 0 to 8.

[0138] For example, a weight transformation rate and a starting position of the weight transformation may be obtained first, and then a plurality of reference weight values ​​may be determined according to the weight transformation rate and the starting position of the weight transformation. For example, the reference weight value may be determined using the formula y(x)=Clip3(minimum, maximum, a*(xs)), where x represents the index of the peripheral position, that is, the value range of x is 1-significant number, for example, x is 1, representing the first peripheral position, y(x) represents the reference weight value of the xth peripheral position, a represents the weight transformation rate, and s represents the starting position of the weight transformation. The Clip3 function is used to restrict the reference weight value to be between the minimum and maximum values, and both the minimum and maximum values ​​may be set empirically. For convenience of explanation, the following process will be described using an example where the minimum value is 0 and the maximum value is 8.

[0139] a represents a weight conversion rate, and a may be an integer other than 0, for example, a may be -4, -2, -1, 1, 2, 4, etc., and there is no limitation on the value of a. If the absolute value of a is 1, the reference weight value must go from 0 to 8 as 0, 1, 2, 3, 4, 5, 6, 7, 8, or the reference weight value must go from 8 to 0 as 8, 7, 6, 5, 4, 3, 2, 1, 0.

[0140] s represents the starting position of the weighted transformation, and may be determined by the weighted predicted position, for example, s = f (weighted predicted position), i.e., s is a function of the weighted predicted position. For example, after the range of peripheral positions outside the current block is determined, the effective number of peripheral positions may be determined and all peripheral positions may be divided into N equal parts, where the value of N may be arbitrarily set, for example, 4, 6, 8, etc., and the weighted predicted position is used to indicate which peripheral position outside the current block is adopted as the target peripheral region of the current block, and the peripheral position corresponding to this weighted predicted position is the starting position of the weighted transformation. Alternatively, s may be determined by the weighted predicted angle and the weighted predicted position, for example, s = f (weighted predicted angle, weighted predicted position), i.e., s is a function of the weighted predicted angle and the weighted predicted position. For example, the range of peripheral positions outside the current block may be determined based on the weighted prediction angle. After the range of peripheral positions outside the current block is determined, the effective number of peripheral positions may be determined and all peripheral positions may be divided into N equal parts. The weighted prediction position is used to indicate which peripheral position outside the current block is adopted as the target peripheral area of ​​the current block, and the peripheral position corresponding to this weighted prediction position is the starting position of the weighted transformation.

[0141] As described above, in y(x)=Clip3(minimum, maximum, a*(xs)), the weight conversion rate a and the starting position s of the weight conversion are both known values, and for each peripheral position x outside the current block, the reference weight value y(x) of the peripheral position can be determined by this functional relationship. For example, if the weight conversion rate a is 2 and the starting position s of the weight conversion is 2, the functional relationship can be y(x)=Clip3(minimum, maximum, 2*(x-2)), and the reference weight value y(x) can be obtained for each peripheral position x outside the current block.

[0142] In this way, a valid number of reference weight values ​​of the current block can be obtained, and these reference weight values ​​are monotonically increasing or monotonically decreasing. In one possible embodiment, the reference weight values ​​of the peripheral positions outside the current block include a reference weight value of the target area, a reference weight value of the first adjacent area of ​​the target area, and a reference weight value of the second adjacent area of ​​the target area.

[0143] For example, the target region includes one reference weight value or at least two reference weight values. For example, one reference weight value is determined based on the starting position of the weight transformation, and the region corresponding to this reference weight value is set as the target region. For example, at least two reference weight values ​​are determined based on the starting position of the weight transformation, and the region corresponding to the at least two reference weight values ​​is set as the target region.

[0144] When the target region includes at least two reference weight values, the at least two reference weight values ​​of the target region monotonically increase or monotonically decrease. The monotonically increase may be a strict monotonically increase (i.e., the at least two reference weight values ​​of the target region strictly monotonically increase), and the monotonically decrease may be a strict monotonically decrease (i.e., the at least two reference weight values ​​of the target region strictly monotonically decrease). For example, the reference weight values ​​of the target region monotonically increase from 1 to 7, or the reference weight values ​​of the target region monotonically decrease from 7 to 1.

[0145] For example, the reference weight values ​​of the first adjacent region may all be the first reference weight value, and the reference weight values ​​of the second adjacent region may monotonically increase. For example, the reference weight values ​​of the first adjacent region may all be 0, the target region includes one reference weight value, which is 1, and the reference weight values ​​of the second adjacent region monotonically increase from 2 to 8.

[0146] Alternatively, the reference weight values ​​of the first adjacent region may all be the first reference weight value, and the reference weight values ​​of the second adjacent region may monotonically decrease. For example, the reference weight values ​​of the first adjacent region may all be 8, the target region may have one reference weight value that is 7, and the reference weight value of the second adjacent region monotonically decreases from 6 to 0.

[0147] Alternatively, the reference weight values ​​of the first adjacent region are all the second reference weight value, and the reference weight values ​​of the second adjacent region are all the third reference weight value, and the second reference weight value is different from the third reference weight value. For example, the reference weight values ​​of the first adjacent region are all 0, the target region includes at least two reference weight values ​​that monotonically increase from 1 to 7, and the reference weight values ​​of the second adjacent region are all 8, and the reference weight values ​​of the first adjacent region are different from the reference weight values ​​of the second adjacent region.

[0148] Alternatively, the reference weight values ​​of the first adjacent region and the second adjacent region may simultaneously monotonically increase or decrease. For example, the reference weight value of the first adjacent region may monotonically increase, and the reference weight value of the second adjacent region may also monotonically increase. Alternatively, for example, the reference weight value of the first adjacent region may monotonically decrease, and the reference weight value of the second adjacent region may also monotonically decrease. For example, the reference weight value of the first adjacent region may monotonically increase from 0 to 3, the target region may contain one reference weight value, which is 4, and the reference weight value of the second adjacent region may monotonically increase from 5 to 8.

[0149] Case 2: The reference weight value of the effective number may include a plurality of third numerical values ​​before and a plurality of fourth numerical values ​​after, or may include a plurality of fourth numerical values ​​before and a plurality of third numerical values ​​after. For example, the reference weight value of the effective number may be [8 8 ... 8 8 0 0 ... 0 0] or [0 0 ... 0 0 8 8 ... 8 8]. Exemplarily, the plurality of reference weight values ​​may be determined based on the starting position of the weight transformation. For example, the starting position of the weight transformation represents the sth reference weight value. Therefore, all reference weight values ​​before (excluding) the sth reference weight value are the third numerical value (e.g., 8), and all reference weight values ​​after (including) the sth reference weight value are the fourth numerical value (e.g., 0). Alternatively, all reference weight values ​​before the sth reference weight value are the fourth numerical value, and all reference weight values ​​after the sth reference weight value are the third numerical value.

[0150] After obtaining the reference weight values ​​of the effective number, the reference weight values ​​of the surrounding positions outside the current block are set based on the reference weight values ​​of the effective number.

[0151] For example, if the number of neighboring positions outside the current block is a valid number and the number of reference weight values ​​is a valid number, the reference weight values ​​of the valid number may be set as the reference weight values ​​of the neighboring positions outside the current block. For example, the first reference weight value may be set as the reference weight value of the first neighboring position outside the current block, and the second reference weight value may be set as the reference weight value of the second neighboring position outside the current block.

[0152] As described above, the reference weight values ​​have already been set for the peripheral positions outside the current block, i.e., each peripheral position has a reference weight value. Therefore, after determining the peripheral matching position pointed to by the pixel position from the peripheral positions outside the current block, the reference weight value associated with the peripheral matching position, i.e., the target weight value for the pixel position, can be determined.

[0153] The implementation of the above process will be described below with reference to several specific application scenarios. For illustrative purposes, in the following application scenarios, it is assumed that the size of the current block is M*N, where M is the width of the current block and N is the height of the current block. X is the log2 logarithm of the tangent value of the weight prediction angle, e.g., 0 or 1. Y is the index value of the weight prediction position, and A, b, c, and d are preset constants. ValidLength represents a valid number, FirstPos represents the starting position of the weight conversion, ReferenceWeights[i] represents the reference weight value of the i-th surrounding position, and the Clip3 function is used to restrict the reference weight value to be between a minimum value of 0 and a maximum value of 8, i represents the index of the surrounding position outside the current block, and a represents the absolute value of the weight conversion rate.

[0154] Application scenario 1: Determine the valid number (which may be called the reference weight valid length, or ValidLength) based on the size of the current block and the weight prediction angle of the current block, and obtain the start position FirstPos of the weight conversion. For example, ValidLength may be determined using the formula ValidLength=(N+(M>>X))<<1, and FirstPos may be determined using the formula FirstPos=(ValidLength>>1)-A+Y*((ValidLength-1)>>3). Then, derive the reference weight value for each peripheral position of the current block using the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The value range of i may be 0 to ValidLength-1 or 1 to ValidLength. After obtaining the reference weight values ​​ReferenceWeights[i] of the peripheral positions of the current block, the target weight value of the pixel position (x, y) of the current block is derived using the formula SampleWeight[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>X)], where << represents a left shift and >> represents a right shift.

[0155] Application scenario 2: ValidLength may be determined using the formula ValidLength=(N+(M>>X))<<1, and FirstPos may be determined using the formula FirstPos=(ValidLength>>1)-b+Y*((ValidLength-1)>>3)-((M<<1)>>X). Then, reference weight values ​​for each peripheral position of the current block may be derived using the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). Target weight values ​​for each pixel position (x, y) of the current block may be derived using the formula SampleWeight[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>X)].

[0156] Application scenario 3: ValidLength may be determined using the formula ValidLength=(M+(N>>X))<<1, and FirstPos may be determined using the formula FirstPos=(ValidLength>>1)-c+Y*((ValidLength-1)>>3)-((N<<1)>>X). Then, reference weight values ​​for each peripheral position of the current block may be derived using the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). Target weight values ​​for each pixel position (x, y) of the current block may be derived using the formula SampleWeight[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>X)].

[0157] Application scenario 4: ValidLength may be determined using the formula ValidLength=(M+(N>>X))<<1, and FirstPos may be determined using the formula FirstPos=(ValidLength>>1)-d+Y*((ValidLength-1)>>3). Then, reference weight values ​​for each peripheral position of the current block may be derived using the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). Target weight values ​​for each pixel position (x, y) of the current block may be derived using the formula SampleWeight[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>X)].

[0158] Application Scenario 5: Figure 6 shows a schematic diagram of the reference weight values ​​for four types of weight conversion ratios.

[0159] When the absolute value of the weight transformation rate is 1, i.e., when the weight transformation rate is 1 or −1, the reference weight value of each peripheral position of the current block can be derived by the formula ReferenceWeights[i]=Clip3(0,8,1*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,i-FirstPos). In this case, referring to the first case shown in FIG. 6, FirstPos may be 4, i.e., the reference weight values ​​of the first to fourth peripheral positions are 0, the reference weight value of the fifth peripheral position is 1, and the reference weight value of the sixth peripheral position is 2, by analogy.

[0160] If the absolute value of the weight transformation rate is 2, i.e., if the weight transformation rate is 2 or -2, the reference weight value of each peripheral position of the current block is calculated by the formula ReferenceWeights[i]=Clip3(0,8,2*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<1). In this case, referring to the second case shown in Figure 6, FirstPos may be 6, i.e., the reference weight values ​​of the first to sixth peripheral positions are 0, the reference weight value of the seventh peripheral position is 2, and the reference weight value of the eighth peripheral position is 4, by analogy.

[0161] When the absolute value of the weight conversion rate is 4, i.e., when the weight conversion rate is 4 or −4, the reference weight value of each peripheral position of the current block may be derived by the formula ReferenceWeights[i]=Clip3(0,8,4*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<2). In this case, referring to the third case shown in FIG. 6, FirstPos may be 7, and the reference weight values ​​of the first to seventh peripheral positions are 0, the reference weight value of the eighth peripheral position is 4, and the reference weight values ​​of the ninth to seventeenth peripheral positions are 8, as inferred.

[0162] When the absolute value of the weight conversion rate is 8, i.e., when the weight conversion rate is 8 or -8, the reference weight value of each peripheral position of the current block is calculated by the formula ReferenceWeights[i]=Clip3(0,8,8*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<3). In this case, referring to the fourth case shown in FIG. 6, FirstPos may be 8, i.e., the reference weight values ​​of the 1st to 8th peripheral positions are 0, the reference weight value of the 9th peripheral position is 9, and the reference weight values ​​of the 10th to 17th peripheral positions are 8, as inferred.

[0163] As described above, when the absolute value of the weight conversion rate is 1, FirstPos is 4, when the absolute value of the weight conversion rate is 2, FirstPos is 6 (i.e., FirstPos+2 when the weight conversion rate is 1), and when the absolute value of the weight conversion rate is 4, FirstPos is 7 (i.e., FirstPos+3 when the weight conversion rate is 1), and based on this, the position of the reference weight value 4 can be adjusted.

[0164] For example, if weight transformation rate switching is supported for the current block, and one of the four reference weight value distribution examples for weight transformation rates shown in FIG. 6 is selected and switched upon initiating the weight transformation rate switching, the weight transformation rate can be switched for an image or a local region of the image, thereby reducing the noticeable jumps in image display in some image display scenarios. For example, if the problem of relatively noticeable jumps needs to be solved in some image display scenarios, weight change rate switching in AWP mode can solve this problem. For example, mixed image content may include partial screen content, animation, images containing animation, etc., and weight transformation rate switching may be performed for a region containing screen content, solving the problem of relatively noticeable jumps.

[0165] In the above process, ValidLength is related to the weighted prediction angle of the current block and the size of the current block. To simplify the technical solution, some parameters may be constant for optimization. For example, the weighted prediction angle of the current block may be set as a fixed parameter value, and ValidLength is related only to the size of the current block. FirstPos is related to the weighted prediction angle of the current block, the size of the current block, and the weighted prediction position of the current block. For example, the weighted prediction angle of the current block may be set as a fixed parameter value, and FirstPos is related only to the size and weighted prediction position of the current block. Alternatively, the weighted prediction position of the current block may be set as a fixed parameter value, and FirstPos is related only to the size and weighted prediction angle of the current block. Alternatively, the weighted prediction angle of the current block and the weighted prediction position of the current block may both be set as fixed parameter values, and these two fixed parameter values ​​may be the same or different, and FirstPos is related only to the size of the current block.

[0166] In the first to third embodiments, the encoding / decoding side needs to set reference weight values ​​at peripheral positions outside the current block based on the weight transformation rate of the current block and the starting position of the weight transformation of the current block. In one possible embodiment, M and N are respectively the width and height of the current block, and as shown in FIG. 7A, the weight array derivation method for the angle weighted prediction mode (AWP) includes:

[0167] Step a1: Obtain parameters such as stepIdx, angleIdx, and subAngleIdx based on AwpIdx.

[0168] For example, AwpIdx represents an index value of a weighted prediction position and a weighted prediction angle, and assuming that there are seven weighted prediction positions and eight weighted prediction angles, the value range of AwpIdx is 0 to 55. If the weighted prediction positions range from -3 to 3 (the fourth weighted prediction position is the center and the fourth weighted prediction position is 0) and the index of the weighted prediction angle ranges from 0 to 7, the weighted prediction positions and weighted prediction angles corresponding to the 56 index values ​​of AwpIdx can be found in Table 1. [Table 1]

[0169] Exemplarily, stepIdx represents a weighted prediction position (e.g., an index value of the weighted prediction position), and the range of the weighted prediction position may be from −3 to 3. For example, for the first weighted prediction position, the index value of the weighted prediction position is −3, for the second weighted prediction position, the index value of the weighted prediction position is −2, and similarly, for the seventh weighted prediction position, the index value of the weighted prediction position is 3.

[0170] where angleIdx represents the log2 logarithm of the absolute value of the gradient of the weighted prediction angle (e.g., 0, 1, or a large constant), and subAngleIdx represents the angle area in which the weighted prediction angle is located. Figure 7B shows eight weighted prediction angles, where angleIdx for weighted prediction angle 0 is the log2 logarithm of the absolute value of the gradient of weighted prediction angle 0, and angleIdx for weighted prediction angle 1 is the log2 logarithm of the absolute value of the gradient of weighted prediction angle 1. Similarly, angleIdx for weighted prediction angle 7 is the log2 logarithm of the absolute value of the gradient of weighted prediction angle 7. Weighted prediction angles 0 and 1 are located in angle area 0, weighted prediction angles 2 and 3 are located in angle area 1, weighted prediction angles 4 and 5 are located in angle area 2, and weighted prediction angles 6 and 7 are located in angle area 3.

[0171] For example, stepIdx may be determined by employing the formula: stepIdx=(AwpIdx>>3)-3.

[0172] For example, modAngNum (angle number) may be determined first according to the formula modAngNum=AwpIdx%8, and then according to modAngNum, if modAngNum is equal to 2, angleIdx=7; if modAngNum is equal to 6, angleIdx=8; otherwise, angleIdx may be determined by adopting the formula angleIdx=modAngNum%2.

[0173] Exemplarily, subAngleIdx may be determined by employing the formula: subAngleIdx=modAngNum>>1.

[0174] As described above, the encoding side determines the weighted prediction angle of the current block and the weighted prediction position of the current block, and then determines the value of AwpIdx based on the weighted prediction angle and the weighted prediction position, as shown in Table 1. When the encoding side transmits an encoded bitstream to the decoding side, it may add the value of AwpIdx to the encoded bitstream, and the decoding side can obtain the value of AwpIdx based on AwpIdx, and obtain stepIdx, angleIdx, and subAngleIdx based on AwpIdx.

[0175] For example, as shown in Table 2, angleIdx and subAngleIdx can uniquely determine one weighted prediction angle, but of course, other methods can also be used to determine the weighted prediction angle, such as changing the area number. [Table 2]

[0176] Step a2: Set a reference weight value at a peripheral position outside the current block based on stepIdx, angleIdx, and subAngleIdx. Step a2 may be performed in the following cases:

[0177] In case 1, when subAngleIdx is 0, that is, the weighted prediction angle is located in angle area 0, for example, when the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the weight conversion start position FirstPos may be determined using the formula FirstPos=(ValidLength_H>>1)-6+DeltaPos_H. Then, the reference weights of the peripheral positions outside the current block are determined using the formula ReferenceWeights[x]=Clip3(0,8,x-FirstPos). In this formula, the minimum reference weight is 0, the maximum reference weight is 8, and the weight conversion rate is 1. That is, the above formula may be equivalent to ReferenceWeights[x]=Clip3(minimum, maximum, a*(x-FirstPos)). x may be an index of the peripheral position outside the current block, where the value range of x is 0 to ValidLength_H-1, and a represents the weight conversion rate.

[0178] In the above formula, ValidLength_H may represent the number of peripheral positions outside the current block (i.e., the valid number, which may also be called the valid length). When subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be the peripheral position in the first column to the left, and therefore the valid number may be represented as ValidLength_H. For example, the valid number ValidLength_H may be determined using the formula ValidLength_H=(N+(M>>angleIdx))<<1. The reason for shifting left by one bit here is that the formula uses 1 / 2-pel precision. If it is 1-pel precision, then ValidLength_H=(N+(M>>angleIdx)), if it is 1 / 4-pel precision, then ValidLength_H=(N+(M>>angleIdx))<<2, and if it is 2-pel precision, then ValidLength_H=(N+(M>>angleIdx))>>1. Other pixel precisions can also be inferred in this way, and explanations will be omitted. In the formulas that follow, some related >>1 operations may change depending on the pixel precision.

[0179] In the above formula, DeltaPos_H represents a position change amount parameter (i.e., one intermediate parameter), and when subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be a peripheral position one column to the left of the current block, so the position change amount parameter may be written as DeltaPos_H. For example, DeltaPos_H may be determined using the formula DeltaPos_H=stepIdx*((ValidLength_H>>3)-1).

[0180] In case 2, when subAngleIdx is 1, that is, the weighted prediction angle is located in angle area 1, for example, when the weighted prediction angle is weighted prediction angle 2 or weighted prediction angle 3, the start position FirstPos of the weight conversion may be determined using the formula FirstPos=(ValidLength_H>>1)-4+DeltaPos_H-((M<<1)>>angleIdx). Then, the reference weights of the peripheral positions outside the current block are determined using the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)). In this formula, the minimum reference weight is 0, the maximum reference weight is 8, and the weight conversion rate is a. x may be an index of the peripheral positions outside the current block, and the value range of x is from 0 to ValidLength_H-1.

[0181] In the above formula, ValidLength_H and DeltaPos_H can refer to case 1, and the description thereof will be omitted here.

[0182] In case 3, when subAngleIdx is 2, that is, the weighted prediction angle is located in angle area 2, for example, when the weighted prediction angle is weighted prediction angle 4 or weighted prediction angle 5, the start position FirstPos of the weight conversion may be determined using the formula FirstPos=(ValidLength_W>>1)-4+DeltaPos_W-((N<<1)>>angleIdx). Then, the reference weights of the peripheral positions outside the current block are determined using the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)). In this formula, the minimum reference weight is 0, the maximum reference weight is 8, and the weight conversion rate is a. x may be an index of the peripheral positions outside the current block, and the value range of x is from 0 to ValidLength_W-1.

[0183] In the above formula, ValidLength_W represents the number of peripheral positions outside the current block (i.e., a valid number, which may also be called a valid length). When subAngleIdx is 2, the peripheral positions outside the current block indicated by the weighted prediction angle may be peripheral positions in the top row, and therefore the valid number is denoted as ValidLength_W. For example, the valid number ValidLength_W may be determined using the formula ValidLength_W=(M+(N>>angleIdx))<<1.

[0184] In the above formula, DeltaPos_W represents a position change amount parameter (i.e., one intermediate parameter), and when subAngleIdx is 2, the peripheral position outside the current block indicated by the weighted prediction angle may be the peripheral position in the upper row outside the current block, and therefore the position change amount parameter may be denoted as DeltaPos_W. For example, DeltaPos_W may be determined using the formula DeltaPos_W=stepIdx*((ValidLength_W>>3)-1).

[0185] In case 4, when subAngleIdx is 3, that is, the weighted prediction angle is located in angle area 3, for example, when the weighted prediction angle is weighted prediction angle 6 or weighted prediction angle 7, the start position FirstPos of the weight conversion may be determined using the formula FirstPos=(ValidLength_W>>1)-6+DeltaPos_W. Then, the reference weights of the peripheral positions outside the current block may be determined using the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)), where the minimum reference weight is 0, the maximum reference weight is 8, and the weight conversion rate is a. x may be an index of the peripheral positions outside the current block, and the value range of x is from 0 to ValidLength_W-1.

[0186] In the above formula, ValidLength_W and DeltaPos_W can refer to case 3, and the description thereof will be omitted here.

[0187] As described above, which case should be adopted can be determined based on subAngleIdx. For example, in cases 1 and 2, ValidLength_H and DeltaPos_H may be determined based on angleIdx and stepIdx, FirstPos may be determined based on ValidLength_H and DeltaPos_H, and the reference weight value may then be set based on FirstPos. In cases 3 and 4, ValidLength_W and DeltaPos_W may be determined based on angleIdx and stepIdx, FirstPos may be determined based on ValidLength_W and DeltaPos_W, and the reference weight value may then be set based on FirstPos.

[0188] The difference between the formulas in each of the above cases is that the starting position of the reference weight value ReferenceWeights[x] changes when the coordinate origin is the upper left corner of the current block. For example, Figure 7C shows examples of angle area 2 and angle area 3. In the case of 1 / 2-pel precision, the starting position of the reference weight value ReferenceWeights[x] is (height<<1)>>angleIdx, i.e., the offset in the formula is "-((N<<1)>>angleIdx)". The implementation for angle area 0 and angle area 1 is similar, but the offset in the formula is "-((M<<1)>>angleIdx)", i.e., height needs to be changed to width.

[0189] Step a3: obtain the luminance weight value of the pixel position based on the angleIdx and the reference weight value ReferenceWeights[x].

[0190] Case 1: If subAngleIdx is 0, the brightness weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)], where (y<<1)+((x<<1)>>angleIdx) represents the peripheral positions indicated by pixel position (x, y), and ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)] represents the reference weight values ​​of the peripheral positions. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.

[0191] Case 2: If subAngleIdx is 1, the brightness weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)], where (y<<1)-((x<<1)>>angleIdx) and (y<<1)+((x<<1)>>angleIdx) represent the peripheral positions indicated by pixel position (x, y), and ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)] represents the reference weight values ​​of the peripheral positions. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.

[0192] Case 3: If subAngleIdx is 2, the brightness weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)], where (x<<1)-((y<<1)>>angleIdx) and (y<<1)+((x<<1)>>angleIdx) represent the peripheral positions indicated by pixel position (x, y), and ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)] represents the reference weight values ​​of the peripheral positions. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.

[0193] Case 4: If subAngleIdx is 3, the brightness weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)], where (x<<1)+((y<<1)>>angleIdx) and (y<<1)+((x<<1)>>angleIdx) represent the peripheral positions indicated by pixel position (x, y), and ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)] represents the reference weight values ​​of the peripheral positions. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.

[0194] The above steps a2 and a3 may be integrated into one step, i.e., step a2 (setting reference weight values ​​at peripheral positions outside the current block based on stepIdx, angleIdx, and subAngleIdx) and step a3 (obtaining brightness weight values ​​based on angleIdx and reference weight value ReferenceWeight[x]) are integrated to obtain the brightness weight value of the pixel position based on stepIdx, angleIdx, and subAngleIdx, i.e., determined based on the coordinate values ​​of the peripheral positions and the coordinate values ​​of the weight transformation start position.

[0195] Taking case 1 as an example, when subAngleIdx is 0, that is, the weighted prediction angle is located in angle area 0, for example, when the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the formula FirstPos=(ValidLength_H>>1)-6+DeltaPos_H is used to determine the start position FirstPos of the weighted transformation.Then, the formula AwpWeightArrayY[x][y]=Clip3(0,8,(y<<1)+((x<<1)>>angleIdx)-FirstPos) is used to determine the brightness weight value of pixel position (x, y), where (y<<1)+((x<<1)>>angleIdx) represents the peripheral matching position indicated by pixel position (x, y).The same applies to other cases.

[0196] Step a4: obtain a chromaticity weight value of a pixel position based on the luminance weight value of the pixel position, and the luminance weight value of the pixel position and the chromaticity weight value of the pixel position can constitute a target weight value of the pixel position.

[0197] For example, if the chromaticity resolution format is 4:2:0, the chromaticity weight value at pixel position (x, y) is determined by the formula AwpWeightArrayUV[x][y]=AwpWeightArrayY[x<<1][y<<1]. Also, if the chromaticity resolution format is 4:4:4, the chromaticity weight value at pixel position (x, y) is determined by the formula AwpWeightArrayUV[x][y]=AwpWeightArrayY[x][y], where x is in the range of 0 to M / 2-1 and y is in the range of 0 to N / 2-1.

[0198] Another implementation of step a4 is to obtain the chromaticity weight value of a pixel position based on angleIdx and the reference weight value ReferenceWeight[x], rather than based on the luma weight value. For example, if the chromaticity resolution format is 4:2:0, the chromaticity weight value of a pixel position is obtained based on angleIdx and the reference weight value ReferenceWeight[x].

[0199] For example, if subAngleIdx is 0, the chromaticity weight value at pixel position (x, y) may be determined by employing the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)+((x<<2)>>angleIdx)].

[0200] For example, if subAngleIdx is 1, the chromaticity weight value at pixel position (x, y) may be determined by employing the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)-((x<<2)>>angleIdx)].

[0201] For example, if subAngleIdx is 2, the chromaticity weight value at pixel position (x, y) may be determined by employing the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)-((y<<2)>>angleIdx)].

[0202] For example, if subAngleIdx is 3, the chromaticity weight value at pixel position (x, y) may be determined by employing the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)+((y<<2)>>angleIdx)].

[0203] In the above formulas, the value range of x is from 0 to M-1, and the value range of y is from 0 to N-1.

[0204] Regarding the differences in the formulas used in steps a3 and a4, FIG. 7D shows examples of angle area 2 and angle area 3. When the coordinate origin is the upper left corner of the current block, the formula for the matching position (x, y) in angle area 2 can be xy>>angleIdx, and the formula for the matching position (x, y) in angle area 3 can be x+y>>angleIdx. In the case of 1 / 2-pel accuracy, the formula for the matching position (x, y) in angle area 2 can be (x<<1)-(y<<1)>>angleIdx, and the formula for the matching position (x, y) in angle area 3 can be (x<<1)+(y<<1)>>angleIdx. Angle area 0 is similar to angle area 1, except that the (x, y) positions are swapped.

[0205] Example 8: In Examples 1 to 3, the encoding side / decoding side needs to obtain the weighting conversion rate of the current block. If the current block supports the weighting conversion rate switching mode, the encoding side / decoding side obtains first weighting conversion rate indication information of the current block and determines the weighting conversion rate of the current block based on the first weighting conversion rate indication information to obtain the weighting conversion rate of the current block. Exemplarily, if the first weighting conversion rate indication information is first indication information, the weighting conversion rate of the current block is the first weighting conversion rate, and if the first weighting conversion rate indication information is second indication information, the weighting conversion rate of the current block is the second weighting conversion rate. If the current block does not support the weighting conversion rate switching mode, a preset weighting conversion rate is determined as the weighting conversion rate of the current block. The first weighting conversion rate indication information can be obtained from the LCU, frame, image, or sequence in which the current block is located. Exemplarily, the first weighting conversion rate indication information may be image-level indication information, such as PPS or PH level indication information.

[0206] As described above, when the current block supports the weight transformation rate switching mode, the weight transformation rate of the current block may be the first weight transformation rate or the second weight transformation rate, and the first weight transformation rate is different from the second weight transformation rate, that is, the weight transformation rate of the current block is variable, so that the weight transformation rate can be adaptively switched instead of adopting a single unified weight transformation rate.

[0207] For example, if the switching control information allows the current block to start the weight transformation rate switching mode, the current block supports the weight transformation rate switching mode, and if the switching control information does not allow the current block to start the weight transformation rate switching mode, the current block does not support the weight transformation rate switching mode. The switching control information may include, but is not limited to, sequence level switching control information, picture level switching control information, slice level switching control information, tile level switching control information, patch level switching control information, CTU level switching control information, LCU level switching control information, block level switching control information, CU level switching control information, PU level switching control information, etc.

[0208] The encoding side can know the switching control information and know whether the switching control information allows the current block to start the weight transformation rate switching mode, and then determine whether the current block supports the weight transformation rate switching mode. The encoding side may encode the switching control information into a bitstream, so that the decoding side can parse the switching control information from the bitstream, know whether the switching control information allows the current block to start the weight transformation rate switching mode, and then determine whether the current block supports the weight transformation rate switching mode. Instead of encoding the switching control information into a bitstream, the encoding side may implicitly derive the switching control information by the decoding side, know whether the switching control information allows the current block to start the weight transformation rate switching mode, and then determine whether the current block supports the weight transformation rate switching mode.

[0209] Taking the sequence-level switching control information as an example, the sequence-level switching control information may be awp_adptive_flag (inter-angle weighted prediction adaptive flag bit), where when awp_adptive_flag is a first value, it indicates that the sequence-level switching control information allows the start of the weight conversion rate switching mode for the current sequence, thereby allowing the start of the weight conversion rate switching mode for the current block; when awp_adptive_flag is a second value, it indicates that the sequence-level switching control information does not allow the start of the weight conversion rate switching mode for the current sequence, thereby not allowing the start of the weight conversion rate switching mode for the current block. Exemplarily, the first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above are merely examples of the first and second values ​​and are not limiting. For other types of switching control information, the implementation process is similar to that of the sequence-level switching control information, and description thereof will be omitted here.

[0210] In one possible embodiment, the first weighted transformation ratio indication information of the current block may be an SCC (Screen Content Coding) identifier corresponding to the current block, where the first indication information is used to indicate that the current block belongs to screen content coding and the second indication information is used to indicate that the current block belongs to non-screen content coding. Then, the SCC identifier corresponding to the current block may be obtained, and the weighted transformation ratio of the current block may be determined based on the SCC identifier. For example, if the SCC identifier is used to indicate that the current block belongs to screen content coding, the weighted transformation ratio of the current block is the first weighted transformation ratio, and if the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the weighted transformation ratio of the current block is the second weighted transformation ratio.

[0211] For example, the absolute value of the first weighted conversion rate may be greater than the absolute value of the second weighted conversion rate. For example, the absolute value of the first weighted conversion rate may be 4, and the absolute value of the second weighted conversion rate may be 1 or 2. For example, the absolute value of the first weighted conversion rate may be 2, and the absolute value of the second weighted conversion rate may be 1. For example, the absolute value of the first weighted conversion rate may be 8, and the absolute value of the second weighted conversion rate may be 1, 2, or 4. For example, the absolute value of the first weighted conversion rate may be 8 or 4, and the absolute value of the second weighted conversion rate may be 1 or 2. Of course, the above are merely a few examples and are not limiting, as long as the absolute value of the first weighted conversion rate is greater than the absolute value of the second weighted conversion rate.

[0212] Exemplarily, the SCC identifier may include, but is not limited to, a sequence-level SCC identifier, a picture-level SCC identifier, a slice-level SCC identifier, a tile-level SCC identifier, a patch-level SCC identifier, a CTU-level SCC identifier, an LCU-level SCC identifier, a block-level SCC identifier, a CU-level SCC identifier, a PU-level SCC identifier, etc. For example, the sequence-level SCC identifier corresponding to the current block may be determined as the SCC identifier corresponding to the current block, or the picture-level SCC identifier corresponding to the current block may be determined as the SCC identifier corresponding to the current block. By this analogy, the SCC identifier corresponding to the current block may be obtained.

[0213] For example, the encoding side may determine whether the current block belongs to screen content coding or non-screen content coding. If the current block belongs to screen content coding, the encoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the current block belongs to non-screen content coding, the encoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate. Alternatively, the encoding side may obtain an SCC identifier corresponding to the current block. If the SCC identifier is used to indicate that the current block belongs to screen content coding, the encoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the encoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate.

[0214] The encoding side may encode an SCC identifier (e.g., a sequence-level SCC identifier, a picture-level SCC identifier, a slice-level SCC identifier, etc.) into the bitstream, so that the decoding side can analyze the SCC identifier from the bitstream and determine the SCC identifier as the SCC identifier corresponding to the current block. For example, the sequence-level SCC identifier corresponding to the current block may be determined as the SCC identifier corresponding to the current block. As described above, the decoding side can know the SCC identifier corresponding to the current block. If the SCC identifier is used to indicate that the current block belongs to screen content coding, the decoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the decoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate. For example, if the SCC identifier is a first value, it is used to indicate that the current block belongs to screen content coding, and if the SCC identifier is a second value, it is used to indicate that the current block belongs to non-screen content coding. The first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above are merely examples of the first value and the second value and are not limiting in this regard.

[0215] Instead of encoding the SCC identifier into the bitstream, the encoding side may implicitly derive the SCC identifier using information consistent with the decoding side. In this case, the decoding side may also implicitly derive the SCC identifier and determine the SCC identifier as the SCC identifier corresponding to the current block. For example, if multiple consecutive frames are all screen content coded, the decoding side may derive that the current frame is screen content coded, and therefore implicitly derive an image-level SCC identifier and determine the SCC identifier as the SCC identifier corresponding to the current block, which is used to indicate that the current block belongs to screen content coding. For example, if multiple consecutive frames are all non-screen content coded, the decoding side may derive that the current frame is non-screen content coded, and therefore implicitly derive an image-level SCC identifier, which is used to indicate that the current block belongs to non-screen content coding. For example, if the occupancy rate of IBC mode among all selected modes of the current image is less than a certain percentage, the next frame is determined to be non-screen content coded; otherwise, screen content coding continues. Of course, the above method is merely an example of implicitly deriving an SCC identifier, and is not limited to this implicit derivation method. As described above, the decoding side can obtain an SCC identifier corresponding to the current block. If the SCC identifier is used to indicate that the current block belongs to screen content coding, the decoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the decoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate. For example, if the SCC identifier is a first value, it is used to indicate that the current block belongs to screen content coding, and if the SCC identifier is a second value, it is used to indicate that the current block belongs to non-screen content coding.

[0216] As described above, the weight conversion rate of the current block may be the first weight conversion rate or the second weight conversion rate, that is, the weight conversion rate of the current block is switchable, and the switching of the weight conversion rate depends on a certain level of SCC explicit identifier or SCC implicit identifier, where the SCC explicit identifier means encoding scc_flag (SCC identifier) ​​into the bitstream so that the decoding side parses the SCC identifier from the bitstream, and the SCC implicit identifier means adaptively deriving the SCC identifier based on information available to the decoding side.

[0217] The SCC identifier at a certain level refers to the SCC identifier of the current sequence at the sequence level, which is used as the SCC identifier for all blocks belonging to the current sequence; the image level refers to the SCC identifier of the current frame, which is used as the SCC identifier for all blocks belonging to the current frame; the slice level refers to the SCC identifier of the current slice, which is used as the SCC identifier for all blocks belonging to the current slice; the tile level refers to the SCC identifier of the current tile, which is used as the SCC identifier for all blocks belonging to the current tile; the patch level refers to the SCC identifier of the current patch, which is used as the SCC identifier for all blocks belonging to the current patch. The SCC identifier is used as the SCC identifier for all blocks belonging to the current CTU, the CTU level indicates the SCC identifier for the current CTU, and the SCC identifier is used as the SCC identifier for all blocks belonging to the current CTU, the LCU level indicates the SCC identifier for the current LCU, and the SCC identifier is used as the SCC identifier for all blocks belonging to the current LCU, the block level indicates the SCC identifier for the current block, and the SCC identifier is used as the SCC identifier belonging to the current block, the CU level indicates the SCC identifier for the current CU, and the SCC identifier is used as the SCC identifier belonging to the current CU, and the PU level indicates the SCC identifier for the current PU, and the SCC identifier is used as the SCC identifier belonging to the current PU.

[0218] For example, the second weighted transform rate may be the default weighted transform rate, and when the SCC identifier is used to indicate that the current block belongs to non-screen content coding, there is no need to switch the weighted transform rate, i.e., the weighted transform rate of the current block is determined to be the second weighted transform rate. When the SCC identifier is used to indicate that the current block belongs to screen content coding, there is no need to switch the weighted transform rate, i.e., the weighted transform rate of the current block is determined to be the first weighted transform rate. Alternatively, the first weighted transform rate may be the default weighted transform rate, and when the SCC identifier is used to indicate that the current block belongs to non-screen content coding, there is no need to switch the weighted transform rate, i.e., the weighted transform rate of the current block is determined to be the second weighted transform rate. When the SCC identifier is used to indicate that the current block belongs to screen content coding, there is no need to switch the weighted transform rate, i.e., the weighted transform rate of the current block is determined to be the first weighted transform rate.

[0219] 8A shows a schematic diagram of an SCC sequence (i.e., a sequence belonging to screen content coding), and FIG. 8B shows a schematic diagram of a natural sequence (i.e., a sequence belonging to non-screen content coding). In the case of an SCC sequence, a color change is completed in one pixel, while in the case of a natural sequence, a color change needs to go through a transition of several pixels. From the above, it can be seen that an SCC sequence usually has characteristics such as a large color matching area and abrupt color changes, and the weighted prediction for an SCC sequence should also be adapted to such characteristics. Therefore, it can be seen that the weight value of the AWP mode should reduce the smooth transition characteristics, i.e., increase the weight conversion rate to adapt to the characteristics of the SCC sequence. As described above, if the current block belongs to screen content coding, the weighted transformation factor of the current block is the first weighted transformation factor; if the current block belongs to non-screen content coding, the weighted transformation factor of the current block is the second weighted transformation factor, and the absolute value of the first weighted transformation factor is greater than the absolute value of the second weighted transformation factor, e.g., the absolute value of the first weighted transformation factor is 4 and the absolute value of the second weighted transformation factor is 1. As a result, the absolute value of the weighted transformation factor of the current block belonging to the SCC sequence increases, that is, the transformation speed increases. For example, Table 3 shows the performance gains (e.g., BD-rate performance gains) of actual tests for SCC sequences, which are used to represent the performance gains when the weighted transformation factor switches from 1 to 4. From Table 3, it can be seen that for the Y channel component of SCC sequence 1, when the weighted transformation factor switches from 1 to 4, a BD-rate performance gain of -1.83% is obtained, which corresponds to a 1.83% reduction in bit rate by switching the weighted transformation factor under comparable objective quality conditions. For the U channel component of SCC sequence 1, when the weighting factor is switched from 1 to 4, the bit rate can be reduced by 1.19%, and for the V channel component of SCC sequence 1, when the weighting factor is switched from 1 to 4, the bit rate can be reduced by 1.05%. When the weighting factor is switched from 1 to 4, the coding complexity on the encoding side remains the same, but the decoding complexity on the decoding side increases by 101%.For other SCC sequences, when the weighting factor is switched from 1 to 4, the bit rate can be reduced, and the performance gain can be increased as described above. [Table 3]

[0220] In another possible embodiment, the first weight conversion rate indication information for the current block may be a weight conversion rate switching identifier corresponding to the current block, where the first indication information is used to indicate that the current block does not need to undergo weight conversion rate switching, and the second indication information is used to indicate that the current block needs to undergo weight conversion rate switching. Then, the weight conversion rate switching identifier corresponding to the current block may be obtained, and the weight conversion rate for the current block may be determined based on the weight conversion rate switching identifier. For example, if the weight conversion rate switching identifier is used to indicate that the current block does not need to undergo weight conversion rate switching, the weight conversion rate for the current block may be the first weight conversion rate, and if the weight conversion rate switching identifier is used to indicate that the current block needs to undergo weight conversion rate switching, the weight conversion rate for the current block may be the second weight conversion rate. The absolute value of the first weight conversion rate is not equal to the absolute value of the second weight conversion rate. For example, the absolute value of the first weight conversion rate may be greater than the absolute value of the second weight conversion rate, e.g., the absolute value of the first weight conversion rate may be 4, and the absolute value of the second weight conversion rate may be 1 or 2. Alternatively, the absolute value of the first weighted conversion factor may be 2, and the absolute value of the second weighted conversion factor may be 1. Alternatively, the absolute value of the first weighted conversion factor may be 8, and the absolute value of the second weighted conversion factor may be 1, 2, or 4. Furthermore, for example, the absolute value of the first weighted conversion factor may be smaller than the absolute value of the second weighted conversion factor, and for example, the absolute value of the first weighted conversion factor may be 1, and the absolute value of the second weighted conversion factor may be 2, 4, or 8. Alternatively, the absolute value of the first weighted conversion factor may be 2, and the absolute value of the second weighted conversion factor may be 4 or 8. Alternatively, the absolute value of the first weighted conversion factor may be 4, and the absolute value of the second weighted conversion factor may be 8. Of course, the above are merely examples, and the absolute value of the first weighted conversion factor does not have to be equal to the absolute value of the second weighted conversion factor, and there is no limitation thereon.

[0221] For example, the weight conversion rate switching identifier may include, but is not limited to, a sequence level weight conversion rate switching identifier, an image level weight conversion rate switching identifier, a slice level weight conversion rate switching identifier, a tile level weight conversion rate switching identifier, a patch level weight conversion rate switching identifier, a CTU level weight conversion rate switching identifier, an LCU level weight conversion rate switching identifier, a block level weight conversion rate switching identifier, a CU level weight conversion rate switching identifier, a PU level weight conversion rate switching identifier, and the like.

[0222] For example, the sequence level weight conversion rate switching identifier corresponding to the current block may be determined as the weight conversion rate switching identifier corresponding to the current block, or the image level weight conversion rate switching identifier corresponding to the current block may be determined as the weight conversion rate switching identifier corresponding to the current block. By this analogy, it is possible to obtain the weight conversion rate switching identifier corresponding to the current block.

[0223] For example, the first weighting transformation rate may be the default weighting transformation rate, and the encoding side may know whether the current block needs to switch its weighting transformation rate. If the current block does not need to switch its weighting transformation rate, the encoding side may determine that the weighting transformation rate of the current block is the first weighting transformation rate. If the current block needs to switch its weighting transformation rate, the encoding side may determine that the weighting transformation rate of the current block is the second weighting transformation rate. Alternatively, the encoding side may know a weighting transformation rate switching identifier corresponding to the current block. If the weighting transformation rate switching identifier is used to indicate that the current block does not need to switch its weighting transformation rate, the encoding side may determine that the weighting transformation rate of the current block is the first weighting transformation rate. If the weighting transformation rate switching identifier is used to indicate that the current block needs to switch its weighting transformation rate, the encoding side may determine that the weighting transformation rate of the current block is the second weighting transformation rate.

[0224] For example, the encoding side determines an RDO cost value 1 corresponding to the first weighting conversion rate and an RDO cost value 2 corresponding to the second weighting conversion rate. If the RDO cost value 1 is smaller than the RDO cost value 2, it determines that the current block does not need to switch the weighting conversion rate, and if the RDO cost value 2 is smaller than the RDO cost value 1, it determines that the current block needs to switch the weighting conversion rate.

[0225] The encoding side may encode a weight conversion rate switching identifier (e.g., a sequence-level weight conversion rate switching identifier) ​​into the bitstream, so that the decoding side can analyze the weight conversion rate switching identifier from the bitstream and determine the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block. As described above, the decoding side can know the weight conversion rate switching identifier corresponding to the current block. If the weight conversion rate switching identifier is used to indicate that the current block does not need to perform weight conversion rate switching, the decoding side determines that the weight conversion rate of the current block is the first weight conversion rate. If the weight conversion rate switching identifier is used to indicate that the current block needs to perform weight conversion rate switching, the decoding side determines that the weight conversion rate of the current block is the second weight conversion rate. For example, if the weight conversion rate switching identifier is a first value, it indicates that the current block does not need to perform weight conversion rate switching, and if the weight conversion rate switching identifier is a second value, it indicates that the current block needs to perform weight conversion rate switching. The first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above are merely examples of the first and second values, and are not limiting in this regard.

[0226] Instead of the encoding side encoding the weight conversion rate switching identifier into the bitstream, the decoding side may implicitly derive the weight conversion rate switching identifier and determine the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block. For example, if all of a plurality of consecutive blocks require weight conversion rate switching, the current block also requires weight conversion rate switching, and the decoding side implicitly derives the weight conversion rate switching identifier and determines the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block, and the weight conversion rate switching identifier indicates that the current block requires weight conversion rate switching. If none of a plurality of consecutive blocks require weight conversion rate switching, the current block also does not require weight conversion rate switching, and the decoding side implicitly derives the weight conversion rate switching identifier, and the weight conversion rate switching identifier indicates that the current block does not require weight conversion rate switching. Of course, the above method is merely an example of implicitly deriving a weight conversion rate switching identifier, and this derivation method is not limited. As described above, the decoding side can know the weight transformation rate switching identifier corresponding to the current block, and if the weight transformation rate switching identifier indicates that the current block does not need to undergo weight transformation rate switching, it determines that the weight transformation rate of the current block is the first weight transformation rate, and if the weight transformation rate switching identifier indicates that the current block needs to undergo weight transformation rate switching, it determines that the weight transformation rate of the current block is the second weight transformation rate.

[0227] As described above, the weight transformation rate of the current block may be the first weight transformation rate or the second weight transformation rate, i.e., the weight transformation rate of the current block is switchable, and the switching of the weight transformation rate depends on a certain level of weight transformation rate switching identifier (refine_flag), and the refine_flag is an explicit identifier or an implicit identifier, where the explicit identifier means that the refine_flag is coded into the bitstream so that the decoding side analyzes the refine_flag from the bitstream, and the implicit identifier means that the coding / decoding side adaptively derives the refine_flag from the information obtained.

[0228] For example, the refine_flag at a certain level may be: the sequence level indicates the refine_flag of the current sequence and is used as the refine_flag of all blocks belonging to the current sequence; the image level indicates the refine_flag of the current frame and is used as the refine_flag of all blocks belonging to the current frame; the slice level indicates the refine_flag of the current slice and is used as the refine_flag of all blocks belonging to the current slice; the tile level indicates the refine_flag of the current tile and is used as the refine_flag of all blocks belonging to the current tile; the patch level indicates the refine_flag of the current patch and is used as the refine_flag of all blocks belonging to the current patch; the CTU level indicates the refine_flag of the current CTU and is used as the refine_flag of all blocks belonging to the current CTU, the LCU level indicates the refine_flag of the current LCU and is used as the refine_flag of all blocks belonging to the current LCU, the block level indicates the refine_flag of the current block and is used as the refine_flag belonging to the current block, the CU level indicates the refine_flag of the current CU and is used as the refine_flag belonging to the current CU, and the PU level indicates the refine_flag of the current PU and is used as the refine_flag belonging to the current PU. Of course, the above are merely a few examples and are not limiting.

[0229] For example, the first weight transformation rate may be the default weight transformation rate, and when the weight transformation rate switching identifier is used to indicate that the current block does not need to perform weight transformation rate switching, the weight transformation rate of the current block is determined to be the first weight transformation rate, and when the weight transformation rate switching identifier is used to indicate that the current block needs weight transformation rate switching, the weight transformation rate is switched, that is, the weight transformation rate of the current block is determined to be the second weight transformation rate.

[0230] Example 9: In Examples 1 to 3, the encoding side / decoding side needs to obtain the weighted prediction angle and weighted prediction position of the current block, while in Example 8, the weighted conversion rate of the current block, for example, the first weighted conversion rate or the second weighted conversion rate, can be obtained, and then the weighted prediction angle and weighted prediction position of the current block are obtained by adopting the following method.

[0231] In method 1, the encoding side and the decoding side decide on the same weighted prediction angle as the weighted prediction angle of the current block and also decide on the same weighted prediction position as the weighted prediction position of the current block. For example, the encoding side and the decoding side decide on weighted prediction angle A as the weighted prediction angle of the current block, and the encoding side and the decoding side decide on weighted prediction position 4 as the weighted prediction position of the current block.

[0232] In method 2, the encoding side constructs a weighted prediction angle list including at least one weighted prediction angle, such as weighted prediction angle A and weighted prediction angle B. The encoding side constructs a weighted prediction position list including at least one weighted prediction position, for example, weighted prediction position 0 to weighted prediction position number 6. The encoding side sequentially traverses each weighted prediction angle in the weighted prediction angle list, and traverses each weighted prediction position in the weighted prediction position list, that is, traverses each combination of weighted prediction angle and weighted prediction position. For each combination of weighted prediction angle and weighted prediction position, steps 402 to 408 are executed based on the weighted prediction angle, weighted prediction position, and weight conversion factor (obtained in embodiment 8) as the weighted prediction angle and weighted prediction position obtained in step 401, to obtain a weighted prediction value of the current block.

[0233] For example, when the encoding side traverses to weighted prediction angle A and weighted prediction position 0, it executes steps 402 to 408 based on weighted prediction angle A and weighted prediction position 0 to obtain a weighted predicted value A-0 of the current block. When the encoding side traverses to weighted prediction angle A and weighted prediction position 1, it executes steps 402 to 408 based on weighted prediction angle A and weighted prediction position 1 to obtain a weighted predicted value A-1 of the current block. When the encoding side traverses to weighted prediction angle B and weighted prediction position 0, it executes steps 402 to 408 based on weighted prediction angle B and weighted prediction position 0 to obtain a weighted predicted value B-0 of the current block. The encoding side can obtain a corresponding weighted predicted value based on each combination (combination of weighted prediction angle and weighted prediction position).

[0234] The encoding side may obtain each weighted prediction value based on a combination of a weighted prediction angle and a weighted prediction position, and then determine the corresponding RDO cost value based on each weighted prediction value. There is no limitation on the method for determining this RDO cost value, and the encoding side may obtain the RDO cost value for each combination and select the smallest RDO cost value from all the RDO cost values.

[0235] Then, the encoding side sets the combination of weighted prediction angle and weighted prediction position corresponding to the minimum RDO cost value as the target weighted prediction angle and target weighted prediction position, respectively, and finally encodes the index value in the weighted prediction angle list of the target weighted prediction angle and the index value in the weighted prediction position list of the target weighted prediction position into a bitstream.

[0236] Of course, the above method is merely an example and is not limiting, as long as the weighted prediction angle and weighted prediction position of the current block can be obtained. For example, one weighted prediction angle may be randomly selected from the weighted prediction angle list as the weighted prediction angle of the current block, and one weighted prediction position may be randomly selected from the weighted prediction position list as the weighted prediction position of the current block.

[0237] On the decoding side, the decoding side constructs a weighted prediction angle list, which is the same as the weighted prediction angle list on the encoding side and includes at least one weighted prediction angle, for example, weighted prediction angle A and weighted prediction angle B. The decoding side constructs a weighted prediction position list, which is the same as the weighted prediction position list on the encoding side and includes at least one weighted prediction position, for example, weighted prediction position 0 to weighted prediction position number 6. Upon receiving the coded bitstream of the current block, the decoding side analyzes indication information from the coded bitstream and selects one weighted prediction angle from the weighted prediction angle list as the weighted prediction angle of the current block based on the indication information, and selects one weighted prediction position from the weighted prediction position list as the weighted prediction position of the current block based on the indication information.

[0238] Application scenario 1: When the encoding side transmits an encoded bitstream to the decoding side, the encoded bitstream may include indication information 1, which is used to indicate the weighted prediction angle of the current block (i.e., the target weighted prediction angle) and the weighted prediction position of the current block (i.e., the target weighted prediction position). For example, when indication information 1 is 0, it indicates the first weighted prediction angle in the weighted prediction angle list and is used to indicate the first weighted prediction position in the weighted prediction position list; when indication information 1 is 1, it indicates the first weighted prediction angle in the weighted prediction angle list and is used to indicate the second weighted prediction position in the weighted prediction position list. By this analogy, the encoding side and the decoding side can decide which weighted prediction angle and which weighted prediction position the value of indication information 1 is used to indicate, and this embodiment is not limited to this.

[0239] Upon receiving the coded bitstream, the decoding side analyzes the indication information 1 from the coded bitstream, and based on the indication information 1, the decoding side can select, from the weighted prediction angle list, a weighted prediction angle corresponding to the indication information 1 as the weighted prediction angle for the current block. Based on the indication information 1, the decoding side can select, from the weighted prediction position list, a weighted prediction position corresponding to the indication information 1 as the weighted prediction position for the current block.

[0240] Application Scenario 2: When the encoding side transmits an encoded bitstream to the decoding side, the encoded bitstream may include indication information 2 and indication information 3. The indication information 2 is used to indicate a target weighted prediction angle of the current block, for example, index value 1 in the weighted prediction angle list of the target weighted prediction angle, where index value 1 indicates the ordinal number of the weighted prediction angle in the weighted prediction angle list for the target weighted prediction angle. The indication information 3 is used to indicate a target weighted prediction position of the current block, for example, index value 2 in the weighted prediction position list for the target weighted prediction position, where index value 2 indicates the ordinal number of the weighted prediction position in the weighted prediction position list for the target weighted prediction position. Upon receiving the encoded bitstream, the decoding side analyzes the indication information 2 and indication information 3 from the encoded bitstream, and selects, based on the indication information 2, the weighted prediction angle corresponding to index value 1 from the weighted prediction angle list as the weighted prediction angle of the current block. Based on the indication information 3, the decoding side selects, based on the indication information 3, the weighted prediction position corresponding to index value 2 from the weighted prediction position list as the weighted prediction position of the current block.

[0241] Application scenario 3: The encoding side and the decoding side may agree on a preferred setting combination. There are no restrictions on this preferred setting combination and it can be set based on actual experience. For example, the encoding side and the decoding side may agree on a preferred setting combination 1 including weighted prediction angle A and weighted prediction position 4, and a preferred setting combination 2 including weighted prediction angle B and weighted prediction position 4.

[0242] After determining the target weighted prediction angle and target weighted prediction position of the current block, the encoding side determines whether the target weighted prediction angle and target weighted prediction position are a preferred setting combination. If so, when the encoding side transmits an encoded bitstream to the decoding side, the encoded bitstream may include indication information 4 and indication information 5. The indication information 4 is used to indicate whether the current block adopts a preferred setting combination. For example, when the indication information 4 is a first value (e.g., 0), it indicates that the current block adopts a preferred setting combination. The indication information 5 is used to indicate which preferred setting combination the current block adopts. For example, when the indication information 5 is 0, it indicates that the current block adopts preferred setting combination 1, and when the indication information 5 is 1, it indicates that the current block adopts preferred setting combination 2.

[0243] When the decoding side receives the coded bitstream, it analyzes the indication information 4 and the indication information 5 from the coded bitstream, and determines whether the current block employs a preferred setting combination based on the indication information 4. If the indication information 4 is a first value, it determines that the current block employs a preferred setting combination. If the current block employs a preferred setting combination, the decoding side determines which preferred setting combination the current block employs based on the indication information 5. For example, if the indication information 5 is 0, it determines that the current block employs preferred setting combination 1, i.e., the weighted prediction angle of the current block is weighted prediction angle A, and the weighted prediction position of the current block is weighted prediction position 4. For example, if the indication information 5 is 1, it determines that the current block employs preferred setting combination 2, i.e., the weighted prediction angle of the current block is weighted prediction angle B, and the weighted prediction position of the current block is weighted prediction position 4.

[0244] For example, when the encoding side and the decoding side negotiate only one set of preferred setting combinations, such as a preferred setting combination including a weighted prediction angle A and a weighted prediction position 4, the encoded bitstream may not include the indication information 5, but may only include the indication information 4 to indicate that the current block adopts the preferred setting combination. After analyzing the indication information 4 from the encoded bitstream, if the indication information 4 is a first value, the decoding side determines that the current block adopts the preferred setting combination, and determines that the weighted prediction angle of the current block is weighted prediction angle A and the weighted prediction position of the current block is weighted prediction position 4 based on the preferred setting combination.

[0245] Application Scenario 4: The encoding side and the decoding side may negotiate a preferred setting combination. After determining the target weighted prediction angle and target weighted prediction position of the current block, the encoding side determines whether the target weighted prediction angle and target weighted prediction position are a preferred setting combination. If not, when the encoding side sends an encoded bitstream to the decoding side, the encoded bitstream includes indication information 4 and indication information 6. Indication information 4 is used to indicate whether the current block adopts the preferred setting combination. For example, if indication information 4 is a second value (e.g., 1), it indicates that the current block does not adopt the preferred setting combination. Indication information 6 is used to indicate the target weighted prediction angle and target weighted prediction position of the current block. For example, if indication information 6 is 0, it indicates the first weighted prediction angle in the weighted prediction angle list and the first weighted prediction position in the weighted prediction position list.

[0246] When the decoding side receives the coded bitstream, it analyzes the indication information 4 and the indication information 6 from the coded bitstream, and determines whether the current block adopts a preferred setting combination based on the indication information 4. If the indication information 4 is a second value, it determines that the current block does not adopt a preferred setting combination. If the current block does not adopt a preferred setting combination, the decoding side may select a weighted prediction angle corresponding to the indication information 6 from a weighted prediction angle list based on the indication information 6, and set the weighted prediction angle as the weighted prediction angle of the current block. Also, based on the indication information 6, the decoding side may select a weighted prediction position corresponding to the indication information 6 from a weighted prediction position list, and set the weighted prediction position as the weighted prediction position of the current block.

[0247] Application scenario 5: The encoding side and the decoding side may negotiate a preferred setting combination. The encoding side determines the target weight prediction angle and target weight prediction position of the current block, and then determines whether the target weight prediction angle and target weight prediction position are a preferred setting combination. Otherwise, when the encoding side transmits the encoded bitstream to the decoding side, the encoded bitstream includes indication information 4, indication information 7, and indication information 8. Illustratively, indication information 4 is used to indicate whether the current block employs a preferred setting combination, and for example, when indication information 4 is a second value, it indicates that the current block does not employ a preferred setting combination. Indication information 7 is used to indicate the target weighted prediction angle of the current block, and for example, is index value 1 in the weighted prediction angle list of the target weighted prediction angle, where index value 1 indicates the ordinal number of the weighted prediction angle in the weighted prediction angle list of the target weighted prediction angle. Indication information 8 is used to indicate the target weighted prediction position of the current block, and for example, is index value 2 in the weighted prediction position list of the target weighted prediction position, where index value 2 indicates the ordinal number of the weighted prediction position in the weighted prediction position list of the target weighted prediction position.

[0248] When the decoding side receives the coded bitstream, it analyzes the indication information 4, the indication information 7, and the indication information 8 from the coded bitstream, and determines whether the current block adopts a preferred setting combination based on the indication information 4. If the indication information 4 is a second value, it determines that the current block does not adopt a preferred setting combination. If the current block does not adopt a preferred setting combination, the decoding side selects a weighted prediction angle corresponding to the index value 1 from the weighted prediction angle list based on the indication information 7, and sets the weighted prediction angle as the weighted prediction angle of the current block. Based on the indication information 8, the decoding side selects a weighted prediction position corresponding to the index value 2 from the weighted prediction position list, and sets the weighted prediction position as the weighted prediction position of the current block.

[0249] Example 10: In Examples 1 to 3, the encoding side / decoding side needs to obtain the weight conversion rate of the current block. If the current block supports the weight conversion rate switching mode, the encoding side / decoding side obtains the second weight conversion rate instruction information of the current block, and selects a weight conversion rate corresponding to the second weight conversion rate instruction information from a preset lookup table, where the preset lookup table includes at least two weight conversion rates. The selected weight conversion rate is determined as the weight conversion rate of the current block, thereby obtaining the weight conversion rate of the current block.

[0250] Since the preset lookup table includes at least two weight conversion factors, if the current block supports a weight conversion factor switching mode, the weight conversion factor of the current block may be selected from at least two weight conversion factors, that is, the weight conversion factor of the current block is variable, thereby enabling adaptive switching of the weight conversion factor rather than adopting a uniform weight conversion factor.

[0251] For example, if the switching control information allows the current block to start the weight conversion rate switching mode, the current block supports the weight conversion rate switching mode; if the switching control information does not allow the current block to start the weight conversion rate switching mode, the current block does not support the weight conversion rate switching mode. Regarding whether the current block supports the weight conversion rate switching mode, refer to Example 8.

[0252] In one possible embodiment, the preset lookup table may include at least two weight conversion factors, and the second weight conversion factor indication information may include weight conversion factor index information (used to indicate a specific weight conversion factor among all weight conversion factors in the lookup table), based on which a weight conversion factor corresponding to the weight conversion factor index information can be selected from the lookup table.

[0253] On the encoding side, if there is only one lookup table, for each weight conversion rate in the lookup table, the encoding side may determine an RDO cost value corresponding to the weight conversion rate, and set the weight conversion rate corresponding to the smallest RDO cost value as the target weight conversion rate for the current block, and determine index information in the lookup table for the target weight conversion rate, i.e., weight conversion rate index information, where the weight conversion rate index information indicates which weight conversion rate in the lookup table it is.

[0254] When there is only one lookup table, the decoding side may add weight conversion rate index information indicating index information in the lookup table of target weight conversion rates to the coded bit stream when the coding side transmits the coded bit stream of the current block to the decoding side, and the decoding side selects a weight conversion rate corresponding to the weight conversion rate index information from the lookup table as the target weight conversion rate of the current block.

[0255] In another possible embodiment, the preset lookup table may include at least two lookup tables, each lookup table may include at least one weight conversion ratio, and the second weight conversion ratio indication information may include lookup table index information (used to indicate a specific lookup table among all the lookup tables) and weight conversion ratio index information (used to indicate a specific weight conversion ratio among all the weight conversion ratios in the lookup tables), based on which a target lookup table corresponding to the lookup table index information can be selected from the at least two lookup tables, and a weight conversion ratio corresponding to the weight conversion ratio index information can be selected from the target lookup table.

[0256] Exemplarily, the preset lookup table may include a first lookup table and a second lookup table, and the maximum absolute value of the weight conversion ratio included in the second lookup table is greater than the maximum absolute value of the weight conversion ratio included in the first lookup table. For example, the absolute values ​​of the weight conversion ratios included in the second lookup table are 4 and 8, and the absolute values ​​of the weight conversion ratios included in the first lookup table are 5 and 7. It is clear that the maximum absolute value of the weight conversion ratios included in the second lookup table is 8, and the maximum absolute value of the weight conversion ratios included in the first lookup table is 7. The absolute values ​​of the weight conversion ratios included in the second lookup table are not completely identical to the absolute values ​​of the weight conversion ratios included in the first lookup table. For example, the absolute values ​​of the weight conversion ratios included in the second lookup table are 4 and 8, and the absolute values ​​of the weight conversion ratios included in the first lookup table are 1, 2 and 4, and the absolute values ​​of the weight conversion ratios included in the two lookup tables are not completely identical. Alternatively, the absolute values ​​of the weight conversion ratios contained in the second lookup table are completely different from the absolute values ​​of the weight conversion ratios contained in the first lookup table. For example, the absolute values ​​of the weight conversion ratios contained in the second lookup table are 4 and 8, and the absolute values ​​of the weight conversion ratios contained in the first lookup table are 1 and 2, and the absolute values ​​of the weight conversion ratios contained in the two lookup tables are completely different.

[0257] For example, the second weighting conversion factor indication information includes lookup table index information and weighting conversion factor index information, where the lookup table index information may be an SCC identifier corresponding to the current block, and the SCC identifier is used to indicate that the current block belongs to screen content coding, or the SCC identifier is used to indicate that the current block belongs to non-screen content coding. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the target lookup table corresponding to the SCC identifier is the first lookup table. If the SCC identifier is used to indicate that the current block belongs to screen content coding, the target lookup table corresponding to the SCC identifier is the second lookup table.

[0258] As described above, the SCC identifier (i.e., lookup table index information) and weight conversion factor index information corresponding to the current block are obtained. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the target lookup table is determined to be the first lookup table, a weight conversion factor corresponding to the weight conversion factor index information is selected from the first lookup table, and the selected weight conversion factor is determined as the weight conversion factor of the current block. If the SCC identifier is used to indicate that the current block belongs to screen content coding, the target lookup table is determined to be the second lookup table, a weight conversion factor corresponding to the weight conversion factor index information is selected from the second lookup table, and the selected weight conversion factor is determined as the weight conversion factor of the current block. Thus, the weight conversion factor of the current block has been successfully obtained.

[0259] On the encoding side, the process by which the encoding side obtains the SCC identifier can be referred to in Example 8, and the description thereof will be omitted here.

[0260] When the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the target lookup table may be a first lookup table, and for each weight conversion ratio in the first lookup table, the encoding side determines an RDO cost value corresponding to the weight conversion ratio, sets the weight conversion ratio corresponding to the smallest RDO cost value as the target weight conversion ratio of the current block, and determines index information in the first lookup table for the target weight conversion ratio, i.e., weight conversion ratio index information. When the SCC identifier is used to indicate that the current block belongs to screen content coding, the target lookup table may be a second lookup table, and for each weight conversion ratio in the second lookup table, the encoding side determines an RDO cost value corresponding to the weight conversion ratio, sets the weight conversion ratio corresponding to the smallest RDO cost value as the target weight conversion ratio of the current block, and determines index information in the second lookup table for the target weight conversion ratio, i.e., weight conversion ratio index information, and the weight conversion ratio index information indicates the ordinal number of the weight conversion ratio in the second lookup table.

[0261] On the decryption side, the process by which the decryption side obtains the SCC identifier can be referred to in Example 8, and the description thereof will be omitted here.

[0262] When the encoding side transmits the encoded bitstream of the current block to the decoding side, the encoding side may add weighting conversion factor index information to the encoded bitstream, and the weighting conversion factor index information is used to indicate index information of a target weighting conversion factor in a first lookup table or a second lookup table. When the SCC identifier is used to indicate that the current block belongs to non-screen content encoding, the target lookup table may be the first lookup table, and the decoding side selects, from the first lookup table, a weighting conversion factor corresponding to the weighting conversion factor index information (the weighting conversion factor index information indicates the ordinal number of the weighting conversion factor in the first lookup table) as the weighting conversion factor of the current block. When the SCC identifier is used to indicate that the current block belongs to screen content encoding, the target lookup table may be the second lookup table, and the decoding side selects, from the second lookup table, a weighting conversion factor corresponding to the weighting conversion factor index information (the weighting conversion factor index information indicates the ordinal number of the weighting conversion factor in the second lookup table) as the weighting conversion factor of the current block.

[0263] Example 11: In Examples 1 to 3, the encoding side / decoding side needs to acquire the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted conversion rate of the current block. In Example 10, the weighted conversion rate of the current block may be acquired, and then the weighted prediction angle and the weighted prediction position of the current block may be acquired by adopting the following method.

[0264] In method 1, the encoding side and the decoding side decide on the same weighted prediction angle as the weighted prediction angle of the current block and also decide on the same weighted prediction position as the weighted prediction position of the current block. For example, the encoding side and the decoding side decide on weighted prediction angle A as the weighted prediction angle of the current block, and the encoding side and the decoding side decide on weighted prediction position 4 as the weighted prediction position of the current block.

[0265] In method 2, the encoding side constructs a weighted prediction angle list including at least one weighted prediction angle, such as weighted prediction angle A and weighted prediction angle B. The encoding side constructs a weighted prediction position list including at least one weighted prediction position, for example, weighted prediction position 0 to weighted prediction position number 6. The encoding side constructs at least two lookup tables, taking a first lookup table and a second lookup table as examples, where the first lookup table includes at least one weighted conversion factor, and the second lookup table includes at least one weighted conversion factor. The encoding side determines a target lookup table, and the determination method is as in Example 10, where the target lookup table is the first lookup table. The encoding side sequentially traverses each weighted prediction angle in the weighted prediction angle list, traverses each weighted prediction position in the weighted prediction position list, and traverses each weighted conversion factor in the target lookup table, that is, traverses each combination of weighted prediction angle, weighted prediction position, and weighted conversion factor. For each combination of weighted prediction angle, weighted prediction position, and weighted conversion rate, steps 402 to 408 are executed based on the weighted prediction angle, weighted prediction position, and weighted conversion rate obtained in step 401 to obtain a weighted prediction value for the current block.

[0266] As described above, the encoding side can obtain a weighted prediction value corresponding to the current block for each combination (i.e., a combination of weighted prediction angle, weighted prediction position, and weighted transformation rate). After obtaining each weighted prediction value of the current block, the encoding side may determine a corresponding RDO cost value based on each weighted prediction value of the current block. There is no limitation on the method for determining the RDO cost value, and the encoding side may obtain the RDO cost value of each combination and select the smallest RDO cost value from all the RDO cost values.

[0267] Then, the encoding side sets the weighted prediction angle, weighted prediction position, and weight conversion rate corresponding to the minimum RDO cost value as the target weighted prediction angle, target weighted prediction position, and target weight conversion rate, respectively, and finally encodes the index value in the weighted prediction angle list of the target weighted prediction angle, the index value in the weighted prediction position list of the target weighted prediction position, and the index value in the target lookup table of the target weight conversion rate into the bitstream of the current block.

[0268] On the decoding side, the decoding side constructs a weighted prediction angle list that is the same as the weighted prediction angle list on the encoding side, the decoding side constructs a weighted prediction position list that is the same as the weighted prediction position list on the encoding side, and the decoding side constructs a lookup table that is the same as the lookup table on the encoding side.When the decoding side receives the coded bitstream of the current block, it analyzes indication information from the coded bitstream, and based on the indication information, selects one weighted prediction angle from the weighted prediction angle list as the weighted prediction angle of the current block, and based on the indication information, selects one weighted prediction position from the weighted prediction position list as the weighted prediction position of the current block.For the method of obtaining the weighted prediction angle and the weighted prediction position, refer to Example 9, and the description thereof will be omitted here. When the decoding side receives the encoded bitstream of the current block, it may determine a target lookup table (e.g., a first lookup table, a second lookup table), and select one weight conversion rate from the target lookup table as the weight conversion rate of the current block based on the weight conversion rate index information.For the method of obtaining the weight conversion rate, refer to Example 10, and the description thereof will be omitted here.

[0269] Embodiment 12: In the above-described embodiments 1 to 3, it is necessary to determine the first predicted value of a pixel position based on the first prediction mode, and to determine the second predicted value of a pixel position based on the second prediction mode.

[0270] In this embodiment, an example will be described in which the first prediction mode is an inter prediction mode and the second prediction mode is an inter prediction mode.

[0271] In case 1, the first prediction mode is an inter prediction mode, the second prediction mode is an inter prediction mode, and a motion information candidate list including at least two motion information candidates is obtained. One motion information candidate is selected from the motion information candidate list as first target motion information for a current block, and another motion information candidate is selected from the motion information candidate list as second target motion information for the current block. For each pixel position of the current block, a first predicted value for the pixel position is determined based on the first target motion information, and a second predicted value for the pixel position is determined based on the second target motion information.

[0272] For example, both the encoding side and the decoding side can obtain a motion information candidate list, and the motion information candidate list on the encoding side and the motion information candidate list on the decoding side are the same, and there are no limitations on this motion information candidate list.

[0273] For example, the motion information candidates in the motion information candidate list are all single-hypothesis motion information, for example, the motion information candidates in the motion information candidate list are only unidirectional motion information, not bidirectional motion information. Obviously, since the motion information candidates are all single-hypothesis motion information, the motion information candidate list may also be a unidirectional motion information candidate list.

[0274] The process of obtaining the motion information candidate list can be referred to in the following examples, and the description thereof will be omitted here.

[0275] On the encoding side, based on the RDO principle, one motion information candidate from the motion information candidate list may be selected as the first target motion information of the current block, and another motion information candidate from the motion information candidate list may be selected as the second target motion information of the current block, where the first target motion information is different from the second target motion information, and there is no limitation in this regard.

[0276] In one possible embodiment, when the encoding side transmits an encoded bitstream to the decoding side, indication information a and indication information b may be added to the encoded bitstream, where indication information a is used to indicate index value 1 of the first target motion information of the current block, where index value 1 indicates the number of the motion information candidate in the motion information candidate list of the first target motion information. Indication information b is used to indicate index value 2 of the second target motion information of the current block, where index value 2 indicates the number of the motion information candidate in the motion information candidate list of the second target motion information. For example, index value 1 and index value 2 may be different.

[0277] Upon receiving the coded bitstream, the decoding side analyzes the indication information a and indication information b from the coded bitstream. Based on the indication information a, the decoding side selects the motion information candidate corresponding to index value 1 from the motion information candidate list and sets the selected motion information candidate as the first target motion information of the current block. Based on the indication information b, the decoding side selects the motion information candidate corresponding to index value 2 from the motion information candidate list and sets the selected motion information candidate as the second target motion information of the current block.

[0278] In another possible embodiment, when the encoding side transmits the encoded bitstream to the decoding side, the encoding side may add indication information a and indication information c to the encoded bitstream, where indication information a may be used to indicate index value 1 of the first target motion information of the current block, where index value 1 indicates the number of the motion information candidate in the motion information candidate list of the first target motion information. Indication information c may be used to indicate the difference between index value 2 and index value 1, where index value 2 indicates the number of the motion information candidate in the motion information candidate list of the second target motion information. For example, index value 1 and index value 2 may be different.

[0279] Upon receiving the coded bitstream, the decoding side may analyze the indication information a and the indication information c from the coded bitstream. The decoding side may select the motion information candidate corresponding to the index value 1 from the motion information candidate list based on the indication information a, and set the motion information candidate as the first target motion information of the current block. The decoding side may obtain the difference between the index value 2 and the index value 1 based on the indication information c, and determine the index value 2 based on the difference and the index value 1. The decoding side may select the motion information candidate corresponding to the index value 2 from the motion information candidate list, and set the motion information candidate as the second target motion information of the current block.

[0280] The process in which the encoding side / decoding side determines a first predicted value of a pixel position based on first target motion information and determines a second predicted value of a pixel position based on second target motion information can refer to an inter prediction process, and there is no limitation in this regard.

[0281] For example, when determining a first predicted value for a pixel position based on first target motion information, an inter-weighted prediction mode may be adopted to obtain the first predicted value for the pixel position. For example, an initial predicted value for the pixel position is determined using the first target motion information, and the initial predicted value is multiplied by a predetermined coefficient to obtain an adjusted predicted value. If the adjusted predicted value is greater than the maximum predicted value, the maximum predicted value is used as the first predicted value for the current block. If the adjusted predicted value is less than the minimum predicted value, the minimum predicted value is used as the first predicted value for the current block. If the adjusted predicted value is greater than the minimum predicted value but less than the maximum predicted value, the adjusted predicted value is used as the first predicted value for the current block. Of course, the above method is merely an example and is not limiting.

[0282] Similarly, when determining the second predicted value of the pixel position based on the second target motion information, the inter-weighted prediction mode may be adopted to obtain the second predicted value of the pixel position. For specific implementation methods, please refer to the above example, and the description thereof will be omitted here.

[0283] In case 2, the first prediction mode is an inter prediction mode, the second prediction mode is an inter prediction mode, and a first motion information candidate list and a second motion information candidate list are obtained, the first motion information candidate list includes at least one motion information candidate, and the second motion information candidate list includes at least one motion information candidate. One motion information candidate from the first motion information candidate list is selected as first target motion information for the current block, and one motion information candidate from the second motion information candidate list is selected as second target motion information for the current block. For each pixel position of the current block, a first predicted value for the pixel position is determined based on the first target motion information, and a second predicted value for the pixel position is determined based on the second target motion information.

[0284] For example, both the encoding side and the decoding side can obtain a first motion information candidate list and a second motion information candidate list, and the first motion information candidate list on the encoding side is the same as the first motion information candidate list on the decoding side, and the second motion information candidate list on the encoding side is the same as the second motion information candidate list on the decoding side.

[0285] The motion information candidates in the first motion information candidate list are all single-hypothesis motion information, that is, the motion information candidates in the first motion information candidate list only include unidirectional motion information and not bidirectional motion information. Obviously, since the motion information candidates are all single-hypothesis motion information, the first motion information candidate list can also be a unidirectional motion information candidate list.

[0286] The motion information candidates in the second motion information candidate list are all single-hypothesis motion information, that is, the motion information candidates in the second motion information candidate list only include unidirectional motion information and not bidirectional motion information. Obviously, since the motion information candidates are all single-hypothesis motion information, the second motion information candidate list can also be a unidirectional motion information candidate list.

[0287] The process of obtaining the first motion information candidate list and the second motion information candidate list will be described in the following examples.

[0288] On the encoding side, based on the RDO principle, one motion information candidate from the first motion information candidate list may be selected as the first target motion information of the current block, and one motion information candidate from the second motion information candidate list may be selected as the second target motion information of the current block, which are different from the first target motion information and the second target motion information and are not limited in this respect.

[0289] When the encoding side transmits an encoded bitstream to the decoding side, it adds indication information a and indication information b to the encoded bitstream. The indication information a is used to indicate index value 1 of the first target motion information of the current block, where index value 1 indicates the ordinal number of the motion information candidate in the first motion information candidate list of the first target motion information. The indication information b is used to indicate index value 2 of the second target motion information of the current block, where index value 2 indicates the ordinal number of the motion information candidate in the second motion information candidate list of the second target motion information. Upon receiving the encoded bitstream, the decoding side analyzes the indication information a and indication information b from the encoded bitstream. Based on the indication information a, it selects the motion information candidate corresponding to index value 1 from the first motion information candidate list as the first target motion information of the current block. Based on the indication information b, it selects the motion information candidate corresponding to index value 2 from the second motion information candidate list as the second target motion information of the current block.

[0290] In the above case, the indication information of the prediction information of the first prediction mode and the indication information of the prediction information of the second prediction mode can be interchanged, as long as the encoding side and the decoding side are consistent. Here, the interchange of indication information does not affect the analysis process, i.e., there is no dependency on analysis. In the case of the same prediction mode candidate list, the indication information of the prediction information of the first prediction mode and the indication information of the prediction information of the second prediction mode are not equal. Assume that two index values ​​are encoded. For example, index value a is 1 and index value b is 3. When encoding index value a first, index value b may be encoded as 2 (3-1). When encoding index value b first, index value b must be encoded as 3. As described above, the indication information of the smaller index value is encoded first, thereby reducing the encoding cost of the larger index value. In the prediction mode candidate list construction method, the first prediction mode is likely to come from the left side. Based on this experience, the encoding side and the decoding side can be adjusted, and the indication information of the prediction information of the adjacent left area may be encoded first.

[0291] The following description will be given with reference to Case 1, but the other cases are similar to Case 1. In Case 1, the prediction mode candidate list may be a motion information candidate list, the prediction information of the first prediction mode may be first target motion information, and the prediction information of the second prediction mode may be second target motion information. In the encoded bitstream, indication information of the first target motion information, for example, index value a, is encoded first, and then indication information of the second target motion information, for example, index value b, is encoded later. Indication information of the second target motion information, for example, index value b, may be encoded first, and then indication information of the first target motion information, for example, index value a, may be encoded later. For example, assuming that the value of index value a is 1 and the value of index value b is 3, index value a is encoded first, and index value b is encoded later. For example, assuming that the value of index value b is 1 and the value of index value a is 3, index value b is encoded first, and index value a is encoded later.

[0292] Example 13: In the above Examples 1 to 3, it is necessary to determine a first predicted value of a pixel position based on a first prediction mode, and to determine a second predicted value of a pixel position based on a second prediction mode. Exemplarily, the first prediction mode may be any one of an intra block copy prediction mode, an intra prediction mode, an inter prediction mode, and a palette mode, and the second prediction mode may be any one of an intra block copy prediction mode, an intra prediction mode, an inter prediction mode, and a palette mode.

[0293] In this embodiment, an example will be described in which the first prediction mode is an inter prediction mode and the second prediction mode is an inter prediction mode.Since the first prediction mode is an inter prediction mode, based on this, the step of determining a first predicted value of a pixel position of a current block based on the first prediction mode includes the steps of obtaining a motion information candidate list including at least one motion information candidate, selecting one motion information candidate from the motion information candidate list as the original motion information of the current block, determining target motion information of the current block based on the original motion information, and determining a first predicted value of a pixel position based on the target motion information.

[0294] In Case 1, the first prediction mode is an inter prediction mode, the second prediction mode is an inter prediction mode, and a motion information candidate list that may include at least two motion information candidates is obtained. One motion information candidate is selected from the motion information candidate list as first original motion information for the current block, and another motion information candidate is selected from the motion information candidate list as second original motion information for the current block, where the first original motion information and the second original motion information are different. Then, first target motion information for the current block is determined based on the first original motion information, and second target motion information for the current block is determined based on the second original motion information. For each pixel position of the current block, a first predicted value for the pixel position is determined based on the first target motion information, and a second predicted value for the pixel position is determined based on the second target motion information.

[0295] For the process of obtaining the motion information candidate list, please refer to the following examples, and the description thereof will be omitted here.For the process of determining the first predicted value based on the first target motion information and the second predicted value based on the second target motion information, please refer to the 12th example, and the description thereof will be omitted here.The difference from the 12th example is that in the 13th example, the motion information candidate selected from the motion information candidate list is the original motion information, not the target motion information.It is also possible to obtain the original motion information and then obtain the target motion information based on the original motion information.For the specific obtaining process, please refer to the following examples.

[0296] In Case 2, the first prediction mode is inter prediction mode, the second prediction mode is inter prediction mode, and a first motion information candidate list and a second motion information candidate list are obtained, the first motion information candidate list includes at least one motion information candidate, and the second motion information candidate list includes at least one motion information candidate. One motion information candidate is selected from the first motion information candidate list as first original motion information for the current block, and first target motion information for the current block is determined based on the first original motion information. One motion information candidate is selected from the second motion information candidate list as second original motion information for the current block, and second target motion information for the current block is determined based on the second original motion information. For each pixel position of the current block, a first predicted value for the pixel position is determined based on the first target motion information, and a second predicted value for the pixel position is determined based on the second target motion information. The difference from Example 12 is that in Example 13, the motion information candidate selected from the motion information candidate list is used as original motion information rather than target motion information. After obtaining the original motion information, it is also possible to obtain the target motion information based on the original motion information. For a specific obtaining process, please refer to the following examples.

[0297] As described above, in the above case, when the prediction mode is an inter prediction mode, a motion information candidate list including at least one motion information candidate may be obtained. Then, a motion information candidate may be selected from the motion information candidate list as the original motion information of the current block, and first target motion information may be determined based on the first original motion information, and second target motion information may be determined based on the second original motion information. Then, a predicted value of a pixel position may be determined based on the target motion information.

[0298] Regarding how to determine target motion information based on original motion information, this embodiment shows a method (Motion Vector Refinement) of overlaying a differential motion vector on unidirectional motion information. For example, the original motion information includes an original motion vector, and the target motion information includes a target motion vector. To determine the target motion vector of the current block based on the original motion vector, a differential motion vector (MVD) corresponding to the original motion vector is obtained, and the target motion vector is determined based on the differential motion vector and the original motion vector. In other words, the sum of the differential motion vector and the original motion vector may be used as the target motion vector.

[0299] Example 14: Based on Example 13, direction information and amplitude information of the differential motion vector are determined. When the direction information indicates a direction to the right and the amplitude information indicates an amplitude as Ar, the differential motion vector is (Ar, 0). When the direction information indicates a direction to the down direction and the amplitude information indicates an amplitude as Ad, the differential motion vector is (0, -Ad). When the direction information indicates a direction to the left and the amplitude information indicates an amplitude as Al, the differential motion vector is (-Al, 0). When the direction information indicates a direction to the up direction and the amplitude information indicates an amplitude as Au, the differential motion vector is ( If the direction information indicates the direction to the upper right and the amplitude information indicates the amplitude as Aru, the differential motion vector will be (Aru,Aru); if the direction information indicates the direction to the upper left and the amplitude information indicates the amplitude as Alu, the differential motion vector will be (-Alu,Alu); if the direction information indicates the direction to the lower left and the amplitude information indicates the amplitude as Ald, the differential motion vector will be (-Ald,-Ald); and if the direction information indicates the direction to the lower right and the amplitude information indicates the amplitude as Ard, the differential motion vector will be (Ard,-Ard).

[0300] Note that the above amplitudes Ar, Ad, Al, Au, Aru, Alu, Ald and Ard each represent a set of values, and the values ​​in the set of amplitudes in different directions may all be the same, may be partially the same, or may all be different.

[0301] For example, the differential motion vector may support some or all of the above directional information, and the range of amplitude values ​​supported by the differential motion vector may be set empirically and may be at least one value, but is not limited thereto.

[0302] For example, the differential motion vector may support four directions, such as up, down, left, and right, and five step lengths, such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel. That is, the amplitude values ​​may be 1, 2, 4, 8, and 16. As described above, if the direction is upward, the differential motion vector may be (0,1), (0,2), (0,4), (0,8), or (0,16). If the direction is downward, the differential motion vector may be (0,-1), (0,-2), (0,-4), (0,-8), or (0,-16). If the direction is leftward, the differential motion vector may be (-1,0), (-2,0), (-4,0), (-8,0), or (-16,0). If the direction is rightward, the differential motion vectors may be (1,0), (2,0), (4,0), (8,0), (16,0).

[0303] For example, the differential motion vector supports four directions, such as up, down, left, and right, and supports six step length settings, namely, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, i.e., the amplitude values ​​may be 1, 2, 4, 8, 12, and 16. As described above, when the direction is upward, the differential motion vector may be (0,1), (0,2), (0,4), (0,8), (0,12), or (0,16). As the implementation method for differential motion vectors in other directions is similar to that for "up," their description will be omitted here.

[0304] Furthermore, for example, the differential motion vector supports eight directions, including up, down, left, right, upper left, lower left, upper right, and lower right, and supports three step length settings, 1 / 4-pel, 1 / 2-pel, and 1-pel, i.e., the amplitude values ​​may be 1, 2, and 4. As described above, when the direction is upper left, the differential motion vector may be (-1,1), (-2,2), or (-4,4), and when the direction is upper right, the differential motion vector may be (1,1), (2,2), or (4,4). As the implementation method for differential motion vectors in other directions is similar to that for "upper left, upper right," a description thereof will be omitted here.

[0305] For example, the differential motion vector supports four directions, such as up, down, left, and right, and supports four step length settings, such as 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, i.e., the amplitude values ​​may be 1, 2, 4, and 8.

[0306] Of course, the above are merely a few examples and are not limiting. For example, the direction supported by the differential motion vector can be arbitrarily selected, such as six directions (up, down, left, right, top-left, bottom-left, etc.) or two directions (up and down). Furthermore, the step length supported by the differential motion vector can be set variably, allowing for flexible setting. Furthermore, the step length may be adaptively set based on coding parameters such as a quantization parameter (QP). For example, 1-pel, 2-pel, 4-pel, or 8-pel is used for a relatively large QP, and 1 / 4-pel, 1 / 2-pel, 1-pel, or 2-pel is used for a relatively small QP. Furthermore, appropriate step length settings may be set at the sequence level, image level, frame level, slice level, tile level, patch level, CTU level, etc., so that the decoding side can perform decoding based on step length settings analyzed from the sequence level, image level, frame level, slice level, tile level, patch level, and CTU level.

[0307] For ease of explanation, in the following embodiments, it is assumed that the differential motion vector supports directions such as up and down, and supports step length settings such as 1-pel and 2-pel. When described with 1 / 4-pel precision, the differential motion vector may be (0,4), (0,8), (0,-4), (0,-8), that is, (0,1<<2), (0,1<<3), (0,-1<<2), (0,-1<<3).

[0308] On the encoding side, after obtaining the motion information candidate list, each motion vector candidate in the motion information candidate list is traversed in order. When traversing to motion vector candidate 1, the sum of motion vector candidate 1 and the differential motion vector (0,4) is set as motion vector candidate 1-1, and the RDO cost value 1-1 corresponding to motion vector candidate 1-1 is determined, but the determination process is not limited. The sum of motion vector candidate 1 and the differential motion vector (0,8) is set as motion vector candidate 1-2, and the RDO cost value 1-2 corresponding to motion vector candidate 1-2 is determined. The sum of motion vector candidate 1 and the differential motion vector (0,-4) is set as motion vector candidate 1-3, and the RDO cost value 1-3 corresponding to motion vector candidate 1-3 is determined. The sum of motion vector candidate 1 and the differential motion vector (0,-8) is set as motion vector candidate 1-4, and the RDO cost value 1-4 corresponding to motion vector candidate 1-4 is determined.

[0309] By analogy, the above method may be used to process each traversed motion vector candidate to obtain an RDO cost value. After traversing all motion vector candidates is completed, the smallest RDO cost value is selected from all RDO cost values. Assuming that the RDO cost value 1-1 is the smallest, the encoding side may encode the index value of motion vector candidate 1 in the motion information candidate list, and the direction information and amplitude information of the differential motion vector (0,4) into the encoded bitstream. Here, the direction information is used to indicate that the direction of the differential motion vector (0,4) is upward, and the amplitude information is used to indicate that the amplitude of the differential motion vector (0,4) is 4. For example, the direction information indication information may be 0, representing the first direction in the direction list (up, down), and the amplitude information indication information may be 4, representing the length setting of the first step in the step length setting list (1-pel, 2-pel). Of course, the above process is merely a simplified example, and is not limited thereto as long as it can represent the direction information and amplitude information.

[0310] For example, if a differential motion vector supports four directions, such as up, down, left, and right, and five step length settings, such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, the direction information of the differential motion vector may be coded using a 2-bin fixed-length code (four values ​​in total), where the four values ​​of the 2-bin fixed-length code represent the four directions, such as up, down, left, and right. The amplitude information of the differential motion vector may be coded using a truncated unary code, where the five step length settings are represented by the truncated unary code.

[0311] For example, if a differential motion vector supports four directions, such as up, down, left, and right, and supports six step length settings, such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, the direction information of the differential motion vector may be coded using a 2-bin fixed-length code (four values ​​in total), and the amplitude information of the differential motion vector may be coded using a truncated unary code.

[0312] For example, if a differential motion vector supports eight directions, such as up, down, left, right, upper left, lower left, upper right, and lower right, and the differential motion vector supports three step length settings, such as 1 / 4-pel, 1 / 2-pel, and 1-pel, the direction information of the differential motion vector may be coded using a 3-bin fixed-length code (a total of eight values), and the amplitude information of the differential motion vector may be coded using a truncated unary code.

[0313] For example, if a differential motion vector supports four directions, such as up, down, left, and right, and supports four step length settings, such as 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, then based on this, the direction information of the differential motion vector may be coded using a truncated unary code, and the amplitude information of the differential motion vector may be coded using a 2-bin fixed-length code (a total of four values).

[0314] Of course, the above are only some examples of encoding methods, and the encoding methods are not limited to these.

[0315] As described above, the encoding side may search for an optimal motion vector within a certain region, and then use the difference between the optimal motion vector and a motion vector candidate as a differential motion vector, encode the amplitude information and direction information of the differential motion vector into a bitstream, and encode the index value of the motion vector candidate in the motion information candidate list into the bitstream. When searching for an optimal motion vector within a certain region, the encoding side must determine the direction and amplitude of the differential motion vector, i.e., search for an optimal motion vector within a limited range of differential motion vectors such as (Ar, 0), (0, -Ad), (-Al, 0), (0, Au), (Aru, Aru), (-Alu, Alu), (-Ald, -Ald), and (Ard, -Ard), rather than searching for an optimal motion vector within an arbitrary range of differential motion vectors.

[0316] When the decoding side receives the coded bitstream of the current block, it may analyze the index value of the motion vector candidate in the motion information candidate list from the coded bitstream, select the motion vector candidate corresponding to the index value from the motion information candidate list, and set the motion vector candidate as the original motion vector of the current block. The decoding side may also analyze the direction information and amplitude information of the differential motion vector from the coded bitstream, and determine the differential motion vector based on the direction information and amplitude information.

[0317] The decoding side may then determine a target motion vector for the current block based on the differential motion vector and the original motion vector, for example, the sum of the differential motion vector and the original motion vector may be set as the target motion vector for the current block.

[0318] Referring to the above embodiment, when determining a differential motion vector based on direction information and amplitude information, if the direction information indicates a rightward direction and the amplitude information indicates an amplitude as Ar, the differential motion vector is (Ar, 0); if the direction information indicates a downward direction and the amplitude information indicates an amplitude as Ad, the differential motion vector is (0, -Ad); if the direction information indicates a leftward direction and the amplitude information indicates an amplitude as Al, the differential motion vector is (-Al, 0); if the direction information indicates an upward direction and the amplitude information indicates an amplitude as Au, the differential motion vector is (-Al, 0). is (0,Au), and if the direction information indicates the direction to the upper right and the amplitude information indicates the amplitude as Aru, the differential motion vector will be (Aru,Aru), if the direction information indicates the direction to the upper left and the amplitude information indicates the amplitude as Alu, the differential motion vector will be (-Alu,Alu), if the direction information indicates the direction to the lower left and the amplitude information indicates the amplitude as Ald, the differential motion vector will be (-Ald,-Ald), and if the direction information indicates the direction to the lower right and the amplitude information indicates the amplitude as Ard, the differential motion vector will be (Ard,-Ard).

[0319] Referring to the above embodiment, the encoding side may use a method such as fixed-length coding or truncated unary coding when encoding the direction information of the differential motion vector, and therefore the decoding side may adopt a method such as fixed-length coding or truncated unary coding to decode the direction information of the differential motion vector and obtain the direction information of the differential motion vector, for example, up, down, left, right, upper left, lower left, upper right, lower right, etc.

[0320] Referring to the above embodiment, the encoding side may adopt a method such as fixed-length coding or truncated unary coding when encoding the amplitude information of the differential motion vector. Therefore, the decoding side may adopt a method such as fixed-length coding or truncated unary coding to decode the amplitude information of the differential motion vector, obtain the amplitude information of the differential motion vector, for example, a step length setting such as 1 / 4-pel, 1 / 2-pel, 1-pel, or 2-pel, and then determine the amplitude value of the differential motion vector based on the step length setting such as 1 / 4-pel, 1 / 2-pel, 1-pel, or 2-pel.

[0321] As described above, the decoding side can analyze the direction information and amplitude information of the differential motion vector from the encoded bitstream, and after analyzing the direction information and amplitude information, can determine the differential motion vector based on the direction information and amplitude information.

[0322] In one possible embodiment, the encoding side may encode flag information into the encoded bitstream indicating whether to superimpose a differential motion vector on an original motion vector or not to superimpose a differential motion vector on an original motion vector. The flag information may be a sub-mode flag of an emphasis angle weighted prediction mode, which may also be referred to as an AWP with motion vector refinement (AWP-MVR) mode. Upon receiving the encoded bitstream of the current block, the decoding side first analyzes the flag information from the encoded bitstream of the current block. If the flag information indicates that the differential motion vector is superimposed on the original motion vector, the decoding side analyzes direction information and amplitude information of the differential motion vector from the encoded bitstream of the current block, determines a differential motion vector based on the direction information and the amplitude information, and then determines a target motion vector for the current block based on the original motion vector and the differential motion vector. If the flag information indicates that the differential motion vector should not be superimposed on the original motion vector, the decoding side does not analyze the direction information and amplitude information of the differential motion vector, and sets the original motion vector as the target motion vector for the current block.

[0323] For example, when the sub-mode flag of the emphasis angle weighted prediction mode is set to a value of the first sub-mode, it indicates that the differential motion vector is superimposed on the original motion vector, and when the sub-mode flag of the emphasis angle weighted prediction mode is set to a value of the second sub-mode, it indicates that the differential motion vector is not superimposed on the original motion vector. The values ​​of the first sub-mode and the second sub-mode may be set empirically, for example, the value of the first sub-mode is 1 and the value of the second sub-mode is 0, or for example, the value of the first sub-mode is 0 and the value of the second sub-mode is 1. Of course, the above are only two examples and are not limiting.

[0324] In one possible embodiment, for case 1 or case 2 of Example 13, the first original motion information includes a first original motion vector, the first target motion information includes a first target motion vector, the second original motion information includes a second original motion vector, and the second target motion information includes a second target motion vector. Based on this, a first differential motion vector corresponding to the first original motion vector may be obtained, and the first target motion vector may be determined based on the first differential motion vector and the first original motion vector, i.e., the sum of the first differential motion vector and the first original motion vector is the first target motion vector. A second differential motion vector corresponding to the second original motion vector may be obtained, and a second target motion vector may be determined based on the second differential motion vector and the second original motion vector, i.e., the sum of the second differential motion vector and the second original motion vector is the second target motion vector.

[0325] On the encoding side, the RDO principle may be adopted to determine a first differential motion vector corresponding to the first original motion vector and a second differential motion vector corresponding to the second original motion vector, and the description of the determination process will be omitted.

[0326] When the encoding side transmits the encoded bitstream of the current block to the decoding side, the encoding side may add directional information and amplitude information of the first differential motion vector and directional information and amplitude information of the second differential motion vector to the encoded bitstream.

[0327] Upon receiving an encoded bitstream of the current block, the decoding side may analyze direction information and amplitude information of a first differential motion vector from the encoded bitstream and determine a first differential motion vector based on the direction information and amplitude information of the first differential motion vector. The decoding side may analyze direction information and amplitude information of a second differential motion vector from the encoded bitstream and determine a second differential motion vector based on the direction information and amplitude information of the second differential motion vector. The decoding side may then determine a first target motion vector of the current block based on the first differential motion vector and the first original motion vector, and determine a second target motion vector of the current block based on the second differential motion vector and the second original motion vector.

[0328] In one possible embodiment, the encoding side may further encode a first sub-mode flag and a second sub-mode flag of the enhancement angle weighted prediction mode into the encoded bitstream, where the first sub-mode flag indicates whether to overlap the first original motion vector with a differential motion vector or not to overlap the first original motion vector with a differential motion vector, and the second sub-mode flag indicates whether to overlap the second original motion vector with a differential motion vector or not to overlap the second original motion vector with a differential motion vector.

[0329] In one possible embodiment, the first sub-mode flag may be a first flag bit in the encoded bitstream, and the second sub-mode flag may be a second flag bit in the encoded bitstream.

[0330] Upon receiving the coded bitstream of the current block, the decoding side may first analyze the first submode flag and second submode flag of the emphasis angle weighted prediction mode from the coded bitstream of the current block. If the first submode flag indicates that a differential motion vector is to be superimposed on the first original motion vector, the decoding side may analyze direction information and amplitude information of the first differential motion vector from the coded bitstream of the current block, determine the first differential motion vector based on the direction information and amplitude information of the first differential motion vector, and then determine a first target motion vector for the current block based on the first original motion vector and the first differential motion vector. If the first submode flag indicates that a differential motion vector is not to be superimposed on the first original motion vector, the decoding side may use the first original motion vector as the first target motion vector for the current block without analyzing the direction information and amplitude information of the first differential motion vector. If the second sub-mode flag indicates that a differential motion vector is to be superimposed on the second original motion vector, direction information and amplitude information of the second differential motion vector are analyzed from the coded bitstream of the current block, and the second differential motion vector is determined based on the direction information and amplitude information of the second differential motion vector, and then a second target motion vector of the current block is determined based on the second original motion vector and the second differential motion vector.If the second sub-mode flag indicates that a differential motion vector is not to be superimposed on the second original motion vector, the direction information and amplitude information of the second differential motion vector may not be analyzed, and the second original motion vector may be used as the second target motion vector of the current block.

[0331] Example 15: Based on Example 13 and Example 14, for the case of two differential motion vectors, the following describes the syntax related to overlaying differential motion vectors on unidirectional motion information with reference to some specific application scenarios.

[0332] Application Scenario 1: Table 4 shows an example of the relevant syntax, where SkipFlag indicates whether the current block is in Skip mode, DirectFlag indicates whether the current block is in Direct mode, and AwpFlag indicates whether the current block is in AWP mode.

[0333] awp_idx (angle weighted prediction mode index): An angle weighted prediction mode index value in skip mode or direct mode, and the value of AwpIdx may be equal to the value of awp_idx. If awp_idx does not exist in the bitstream, the value of AwpIdx is equal to 0.

[0334] awp_cand_idx0 (first motion information index for angle weighted prediction mode): The first motion information index value for angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx0 is equal to the value of awp_cand_idx0, and if awp_cand_idx0 is not present in the bitstream, the value of AwpCandIdx0 is equal to 0.

[0335] awp_cand_idx1 (second motion information index for angle weighted prediction mode): The second motion information index value for angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx1 is equal to the value of awp_cand_idx1, and if awp_cand_idx1 is not present in the bitstream, the value of AwpCandIdx1 is equal to 0.

[0336] awp_mvd_flag (emphasis angle weighted prediction mode flag) is a binary variable, and when awp_mvd_flag is a first value (e.g., 1), it indicates that the current block is in emphasis angle weighted prediction mode, and when awp_mvd_flag is a second value (e.g., 0), it indicates that the current block is in non-emphasis angle weighted prediction mode. Exemplarily, the value of AwpMvdFlag may be equal to the value of awp_mvd_flag, and if awp_mvd_flag is not present in the bitstream, the value of AwpMvdFlag is equal to 0.

[0337] awp_mvd_sub_flag0 (first submode flag of the enhanced angle-weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag0 is a first value, it may indicate that the first motion information of the angle-weighted prediction mode needs to overlap differential motion information, and when awp_mvd_sub_flag0 is a second value, it may indicate that the first motion information of the angle-weighted prediction mode does not need to overlap differential motion information. Exemplarily, the value of AwpMvdSubFlag0 may be equal to the value of awp_mvd_sub_flag0, and if awp_mvd_sub_flag0 is not present in the bitstream, the value of AwpMvdSubFlag0 is equal to 0.

[0338] awp_mvd_sub_flag1 (second submode flag of the enhancement angle weighted prediction mode) may be a binary variable, where awp_mvd_sub_flag1 is a first value and may indicate that the second motion information of the angle weighted prediction mode needs to overlap differential motion information, and awp_mvd_sub_flag1 is a second value and may indicate that the second motion information of the angle weighted prediction mode does not need to overlap differential motion information. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 is not present in the bitstream, the following case may exist: if AwpMvdFlag is equal to 1, the value of AwpMvdSubFlag1 may be equal to 1; otherwise, the value of AwpMvdSubFlag1 may be equal to 0.

[0339] awp_mvd_dir0 (differential motion vector direction index value of first motion information) is a differential motion vector direction index value of the first motion information in the angle weighted prediction mode. Exemplarily, the value of AwpMvdDir0 may be equal to the value of awp_mvd_dir0, or if awp_mvd_dir0 does not exist in the bitstream, the value of AwpMvdDir0 may be equal to 0.

[0340] awp_mvd_step0 (length index value of differential motion vector step of first motion information) is the length index value of differential motion vector step of first motion information in angle weighted prediction mode. Exemplarily, the value of AwpMvdStep0 may be equal to the value of awp_mvd_step0, or if awp_mvd_step0 does not exist in the bitstream, the value of AwpMvdStep0 may be equal to 0.

[0341] awp_mvd_dir1 (differential motion vector direction index value of second motion information) is a differential motion vector direction index value of second motion information in angle weighted prediction mode. Exemplarily, the value of AwpMvdIdx1 may be equal to the value of awp_mvd_dir1. If awp_mvd_dir1 does not exist in the bitstream, the value of AwpMvdDir1 may be equal to 0.

[0342] awp_mvd_step1 (length index value of differential motion vector step of second motion information) is the length index value of differential motion vector step of second motion information in angle weighted prediction mode. Exemplarily, the value of AwpMvdStep1 may be equal to the value of awp_mvd_step1. If awp_mvd_step1 is not present in the bitstream, the value of AwpMvdStep1 may be equal to 0. [Table 4]

[0343] Application Scenario 2: Table 5 shows an example of the relevant syntax, where SkipFlag indicates whether the current block is in Skip mode, DirectFlag indicates whether the current block is in Direct mode, and AwpFlag indicates whether the current block is in AWP mode.

[0344] For awp_idx, awp_cand_idx0, and awp_cand_idx1, application scenario 1 can be referred to, and the description thereof will be omitted here.

[0345] awp_mvd_sub_flag0 (first submode flag of the enhanced angle-weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag0 is a first value, it may indicate that the first motion information of the angle-weighted prediction mode needs to overlap differential motion information, and when awp_mvd_sub_flag0 is a second value, it may indicate that the first motion information of the angle-weighted prediction mode does not need to overlap differential motion information. Exemplarily, the value of AwpMvdSubFlag0 may be equal to the value of awp_mvd_sub_flag0, and if awp_mvd_sub_flag0 is not present in the bitstream, the value of AwpMvdSubFlag0 is equal to 0.

[0346] awp_mvd_sub_flag1 (second submode flag of the enhanced angle-weighted prediction mode) may be a binary variable, where awp_mvd_sub_flag1 is a first value and may indicate that the second motion information of the angle-weighted prediction mode needs to overlap differential motion information, and awp_mvd_sub_flag1 is a second value and may indicate that the second motion information of the angle-weighted prediction mode does not need to overlap differential motion information. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 is not present in the bitstream, the value of AwpMvdSubFlag1 may be equal to 0.

[0347] For awp_mvd_dir0, awp_mvd_step0, awp_mvd_dir1, and awp_mvd_step1, refer to application scenario 1. [Table 5]

[0348] For example, the difference between application scenario 1 and application scenario 2 is that the syntax awp_mvd_flag is present in application scenario 1, but the syntax awp_mvd_flag is not present in application scenario 2. In application scenario 1, the emphasis angle weighted prediction mode is controlled by awp_mvd_flag, that is, the emphasis angle weighted prediction mode can be controlled by the master switch.

[0349] Application Scenario 3: Derived from Application Scenario 1 and Application Scenario 2, AWP is fully integrated with AWP-MVR mode, i.e., a 0-span can be added to the span, eliminating the need to code a flag bit indicating whether it is enabled. For example, differential motion vectors support four directions: up, down, left, and right. Differential motion vectors support six step length settings: 0-pel, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel. A 0-pel step length setting is added. Furthermore, Table 4 and Table 5 may be updated to Table 6. The meaning of the relevant syntax in Table 6 can be found in Table 4, and its description is omitted here. [Table 6]

[0350] For example, in the above embodiment, the target motion information may be obtained based on the original motion information, and after obtaining the target motion information, the target motion information of the current block may be stored, and the storage method is not limited.

[0351] Example 16: In Examples 12 and 13, a motion information candidate list needs to be obtained. In the process of obtaining the motion information candidate list, at least one available motion information to be added to the motion information candidate list may be obtained, and the motion information candidate list may be obtained based on the at least one available motion information. For example, for available motion information currently added to the motion information candidate list, if the available motion information is unidirectional motion information and does not overlap with any motion information candidate already existing in the motion information candidate list, the unidirectional motion information is added to the motion information candidate list. If the available motion information is bidirectional motion information and first unidirectional motion information of the bidirectional motion information does not overlap with any motion information candidate already existing in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list. If the available motion information is bidirectional motion information, first unidirectional motion information of the bidirectional motion information overlaps with any motion information candidate already existing in the motion information candidate list, and second unidirectional motion information of the bidirectional motion information does not overlap with any motion information candidate already existing in the motion information candidate list, the second unidirectional motion information is added to the motion information candidate list.

[0352] Illustratively, the first unidirectional motion information is unidirectional motion information that points to a reference frame in a first reference frame list, and the second unidirectional motion information is unidirectional motion information that points to a reference frame in a second reference frame list.

[0353] In one possible embodiment, if the total number of motion information candidates already present in the motion information candidate list (i.e., the total number of motion information candidates already present for the current block) is an even number, the first reference frame list is reference frame list List0 and the second reference frame list is reference frame list List1, and if the total number of motion information candidates already present in the motion information candidate list is an odd number, the first reference frame list is reference frame list List1 and the second reference frame list is reference frame list List0. Alternatively, if the total number of motion information candidates already present in the motion information candidate list is an odd number, the first reference frame list is reference frame list List0 and the second reference frame list is reference frame list List1, and if the total number of motion information candidates already present in the motion information candidate list is an even number, the first reference frame list is reference frame list List1 and the second reference frame list is reference frame list List0.

[0354] In another possible embodiment, the first reference frame list is reference frame list List0 and the second reference frame list is reference frame list List1, or the first reference frame list is reference frame list List1 and the second reference frame list is reference frame list List0.

[0355] In the above embodiment, the at least one available motion information added to the motion information candidate list may include, but is not limited to, at least one of spatial motion information, temporal motion information, HMVP (History-based Motion Vector Prediction) motion information, and pre-defined motion information.

[0356] For example, the motion information candidate list may be a unidirectional motion information candidate list. Figure 9 shows a schematic diagram of a current block and adjacent blocks. The process of obtaining the motion information candidate list involves adding unidirectional spatial motion information to the motion information candidate list in the order of F, G, C, A, B, D to check for overlaps, adding unidirectional temporal motion information to the motion information candidate list to check for overlaps, and finally, if the motion information candidate list is not filled, it is repeatedly filled. Of course, the order of F, G, C, A, B, D is merely an example, and other orders may be adopted, without any limitation.

[0357] The overlap check involves comparing the motion information to be added to the motion information candidate list with each of the motion information candidates already present in the motion information candidate list, and if it does not overlap with any of the motion information candidates already present in the motion information candidate list, it is considered not to be overlapping, and if it overlaps with any of the motion information candidates already present in the motion information candidate list, it is considered to be overlapping.

[0358] The process of obtaining the motion information candidate list will be described below with reference to some specific application scenarios.

[0359] Application scenario 1: Both spatial motion information and temporal motion information are added to the motion information candidate list.

[0360] In the first step, as shown in FIG. 9, F, G, C, A, B, and D are neighboring prediction blocks of the current block E, and the "availability" of the motion information of F, G, C, A, B, and D is determined. Illustratively, if F exists and an inter prediction mode is adopted, the motion information of F is available; otherwise, the motion information of F is unavailable. If G exists and an inter prediction mode is adopted, the motion information of G is available; otherwise, the motion information of G is unavailable. If C exists and an inter prediction mode is adopted, the motion information of C is available; otherwise, the motion information of C is unavailable. If A exists and an inter prediction mode is adopted, the motion information of A is available; otherwise, the motion information of A is unavailable. If B exists and an inter prediction mode is adopted, the motion information of B is available; otherwise, the motion information of B is unavailable. If D exists and an inter prediction mode is adopted, the motion information of D is available; otherwise, the motion information of D is unavailable.

[0361] In the second step, the available motion information is added to the motion information candidate list AwpUniArray according to the order of the available motion information in F, G, C, A, B, D (the order is variable and includes only available motion information) and the order of the temporal motion information (including available motion information) until the length of AwpUniArray becomes X or the traversal ends.

[0362] Case 1: For available motion information currently added to the motion information candidate list, if the available motion information is bidirectional motion information (i.e., including unidirectional motion information pointing to the reference frame list List0 and unidirectional motion information pointing to the reference frame list List1), determine how to add the available motion information to the motion information candidate list AwpUniArray according to the parity of the total number of motion information candidates already in the motion information candidate list (i.e., the current length of the motion information candidate list AwpUniArray). For convenience, the available motion information may also be referred to as the first available motion information.

[0363] Method 1: If the total number of motion information candidates already in the motion information candidate list AwpUniArray is an even number, a check is performed for overlap between the unidirectional motion information that points to reference frame list List0 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is overlap, a check is performed for overlap between the unidirectional motion information that points to reference frame list List1 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0364] Alternatively, if the total number of motion information candidates already present in the motion information candidate list AwpUniArray is odd, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List1 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is an overlap, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List0 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0365] Method 2: If the total number of motion information candidates already in the motion information candidate list AwpUniArray is odd, a check is performed for overlap between the unidirectional motion information that points to reference frame list List0 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is overlap, a check is performed for overlap between the unidirectional motion information that points to reference frame list List1 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0366] Alternatively, if the total number of motion information candidates already present in the motion information candidate list AwpUniArray is an even number, a check is performed to check for overlap between the unidirectional motion information that points to the reference frame list List1 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is an overlap, a check is performed to check for overlap between the unidirectional motion information that points to the reference frame list List0 among the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0367] In case 2, for available motion information currently added to the motion information candidate list, if the available motion information is unidirectional motion information, a process is performed to check whether the unidirectional motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information is added to the motion information candidate list AwpUniArray.

[0368] In the third step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0369] Exemplarily, in application scenario 1, the temporal motion information may be unidirectional motion information or bidirectional motion information. For example, in a P frame, the temporal motion information is unidirectional motion information, and in a B frame, the temporal motion information is bidirectional motion information.

[0370] Application scenario 2: After the spatial motion information is added to the motion information candidate list, Y positions are reserved for the temporal motion information, and the temporal motion information is bidirectional motion information, that is, the motion information candidate list contains Y pieces of temporal motion information.

[0371] In the first step, the “availability” of motion information for F, G, C, A, B, and D is determined, and application scenario 1 is referred to.

[0372] In the second step, according to the order of the available motion information in F, G, C, A, B, and D (the order is variable and includes only available motion information), the available motion information (each spatially available motion information) is added to the motion information candidate list AwpUniArray until the length of the motion information candidate list AwpUniArray becomes XY or the traversal of the available motion information is completed.

[0373] The second step of application scenario 2 can refer to the second step of application scenario 1, and will not be described again here.

[0374] In the third step, for the temporal motion information currently being added to the motion information candidate list (for example, bidirectional temporal motion information and available motion information), the temporal motion information is added to the motion information candidate list AwpUniArray according to the parity of the total number of motion information candidates already present in the motion information candidate list (i.e., the current length of the motion information candidate list).

[0375] Method 1: If the total number of motion information candidates already in the motion information candidate list AwpUniArray is even, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List0 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is overlap, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List1 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0376] Alternatively, if the total number of motion information candidates already present in the motion information candidate list AwpUniArray is odd, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List1 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is overlap, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List0 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0377] Method 2: If the total number of motion information candidates already existing in the motion information candidate list AwpUniArray is odd, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List0 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is overlap, a check is performed to check for overlap between the unidirectional motion information that points to reference frame list List1 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0378] Alternatively, if the total number of motion information candidates already in the motion information candidate list AwpUniArray is an even number, a check is performed to see if the unidirectional motion information that points to the reference frame list List1 among the temporal motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is an overlap, a check is performed to see if the unidirectional motion information that points to the reference frame list List0 among the temporal motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0379] In the fourth step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0380] Application scenario 3: After the spatial motion information is added to the motion information candidate list, Y positions are reserved for the temporal motion information, and the temporal motion information is unidirectional motion information, that is, the motion information candidate list contains Y pieces of temporal motion information.

[0381] In the first step, the “availability” of motion information for F, G, C, A, B, and D is determined, and application scenario 1 is referred to.

[0382] In the second step, according to the order of the available motion information in F, G, C, A, B, and D (the order is variable and includes only available motion information), the available motion information (each spatially available motion information) is added to the motion information candidate list AwpUniArray until the length of the motion information candidate list AwpUniArray becomes XY or the traversal of the available motion information is completed.

[0383] The second step of application scenario 3 can refer to the second step of application scenario 1, and will not be described again here.

[0384] In the third step, for the temporal motion information currently added to the motion information candidate list (for example, unidirectional temporal motion information that is available), a process is performed to check whether the temporal motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the temporal motion information is added to the motion information candidate list AwpUniArray.

[0385] In the fourth step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0386] Application scenario 4: Both spatial motion information and temporal motion information are added to the motion information candidate list.

[0387] In the first step, the “availability” of motion information for F, G, C, A, B, and D is determined, and application scenario 1 is referred to.

[0388] In the second step, the available motion information is added to the motion information candidate list AwpUniArray according to the order of the available motion information in F, G, C, A, B, D (the order is variable and includes only available motion information) and the order of the temporal motion information (including available motion information) until the length of AwpUniArray becomes X or the traversal ends.

[0389] Case 1: For the available motion information currently added to the motion information candidate list, if the available motion information is bidirectional motion information (i.e., including unidirectional motion information pointing to the reference frame list List0 and unidirectional motion information pointing to the reference frame list List1), add the available motion information to the motion information candidate list AwpUniArray. For convenience, the available motion information may also be referred to as the second available motion information.

[0390] Method 1: A process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List0 among the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is an overlap, a process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List1 among the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0391] Method 2: A process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List1 among the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is an overlap, a process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List0 among the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0392] In case 2, for available motion information currently added to the motion information candidate list, if the available motion information is unidirectional motion information, a process is performed to check whether the unidirectional motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information is added to the motion information candidate list AwpUniArray.

[0393] In the third step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0394] Exemplarily, in application scenario 4, the temporal motion information may be unidirectional motion information or bidirectional motion information. For example, in a P frame, the temporal motion information is unidirectional motion information, and in a B frame, the temporal motion information is bidirectional motion information.

[0395] Application scenario 5: After the spatial motion information is added to the motion information candidate list, Y positions are reserved for the temporal motion information, and the temporal motion information is bidirectional motion information, that is, the motion information candidate list contains Y pieces of temporal motion information.

[0396] In the first step, the “availability” of motion information for F, G, C, A, B, and D is determined, and application scenario 1 is referred to.

[0397] In the second step, according to the order of the available motion information in F, G, C, A, B, and D (the order is variable and includes only available motion information), the available motion information (i.e., the available motion information for each spatial domain) is added to the motion information candidate list AwpUniArray until the length of the motion information candidate list AwpUniArray becomes XY or the traversal of the available motion information is completed.

[0398] The second step of application scenario 5 can refer to the second step of application scenario 1, and will not be described again here.

[0399] In the third step, for the temporal motion information currently added to the motion information candidate list (for example, bidirectional temporal motion information and available motion information), the temporal motion information is added to the motion information candidate list AwpUniArray.

[0400] Method 1: A process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List0 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray. If there is overlap, a process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List1 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray.

[0401] Method 2: A process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List1 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If there is overlap, a process is performed to check for overlap between the unidirectional motion information that points to the reference frame list List0 among the temporal motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the unidirectional motion information that points to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0402] In the fourth step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0403] After the spatial motion information is added to the motion information candidate list, Y positions are reserved for the temporal motion information, and the temporal motion information is unidirectional motion information, that is, the motion information candidate list includes Y pieces of temporal motion information.

[0404] In the first step, the “availability” of motion information for F, G, C, A, B, and D is determined, and application scenario 1 is referred to.

[0405] In the second step, you can refer to the second step of Application Scenario 4, and we will not repeat the description here.

[0406] In the third step, for the temporal motion information currently added to the motion information candidate list (for example, unidirectional temporal motion information that is available), a process is performed to check whether the temporal motion information overlaps with the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no overlap, the temporal motion information is added to the motion information candidate list AwpUniArray.

[0407] In the fourth step, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X.

[0408] In each of the above application scenarios, X may take any positive integer, for example, the value of X may be 4, 5, etc.

[0409] In each of the above application scenarios, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled in until the length of the list becomes X. In actual applications, the effective motion information may be increased by deriving motion information before repeatedly filling in the last unidirectional motion information. For example, based on any valid motion information (x, y, ref_idx, ListX) in the motion information candidate list, where ref_idx and ListX are the reference frame index and reference frame list, respectively, and collectively referred to as reference frame information, at least one of the following motion information may be added: (x+a, y+b, ref_idx, ListX), where a and b may be any integer; (k1*x, k1*y, ref_idx_new1, ListX), where k1 is any positive integer except 0, i.e., the motion vector is scaled; or (k2*x, k2*y, ref_idx_new2, ListY), where k2 is any positive integer except 0, i.e., the motion vector is scaled. Zero motion information may also be added, i.e., the motion information may be (0, 0, ref_idx3, ListZ). When adding the above motion information to the motion information candidate list, a duplication check process may or may not be performed. After that, if the length of the motion information candidate list AwpUniArray is still less than X, the above repeated filling may be continued.

[0410] In each of the above application scenarios, in addition to the spatial motion information and the temporal motion information, HMVP motion information may be added to the motion information candidate list AwpUniArray, and the process of adding this HMVP motion information is not limited.

[0411] In each of the above application scenarios, a motion information candidate list AwpUniArray may be constructed, the motion information in AwpUniArray may be called motion information candidate, and the motion information candidate from AwpUniArray may be selected as the target motion information of the current block, and then the predicted value of the pixel position may be determined based on the target motion information.

[0412] In one possible embodiment, two motion information candidates may be selected from the AwpUniArray and used as the first and second target motion information for the current block. The decoding side may then analyze AwpCandIdx0 and AwpCandIdx1 from the coded bitstream and assign the AwpCandIdx0+1-th motion information in the AwpUniArray to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1. The AwpCandIdx1+1-th motion information in the AwpUniArray may be assigned to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1. Of course, the AwpCandIdx0+1th motion information in the AwpUniArray can be given to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1, and the AwpCandIdx1+1th motion information in the AwpUniArray can be given to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1, and there is no limitation in this regard.

[0413] For example, since AwpCandIdx0 represents the index value of the first target motion information, AwpCandIdx0+1-th motion information in AwpUniArray may be assigned to the first target motion information. For example, if AwpCandIdx0 is 0, the first motion information in AwpUniArray is assigned to the first target motion information, and if AwpCandIdx0 is 1, the second motion information in AwpUniArray is assigned to the first target motion information.

[0414] mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1 together constitute first target motion information, that is, the first target motion information includes unidirectional motion information pointing to List0 and unidirectional motion information pointing to List1.

[0415] If the AwpCandIdx0+1-th motion information in the AwpUniArray is unidirectional motion information pointing to List0, the first target motion information includes unidirectional motion information pointing to List0, and the unidirectional motion information pointing to List1 is null.

[0416] If the AwpCandIdx0+1-th motion information in the AwpUniArray is unidirectional motion information pointing to List1, the first target motion information includes unidirectional motion information pointing to List1, and the unidirectional motion information pointing to List0 is null.

[0417] Exemplarily, mvAwp0L0 and RefIdxAwp0L0 represent unidirectional motion information that points to List0 in the first target motion information, and mvAwp0L1 and RefIdxAwp0L1 represent unidirectional motion information that points to List1 in the first target motion information.

[0418] If RefIdxAwp0L0 is valid, it indicates that the unidirectional motion information pointing to List0 is valid, so the prediction mode of the first target motion information is PRED_List0, that is, the predicted value of the unidirectional motion information pixel position pointing to List0 may be adopted.

[0419] If RefIdxAwp0L1 is valid, it indicates that the unidirectional motion information pointing to List1 is valid, so the prediction mode of the first target motion information is PRED_List1, that is, the predicted value of the unidirectional motion information pixel position pointing to List1 may be adopted.

[0420] For example, since AwpCandIdx1 represents the index value of the second target motion information, the AwpCandIdx1+1th motion information in AwpUniArray can be assigned to the second target motion information. For example, if AwpCandIdx1 is 0, the first motion information in AwpUniArray is assigned to the second target motion information, and if AwpCandIdx1 is 1, the second motion information in AwpUniArray is assigned to the second target motion information.

[0421] mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1 together constitute second target motion information, that is, the second target motion information includes unidirectional motion information pointing to List0 and unidirectional motion information pointing to List1.

[0422] If the AwpCandIdx1+1-th motion information in the AwpUniArray is unidirectional motion information pointing to List0, the second target motion information includes unidirectional motion information pointing to List0, and the unidirectional motion information pointing to List1 is null.

[0423] If the AwpCandIdx1+1-th motion information in the AwpUniArray is unidirectional motion information pointing to List1, the second target motion information includes unidirectional motion information pointing to List1, and the unidirectional motion information pointing to List0 is null.

[0424] Exemplarily, mvAwp1L0 and RefIdxAwp1L0 represent unidirectional motion information that points to List0 in the second target motion information, and mvAwp1L1 and RefIdxAwp1L1 represent unidirectional motion information that points to List1 in the second target motion information.

[0425] If RefIdxAwp1L0 is valid, it indicates that the unidirectional motion information pointing to List0 is valid, so the prediction mode of the second target motion information is PRED_List0, that is, the predicted value of the unidirectional motion information pixel position pointing to List0 may be adopted.

[0426] If RefIdxAwp1L1 is valid, it indicates that the unidirectional motion information pointing to List1 is valid, so the prediction mode of the second target motion information is PRED_List1, that is, the predicted value of the unidirectional motion information pixel position pointing to List1 may be adopted.

[0427] In another possible embodiment, one motion information candidate from the AwpUniArray may be selected as the target motion information for the current block. The decoding side may analyze AwpCandIdx from the coded bitstream and provide the AwpCandIdx+1-th motion information in the AwpUniArray to mvAwpL0, mvAwpL1, RefIdxAwpL0, and RefIdxAwpL1. AwpCandIdx represents the index value of the target motion information, and mvAwpL0, mvAwpL1, RefIdxAwpL0, and RefIdxAwpL1 together form the target motion information. mvAwpL0 and RefIdxAwpL0 represent unidirectional motion information that points to List0 in the target motion information, and mvAwpL1 and RefIdxAwpL1 represent unidirectional motion information that points to List1 in the target motion information.

[0428] Exemplarily, Examples 1 to 16 may be realized alone or in combination. For example, Examples 1 and 2 may be realized in combination, Examples 1 and 3 may be realized in combination, Examples 1, 2, and 3 may be realized in combination, Example 4 may be realized in combination with one or more of Examples 1 to 3, Example 5 may be realized in combination with one or more of Examples 1 to 3, Example 6 may be realized in combination with one or more of Examples 1 to 3, Example 7 may be realized in combination with one or more of Examples 1 to 3, Example 8 may be realized in combination with one or more of Examples 1 to 3, Example 9 may be realized in combination with one or more of Examples 1 to 3, and Example Example 10 may be realized in combination with one or more of Examples 1 to 3, Example 11 may be realized in combination with one or more of Examples 1 to 3, Example 12 may be realized in combination with one or more of Examples 1 to 3, Example 13 may be realized in combination with one or more of Examples 1 to 3, Example 14 may be realized in combination with one or more of Examples 1 to 3, Example 15 may be realized in combination with one or more of Examples 1 to 3, and Example 16 may be realized in combination with one or more of Examples 1 to 3; of course, the above are only some examples and do not limit the combination methods between Examples.

[0429] In the above embodiment, the method used on the encoding side and the method used on the decoding side can refer to each other.

[0430] Example 17: Based on the same concept as the above method, an embodiment of the present invention further proposes an encoding / decoding device applied to the encoding side or the decoding side, and Figure 10A shows a configuration diagram of the device, which includes an acquisition module 111, a setting module 112, and a determination module 113.

[0431] The acquisition module 111 is used to acquire a weighted prediction angle and weight setting parameters of a current block when it is determined to start weighted prediction for the current block, where the weight setting parameters include a weight transformation rate and a start position of weight transformation.

[0432] The setting module 112 is used to set reference weight values ​​to the surrounding positions outside the current block according to the weight setting parameters.

[0433] The determination module 113 is used to, for each pixel position of the current block, determine a surrounding matching position pointed to by the pixel position from surrounding positions outside the current block based on the weighted prediction angle, determine a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position, determine an associated weight value for the pixel position based on the target weight value for the pixel position, determine a first predicted value for the pixel position based on a first prediction mode of the current block, determine a second predicted value for the pixel position based on a second prediction mode of the current block, determine a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value, and determine a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0434] If the current block supports a weight conversion rate switching mode, the acquisition module 111 acquires first weight conversion rate indication information of the current block, and determines a weight conversion rate of the current block based on the first weight conversion rate indication information, where if the first weight conversion rate indication information is first indication information, the weight conversion rate of the current block is the first weight conversion rate, and if the first weight conversion rate indication information is second indication information, the weight conversion rate of the current block is the second weight conversion rate.

[0435] The first weighting conversion factor indication information is image level indication information, the first weighting conversion factor indication information of the current block represents a weighting conversion factor switching identifier corresponding to the current block, the first indication information is used to indicate that the current block does not need to perform weighting conversion factor switching, and the second indication information is used to indicate that the current block needs to perform weighting conversion factor switching, and the absolute value of the first weighting conversion factor is not equal to the absolute value of the second weighting conversion factor.

[0436] If the current block supports a weight conversion rate switching mode, the acquisition module 111 acquires second weight conversion rate indication information of the current block, and selects a weight conversion rate corresponding to the second weight conversion rate indication information from a preset lookup table, where the preset lookup table includes at least two weight conversion rates, and determines the selected weight conversion rate as the weight conversion rate of the current block.

[0437] Exemplarily, when the setting module 112 sets reference weight values ​​for surrounding positions outside the current block based on the weight setting parameters, the setting module 112 is specifically used to set the reference weight value for each surrounding position outside the current block based on the coordinate values ​​of the surrounding position, the coordinate values ​​of the starting position of the weight conversion, and the weight conversion rate.

[0438] Exemplarily, the starting position of the weighted transformation is determined by at least one of the weighted prediction angle, the weighted prediction position of the current block, and the size of the current block. The number of surrounding positions outside the current block is determined based on the size of the current block and / or the weighted prediction angle of the current block. The reference weight values ​​of the surrounding positions outside the current block monotonically increase. The surrounding positions outside the current block include at least one of integer pixel positions or sub-pixel positions. The surrounding positions outside the current block include at least one of the surrounding positions in the top row outside the current block or the surrounding positions in the left column outside the current block.

[0439] The reference weight values ​​of the peripheral positions outside the current block include a reference weight value of a target area, a reference weight value of a first adjacent area of ​​the target area, and a reference weight value of a second adjacent area of ​​the target area, where the reference weight values ​​of the first adjacent area are all second reference weight values ​​and the reference weight values ​​of the second adjacent area are all third reference weight values, where the second reference weight value is different from the third reference weight value. The target area includes one reference weight value or at least two reference weight values, where if the target area includes the at least two reference weight values, the at least two reference weight values ​​of the target area monotonically increase.

[0440] The weighted prediction angle is a horizontal angle, or the weighted prediction angle is a vertical angle, or the absolute value of the gradient of the weighted prediction angle is 2 n , where n is an integer.

[0441] For example, the determination module 113 is further used to determine a target weight value of the pixel position based on the reference weight value of the integer pixel position when the surrounding matching position is an integer pixel position and a reference weight value is set for the integer pixel position; or to determine a target weight value of the pixel position based on the reference weight value of the sub-pixel position when the surrounding matching position is a sub-pixel position and a reference weight value is set for the sub-pixel position.

[0442] If the first prediction mode is an inter prediction mode, the determination module 113 further obtains a motion information candidate list, the motion information candidate list including at least one motion information candidate, and selects one motion information candidate from the motion information candidate list as the original motion information of the current block, determines target motion information of the current block based on the original motion information, and determines a first predicted value of the pixel position based on the target motion information.

[0443] The original motion information includes an original motion vector, the target motion information includes a target motion vector, and the determination module 113 is further used to obtain a differential motion vector corresponding to the original motion vector, and determine a target motion vector based on the differential motion vector and the original motion vector.

[0444] On the decoding side, the determination module 113 is further used to analyze the direction information and amplitude information of the differential motion vector from the encoded bitstream of the current block, and determine the differential motion vector based on the direction information and amplitude information of the differential motion vector.

[0445] If the direction information indicates a direction to the right and the amplitude information indicates an amplitude as Ar, the differential motion vector will be (Ar, 0); if the direction information indicates a direction to the down direction and the amplitude information indicates an amplitude as Ad, the differential motion vector will be (0, -Ad); if the direction information indicates a direction to the left and the amplitude information indicates an amplitude as Al, the differential motion vector will be (-Al, 0); and if the direction information indicates a direction to the up direction and the amplitude information indicates an amplitude as Au, the differential motion vector will be (0, Au).

[0446] On the decoding side, the determination module 113 is further used to analyze flag information from the encoded bitstream of the current block, and if the flag information indicates that a differential motion vector is to be superimposed on the original motion vector, to analyze direction information and amplitude information of the differential motion vector from the encoded bitstream of the current block.

[0447] The determining module 113 is further used for obtaining at least one available motion information to be added to a motion information candidate list, and constructing the motion information candidate list based on the at least one available motion information.

[0448] The at least one available motion information includes at least one of spatial motion information, temporal motion information, and preset motion information.

[0449] The device embodiments basically correspond to the method embodiments, so please refer to the description of some of the method embodiments for relevant parts. The device embodiments described above are merely schematic, and units described herein as separate components may or may not be physically separated, and components shown as units may or may not be physical units, i.e., may be located in one place or distributed across multiple network units. Some or all of the modules may be selected to achieve the purpose of the means of the embodiments according to actual needs. Those skilled in the art can understand and implement them without any creative effort.

[0450] Based on the same concept as the above method, a decoding device (which may also be called a video decoder) provided by an embodiment of the present invention, the hardware architecture of which can be specifically seen in FIG. 10B, includes a processor 121 and a machine-readable storage medium 122, the machine-readable storage medium 122 storing machine-executable instructions executable by the processor 121, and the processor 121 is used to realize the methods disclosed in the above embodiments of the present invention by executing the machine-executable instructions. For example, the processor 121 executes the machine-executable instructions to perform the following steps when determining to start weighted prediction for a current block: acquiring a weighted prediction angle and weight setting parameters for the current block, the weight setting parameters including a weight conversion rate and a start position of weight conversion; setting reference weight values ​​to peripheral positions outside the current block based on the weight setting parameters; determining, for each pixel position of the current block, peripheral matching positions pointed to by the pixel position from peripheral positions outside the current block based on the weighted prediction angle; and calculating a reference weight value for the peripheral matching position. determining a target weight value for the pixel position based on associated reference weight values ​​and determining an associated weight value for the pixel position based on the target weight value for the pixel position; determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0451] Based on the same concept as the above method, an encoding device (which may also be called a video encoder) provided by an embodiment of the present invention, the hardware architecture of which can be specifically seen in FIG. 10C , includes a processor 131 and a machine-readable storage medium 132. The machine-readable storage medium 132 stores machine-executable instructions executable by the processor 131. The processor 131 is used to realize the methods disclosed in the above embodiments of the present invention by executing the machine-executable instructions. For example, the processor 131 executes the machine-executable instructions to perform the following steps when determining to start weighted prediction for a current block: acquiring a weighted prediction angle and weight setting parameters for the current block, the weight setting parameters including a weight conversion rate and a start position of weight conversion; setting reference weight values ​​to peripheral positions outside the current block based on the weight setting parameters; determining, for each pixel position of the current block, peripheral matching positions pointed to by the pixel position from peripheral positions outside the current block based on the weighted prediction angle; and calculating a weight value for the peripheral matching position. determining a target weight value for the pixel position based on associated reference weight values ​​and determining an associated weight value for the pixel position based on the target weight value for the pixel position; determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0452] Based on the same concept as the above method, an embodiment of the present invention further provides a camera device, which may include the encoding / decoding device in any of the above embodiments, and which can perform processing using the above flow.

[0453] Based on the same concept as the above methods, an embodiment of the present invention further provides a machine-readable storage medium storing some computer instructions, which, when executed by a processor, can realize the methods disclosed in the above examples of the present invention, such as the encoding and decoding methods in each of the above embodiments.

[0454] The systems, devices, modules, or units described in the above embodiments may be realized by computer chips or entities, or by products having specific functions. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, laptop computer, c...

Claims

1. An encoding / decoding method, comprising: When it is determined to start weighted prediction for a current block, a step of obtaining a weighted prediction angle and a weight setting parameter for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter; For each pixel location in the current block: determining a neighboring matching position indicated by the pixel position from neighboring positions outside the current block based on the weighted prediction angle; determining a target weight value for the pixel location based on reference weight values ​​associated with the surrounding matching locations; determining an associated weight value for the pixel location based on a target weight value for the pixel location; determining a first predicted value for the pixel location based on a first prediction mode of the current block; determining a second predicted value for the pixel location based on a second prediction mode of the current block; determining a weighted prediction for the pixel location based on the first prediction, the target weight, the second prediction, and the associated weight; determining a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions of the current block; 1. An encoding / decoding method comprising:

2. If the current block supports a weight conversion rate switching mode, obtaining the weight conversion rate of the current block includes: obtaining first weighting factor indication information of the current block; determining a weight conversion rate of the current block based on the first weight conversion rate instruction information, wherein if the first weight conversion rate instruction information is first instruction information, the weight conversion rate of the current block is a first weight conversion rate, and if the first weight conversion rate instruction information is second instruction information, the weight conversion rate of the current block is a second weight conversion rate; 2. The method of claim 1 .

3. the first weighting conversion rate instruction information is image level instruction information, the first weighting conversion rate instruction information of the current block represents a weighting conversion rate switching identifier corresponding to the current block, the first instruction information is used to indicate that the current block does not need to perform weighting conversion rate switching, and the second instruction information is used to indicate that the current block needs to perform weighting conversion rate switching; 3. The method of claim 2.

4. If the current block supports a weight conversion rate switching mode, obtaining the weight conversion rate of the current block includes: obtaining second weighting factor indication information for the current block; selecting a weight conversion factor corresponding to the second weight conversion factor indication information from a preset lookup table, the preset lookup table including at least two weight conversion factors; determining the selected weight transformation rate as the weight transformation rate of the current block; 2. The method of claim 1 .

5. The step of setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter includes: and setting the reference weight value for each peripheral position outside the current block based on a coordinate value of the peripheral position, a coordinate value of a start position of the weight conversion, and the weight conversion rate.

2. The method of claim 1 .

6. a start position of the weighted transformation is determined by at least one of the weighted prediction angle, the weighted prediction position of the current block, and the size of the current block; 2. The method of claim 1 .

7. the number of surrounding positions outside the current block is determined based on a size of the current block and / or a weighted prediction angle of the current block; The reference weight values ​​of the peripheral positions outside the current block monotonically increase, the surrounding locations outside the current block include at least one of integer pixel locations or sub-pixel locations; the peripheral positions outside the current block include at least one of a peripheral position in one row above the current block or a peripheral position in one column to the left of the current block; 2. The method of claim 1 .

8. The reference weight values ​​of the peripheral positions outside the current block include a reference weight value of a target area, a reference weight value of a first adjacent area of ​​the target area, and a reference weight value of a second adjacent area of ​​the target area, wherein: the reference weight values ​​of the first adjacent region are all second reference weight values, the reference weight values ​​of the second adjacent region are all third reference weight values, and the second reference weight values ​​are different from the third reference weight values; 2. The method of claim 1 .

9. The target region includes one reference weight value or at least two reference weight values, and when the target region includes the at least two reference weight values, the at least two reference weight values ​​of the target region are monotonically increasing.

9. The method of claim 8.

10. the weighted prediction angle is a horizontal angle, or the weighted prediction angle is a vertical angle, or the absolute value of the gradient of the weighted prediction angle is 2 n , where n is an integer; 2. The method of claim 1 .

11. determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations, When the neighboring matching positions are integer pixel positions and a reference weight value is set for the integer pixel positions, determining the target weight value for the pixel positions based on the reference weight value for the integer pixel positions; or and when the neighboring matching position is a sub-pixel position and a reference weight value is set for the sub-pixel position, determining the target weight value for the pixel position based on the reference weight value for the sub-pixel position.

2. The method of claim 1 .

12. When the first prediction mode is an inter prediction mode, determining a first predicted value for the pixel position based on the first prediction mode of the current block includes: obtaining a motion information candidate list, the motion information candidate list including at least one motion information candidate; selecting one motion information candidate from the motion information candidate list as the original motion information of the current block; determining target motion information for the current block based on the original motion information; determining the first predicted value for the pixel location based on the target motion information.

2. The method of claim 1 .

13. The original motion information includes an original motion vector, and the target motion information includes a target motion vector, and determining the target motion information of the current block based on the original motion information includes: obtaining a differential motion vector corresponding to the original motion vector; determining the target motion vector based on the differential motion vector and the original motion vector; 13. The method of claim 12.

14. When the method is applied to a decoding side, the step of obtaining a differential motion vector corresponding to the original motion vector includes: analyzing direction information and amplitude information of the differential motion vector from the coded bitstream of the current block; determining the differential motion vector based on direction information and amplitude information of the differential motion vector; 14. The method of claim 13.

15. If the direction information indicates a direction to the right and the amplitude information indicates an amplitude as Ar, the differential motion vector is (Ar, 0), If the direction information indicates a downward direction and the amplitude information indicates an amplitude Ad, the differential motion vector is (0, -Ad), If the direction information indicates a direction to the left and the amplitude information indicates an amplitude as Al, the differential motion vector is (-Al, 0), If the direction information indicates an upward direction and the amplitude information indicates an amplitude Au, the differential motion vector is (0, Au).

15. The method of claim 14.

16. The step of analyzing direction information and amplitude information of the differential motion vector from the coded bitstream of the current block includes: analyzing flag information from the coded bitstream of the current block; If the flag information indicates that a differential motion vector is to be superimposed on the original motion vector, analyzing direction information and amplitude information of the differential motion vector from the coded bitstream of the current block.

15. The method of claim 14.

17. The construction of the motion information candidate list includes: obtaining at least one available motion information to be added to the motion information candidate list; and constructing the motion information candidate list based on the at least one available motion information.

13. The method of claim 12.

18. the at least one available motion information, spatial motion information; Time movement information and and at least one of preset motion information; 18. The method of claim 17.

19. An encoding / decoding device, comprising: an acquisition module for acquiring a weighted prediction angle and a weight setting parameter of a current block when it is determined to start weighted prediction for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; a setting module for setting reference weight values ​​at peripheral positions outside the current block based on the weight setting parameters; For each pixel location in the current block: determining a peripheral matching position indicated by the pixel position from peripheral positions outside the current block based on the weighted prediction angle; determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations; determining an associated weight value for the pixel location based on a target weight value for the pixel location; determining a first predicted value for the pixel location based on a first prediction mode of the current block; determining a second predicted value for the pixel location based on a second prediction mode of the current block; determining a weighted prediction for the pixel location based on the first prediction, the target weight, the second prediction, and the associated weight; a determination module for determining a weighted prediction value of the current block based on weighted prediction values ​​of all pixel positions of the current block; An encoding / decoding device characterized by:

20. a decoding device including a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor; The processor executes the machine-executable instructions to: When it is determined to start weighted prediction for a current block, a step of obtaining a weighted prediction angle and a weight setting parameter for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter; For each pixel location in the current block: determining a neighboring matching position indicated by the pixel position from neighboring positions outside the current block based on the weighted prediction angle; determining a target weight value for the pixel location based on reference weight values ​​associated with the surrounding matching locations; determining an associated weight value for the pixel location based on a target weight value for the pixel location; determining a first predicted value for the pixel location based on a first prediction mode of the current block; determining a second predicted value for the pixel location based on a second prediction mode of the current block; determining a weighted prediction for the pixel location based on the first prediction, the target weight, the second prediction, and the associated weight; determining a weighted prediction value for the current block based on weighted prediction values ​​for all pixel positions of the current block; Decryption device.

21. a coding device including a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor; The processor executes the machine-executable instructions to: When it is determined to start weighted prediction for a current block, a step of obtaining a weighted prediction angle and a weight setting parameter for the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion; setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter; For each pixel location in the current block: determining a neighboring matching position indicated by the pixel position from neighboring positions outside the current block based on the weighted prediction angle; determining a target weight value for the pixel location based on reference weight values ​​associated with the surrounding matching locations; determining an associated weight value for the pixel location based on a target weight value for the pixel location; determining a first predicted value for the pixel location based on a first prediction mode of the current block; determining a second predicted value for the pixel location based on a second prediction mode of the current block; determining a weighted prediction for the pixel location based on the first prediction, the target weight, the second prediction, and the associated weight; determining a weighted prediction value for the current block based on weighted prediction values ​​for all pixel positions of the current block; Encoding device.