Methods, machines, and equipment for encoding and decoding.

VN10061859BActive Publication Date: 2026-09-25HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202300082
Authority / Receiving Office
VN · VN
Patent Type
Patents
Current Assignee / Owner
Priority Date
2020-06-30
Filing Date
2021-06-24
Publication Date
2026-09-25
Estimated Expiration
2041-06-24

AI Technical Summary

Technical Problem

In existing video coding technology, rectangular block division cannot effectively segment two different objects at the edge of an object, resulting in poor prediction and poor coding performance, especially when the object motion is inconsistent.

Method used

A coding and decoding method is proposed. By obtaining the weight prediction angle and weight configuration parameters of the current block, a reasonable target weight value is configured for each pixel position, the target weight value is determined using the reference weight value of the surrounding matching position, and weighting is performed based on motion information. Prediction, improving prediction accuracy and encoding performance.

Benefits of technology

It improves the prediction accuracy and coding performance of video coding, makes the prediction value of the current block closer to the original pixel, and improves the coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202300082_0
    Figure VN1202300082_0
Patent Text Reader

Abstract

The invention relates to a method, machine, and apparatus for encoding and decoding. The encoding and decoding method includes: obtaining the predicted weight angle and the weight configuration parameters; configuring the reference weight values ​​for the surrounding positions outside the current block; determining the surrounding match position that the pixel position points to; determining the target weight value of the pixel position based on the reference weight value related to the surrounding match position, and determining the associated weight value of the pixel position based on the target weight value of the pixel position; determining the first predicted value of the pixel position and the second predicted value; determining the weighted predicted value of the pixel position based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; and determining the weighted predicted values ​​of the current block based on the weighted predicted values ​​of each pixel position of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus and device for encoding and decoding

[0001] Cross-references to related applications

[0002] This patent application claims priority to Chinese Patent Application No. 202010622752.7, filed on June 30, 2020, entitled “An Encoding / Decoding Method, Apparatus and Device Thereof”, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of encoding and decoding technology, and in particular to an encoding and decoding method, apparatus and device. Background Technology

[0004] To save space, video images are encoded before transmission. Video encoding includes processes such as prediction, transform, quantization, entropy coding, and filtering. Prediction can be divided into intra-frame prediction and inter-frame prediction. Inter-frame prediction utilizes the temporal correlation of the video to predict the current pixel using pixels from neighboring encoded images, effectively removing temporal redundancy. Intra-frame prediction utilizes the spatial correlation of the video to predict the current pixel using pixels from the encoded blocks of the current frame, removing spatial redundancy.

[0005] In related technologies, the current block is rectangular, but the edges of actual objects are often not rectangular. Therefore, for the object edge, there are often two different objects (such as a foreground object and a background object). Based on this, when the movements of the two objects are inconsistent, rectangular partitioning cannot effectively separate the two objects. Even if the current block is divided into two non-rectangular sub-blocks and the current block is predicted through the two non-rectangular sub-blocks, there are still problems such as poor prediction effect and poor coding performance.

[0006] Summary of the Invention

[0007] In view of this, this application provides an encoding / decoding method, apparatus, and device that improve the accuracy of prediction.

[0008] This application provides an encoding / decoding method, the method comprising:

[0009] When determining to initiate weighted prediction for the current block, the weight prediction angle and weight configuration parameters of the current block are obtained;

[0010] Configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters;

[0011] For each pixel position of the current block, a surrounding matching position to which the pixel position points is determined from the surrounding positions outside the current block according to the weighted prediction angle; a target weight value of the pixel position is determined according to the reference weight value associated with the surrounding matching position; and an associated weight value of the pixel position is determined according to the target weight value of the pixel position.

[0012] Obtain a motion information candidate list, the motion information candidate list including at least one candidate motion information; based on the motion information candidate list, obtain the first target motion information and the second target motion information of the current block;

[0013] A first predicted value for the pixel position is determined based on the first target motion information of the current block, and a second predicted value for the pixel position is determined based on the second target motion information of the current block; a weighted predicted value for the pixel position is determined based on the first predicted value, the target weight value, the second predicted value, and the associated weight value.

[0014] The weighted prediction value of the current block is determined based on the weighted prediction values ​​of all pixel positions in the current block.

[0015] This application provides an encoding / decoding apparatus, comprising: an acquisition module, configured to acquire a weight prediction angle and weight configuration parameters of the current block when weighted prediction is initiated for the current block; a configuration module, configured to configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters; and a determination module, configured to, for each pixel position of the current block, determine a surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weight prediction angle; determine a target weight value of the pixel position according to the reference weight value associated with the surrounding matching position; and determine an associated weight value of the pixel position according to the target weight value of the pixel position. The module is further configured to obtain a motion information candidate list, the motion information candidate list including at least one candidate motion information; obtain a first target motion information and a second target motion information of the current block based on the motion information candidate list; the determining module is further configured to determine a first predicted value of the pixel position based on the first target motion information of the current block, and determine a second predicted value of the pixel position based on the second target motion information of the current block; determine a weighted predicted value of 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 of the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0016] This application provides a decoding end device, including: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;

[0017] The processor is used to execute machine-executable instructions to perform the following steps:

[0018] When determining to initiate weighted prediction for the current block, the weight prediction angle and weight configuration parameters of the current block are obtained;

[0019] Configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters;

[0020] For each pixel position of the current block, a surrounding matching position to which the pixel position points is determined from the surrounding positions outside the current block according to the weighted prediction angle; a target weight value of the pixel position is determined according to the reference weight value associated with the surrounding matching position; and an associated weight value of the pixel position is determined according to the target weight value of the pixel position.

[0021] Obtain a motion information candidate list, the motion information candidate list including at least one candidate motion information; based on the motion information candidate list, obtain the first target motion information and the second target motion information of the current block;

[0022] A first predicted value for the pixel position is determined based on the first target motion information of the current block, and a second predicted value for the pixel position is determined based on the second target motion information of the current block; a weighted predicted value for the pixel position is determined based on the first predicted value, the target weight value, the second predicted value, and the associated weight value.

[0023] The weighted prediction value of the current block is determined based on the weighted prediction values ​​of all pixel positions in the current block.

[0024] This application provides an encoding terminal device, including: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;

[0025] The processor is used to execute machine-executable instructions to perform the following steps:

[0026] When determining to initiate weighted prediction for the current block, the weight prediction angle and weight configuration parameters of the current block are obtained;

[0027] Configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters;

[0028] For each pixel position of the current block, a surrounding matching position to which the pixel position points is determined from the surrounding positions outside the current block according to the weighted prediction angle; a target weight value of the pixel position is determined according to the reference weight value associated with the surrounding matching position; and an associated weight value of the pixel position is determined according to the target weight value of the pixel position.

[0029] Obtain a motion information candidate list, the motion information candidate list including at least one candidate motion information; based on the motion information candidate list, obtain the first target motion information and the second target motion information of the current block;

[0030] A first predicted value for the pixel position is determined based on the first target motion information of the current block, and a second predicted value for the pixel position is determined based on the second target motion information of the current block; a weighted predicted value for the pixel position is determined based on the first predicted value, the target weight value, the second predicted value, and the associated weight value.

[0031] The weighted prediction value of the current block is determined based on the weighted prediction values ​​of all pixel positions in the current block.

[0032] As can be seen from the above technical solutions, the embodiments of this application propose an effective way to configure weight values, which can configure reasonable target weight values ​​for each pixel position of the current block, thereby improving the accuracy of prediction, improving prediction performance, improving coding performance, making the predicted value of the current block closer to the original pixel, and bringing about an improvement in coding performance. Attached Figure Description

[0033] Figure 1 is a schematic diagram of the video coding framework;

[0034] Figures 2A-2E are schematic diagrams of weighted prediction;

[0035] Figure 3 is a flowchart of an encoding / decoding method according to one embodiment of this application;

[0036] Figures 4A-4D are schematic diagrams of the surrounding locations outside the current block;

[0037] Figure 5 is a flowchart of an encoding / decoding method according to one embodiment of this application;

[0038] Figure 6 is a schematic diagram of the weight prediction angle in one embodiment of this application;

[0039] Figure 7 is a schematic diagram of reference weight values ​​for four weight transformation rates in one embodiment of this application;

[0040] Figures 8A-8C are schematic diagrams of weight prediction angle and angle partitioning in one embodiment of this application;

[0041] Figure 9A is a schematic diagram of the adjacent blocks of the current block in one embodiment of this application;

[0042] Figures 9B-9D are schematic diagrams of the target position of the current block in one embodiment of this application;

[0043] Figure 10A is a schematic diagram of the structure of an encoding / decoding device in one embodiment of this application;

[0044] Figure 10B is a schematic diagram of the structure of an encoding / decoding device in one embodiment of this application;

[0045] Figure 10C is a hardware structure diagram of a decoding end device in one embodiment of this application;

[0046] Figure 10D is a hardware structure diagram of the encoding end device in one embodiment of this application. Detailed Implementation

[0047] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “the,” and “the” used in the embodiments and claims of this application are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to any or all possible combinations including one or more of the associated listed items. It should be understood that although the terms first, second, third, etc., may be used to describe various information in the embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of the embodiments of this application, and similarly, second information may also be referred to as first information, depending on the context. Furthermore, the word “if” as used can be interpreted as “when,” “in response to a determination,” or “when…”.

[0048] This application provides an encoding / decoding method, apparatus, and device, which may involve the following concepts:

[0049] Intra prediction, inter prediction, and IBC (Intra-Block Copy) prediction:

[0050] Intra-frame prediction refers to using coded blocks to make predictions based on the spatial correlation of the video to remove spatial redundancy. Intra-frame prediction specifies a variety of prediction modes, each corresponding to a texture direction (except for DC mode). For example, if the image texture is arranged horizontally, the horizontal prediction mode can better predict image information.

[0051] Inter-frame prediction refers to the prediction of pixels in the current image based on the temporal correlation of the video. Since video sequences contain strong temporal correlations, the prediction of pixels in the current image can effectively remove temporal redundancy in the video.

[0052] Intra-Block Copy (IBC) refers to the ability to reference data within the same frame, where the reference data for the current block comes from the same frame. Intra-Block Copy can also be called intra-block duplication. In this technology, the predicted value of the current block can be obtained using the block vector of the current block. For example, based on the characteristic that a large number of textures recurring within the same frame of screen content exist, using block vectors to obtain the predicted value of the current block can improve the compression efficiency of the screen content sequence.

[0053] Prediction Signal: A prediction signal is a pixel value derived from the encoded / decoded pixels. It is obtained by subtracting the original pixel from the predicted pixel, resulting in a residual. This residual is then used for quantization and coefficient encoding. Inter-frame prediction signals refer to the pixel values ​​derived from the reference frame for the current block. Due to the discrete pixel positions, interpolation is required to obtain the final prediction signal. The closer the prediction signal is to the original pixel, the smaller the residual energy obtained by subtracting the two, resulting in higher encoding and compression performance.

[0054] Motion Vector (MV): In inter-frame prediction, motion vectors can be used to represent the relative displacement between the current block of the current frame and the reference block of the reference frame. Each partitioned block has a corresponding motion vector transmitted to the decoder. If the motion vector of each block is encoded and transmitted independently, especially for a large number of small blocks, it consumes a lot of bits. To reduce the number of bits used to encode motion vectors, the spatial correlation between adjacent blocks can be utilized. The motion vector of the current block can be predicted based on the motion vectors of adjacent encoded blocks, and then the prediction difference can be encoded. This can effectively reduce the number of bits used to represent motion vectors. When encoding the motion vector of the current block, the motion vector of the current block can be predicted first using the motion vectors of adjacent encoded blocks, and then the difference between the predicted value (MVP, Motion Vector Prediction) and the actual estimated value of the motion vector (MVD) can be encoded.

[0055] Motion Information: Since motion vectors represent the positional offset between the current block and a reference block, in order to accurately obtain information about the block being referenced, in addition to motion vectors, the index information of the reference frame image is also needed to indicate which reference frame image the current block uses. In video coding technology, a list of reference frame images is usually established for the current frame, and the reference frame image index information indicates which reference frame image in the list the current block uses.

[0056] Furthermore, many coding techniques support multiple lists of reference frames. Therefore, an index value can be used to indicate which list of reference frames was used; this index value can be called the reference direction. In summary, in video coding techniques, motion vectors, reference frame indices, reference directions, and other motion-related information can be collectively referred to as motion information.

[0057] Rate-Distortion Optimized (RDO) principle: Two main metrics for evaluating coding efficiency are bit rate and PSNR (Peak Signal-to-Noise Ratio). A smaller bitstream results in a higher compression ratio, and a higher PSNR leads to better reconstructed image quality. In mode selection, the decision formula essentially evaluates both factors. For example, the cost of a mode is: J(mode) = D + λ*R, where D represents Distortion, typically measured using the SSE metric (Sum of Mean Squares of Differences between the Reconstructed Image Patch and the Source Image); λ is the Lagrange multiplier; and R is the actual number of bits required to encode the image patch in that mode, including the bits needed for encoding mode information, motion information, residuals, etc. Using the RDO principle to compare and decide on coding modes during mode selection usually ensures optimal coding performance.

[0058] Video coding framework: Referring to Figure 1, the video coding framework can be used to implement the encoding end processing flow of this application embodiment; the schematic diagram of the video decoding framework is similar to that in Figure 1, and will not be repeated here. The video decoding framework can be used to implement the decoding end processing flow of this application embodiment. For example, the video coding framework and video decoding framework may include, but are not limited to, modules such as intra-frame prediction / inter-frame prediction, motion estimation / motion compensation, reference image buffer, intra-loop filtering, reconstruction, transform, quantization, inverse transform, inverse quantization, and entropy encoder. At the encoding end, the encoding end processing flow can be implemented through the cooperation between these modules; at the decoding end, the decoding end processing flow can be implemented through the cooperation between these modules.

[0059] In related technologies, the current block can be rectangular, but the edges of actual objects are often not rectangular. Therefore, for the edge of an object, there are often two different objects (such as a foreground object and a background). When the motion of the two objects is inconsistent, rectangular segmentation cannot effectively separate these two objects. Therefore, the current block can be divided into two non-rectangular sub-blocks, and weighted prediction can be performed on these two non-rectangular sub-blocks. For example, weighted prediction uses multiple predicted values ​​for weighting to obtain the final predicted value. Weighted prediction can include: combined inter / intra prediction (CIIP), inter-frame and inter-frame combined weighted prediction, intra-frame and intra-frame combined weighted prediction, etc. For the weight values ​​of the combined weighted prediction, the same weight value can be configured for different pixel positions in the current block, or different weight values ​​can be configured for different pixel positions in the current block.

[0060] See Figure 2A, which is a schematic diagram of inter-frame and intra-frame joint weighted prediction.

[0061] The CIIP prediction block is obtained by weighting intra-prediction blocks (i.e., intra-prediction values ​​obtained using intra-prediction mode) and inter-prediction blocks (i.e., inter-prediction values ​​obtained using inter-prediction mode). The weight ratio of the intra-prediction value to the inter-prediction value used for each pixel position is 1:1. For example, for each pixel position, the intra-prediction value and the inter-prediction value of that pixel position are weighted to obtain the joint prediction value of that pixel position. Finally, the joint prediction values ​​of each pixel position are combined to form the CIIP prediction block.

[0062] See Figure 2B for a schematic diagram of Triangular Partition Mode (TPM).

[0063] The TPM prediction block is formed by combining inter-frame prediction block 1 (i.e., inter-frame prediction values ​​of pixel positions obtained using inter-frame prediction mode 1) and inter-frame prediction block 2 (i.e., inter-frame prediction values ​​of pixel positions obtained using inter-frame prediction mode 2). The TPM prediction block can be divided into two regions: inter-frame region 1 and inter-frame region 2. The two inter-frame regions of the TPM prediction block can be non-rectangularly distributed, and the angle of the dashed dividing line can be either the main diagonal or the secondary diagonal.

[0064] For each pixel location in inter-frame region 1, the predicted value for that pixel location is primarily determined based on the inter-frame prediction value of inter-frame prediction block 1. For example, when weighting the inter-frame prediction value of inter-frame prediction block 1 for that pixel location with the inter-frame prediction value of inter-frame prediction block 2 for that pixel location, the weight value of the inter-frame prediction value of inter-frame prediction block 1 is larger, and the weight value of the inter-frame prediction value of inter-frame prediction block 2 is smaller (or even 0), thus obtaining the joint predicted value for that pixel location. For each pixel location in inter-frame region 2, the predicted value for that pixel location is primarily determined based on the inter-frame prediction value of inter-frame prediction block 2. For example, when weighting the inter-frame prediction value of inter-frame prediction block 1 for that pixel location with the inter-frame prediction value of inter-frame prediction block 2 for that pixel location, the weight value of the inter-frame prediction value of inter-frame prediction block 2 is larger, and the weight value of the inter-frame prediction value of inter-frame prediction block 1 is smaller (or even 0), thus obtaining the joint predicted value for that pixel location.

[0065] Referring to Figure 2C, this is a schematic diagram of inter-frame and intra-frame joint triangular weighted prediction. By modifying the inter-frame and intra-frame joint weighted prediction, the inter-frame and intra-frame regions of the CIIP prediction block exhibit a triangular weighted prediction weight distribution.

[0066] The CIIP prediction block is composed of an intra-frame prediction block (i.e., the intra-frame predicted value of the pixel position obtained using the intra-frame prediction mode) and an inter-frame prediction block (i.e., the inter-frame predicted value of the pixel position obtained using the inter-frame prediction mode). The CIIP prediction block can be divided into two regions: an intra-frame region and an inter-frame region. The intra-frame and inter-frame regions of the CIIP prediction block can be non-rectangularly distributed. The dashed boundary region can be divided using a hybrid weighting method or directly, and the angle of the dashed boundary can be either the main diagonal or the secondary diagonal. The positions of the intra-frame and inter-frame regions are variable.

[0067] For each pixel location within an intra-frame region, the predicted value for that pixel location is primarily determined based on intra-frame prediction values. For example, when weighting the intra-frame predicted value and the inter-frame predicted value for that pixel location, the intra-frame predicted value has a larger weight, and the inter-frame predicted value has a smaller weight, resulting in a joint predicted value for that pixel location. Similarly, for each pixel location within an inter-frame region, the predicted value is primarily determined based on inter-frame prediction values. For example, when weighting the intra-frame predicted value and the inter-frame predicted value for that pixel location, the inter-frame predicted value has a larger weight, and the intra-frame predicted value has a smaller weight, resulting in a joint predicted value for that pixel location.

[0068] Figure 2D shows a schematic diagram of Geometrical Partitioning for Inter Blocks (GEO). GEO mode is used to divide an inter-frame prediction block into two sub-blocks using a dividing line. Unlike TPM mode, GEO mode can use more partitioning directions. The weighted prediction process of GEO mode is similar to that of TPM mode.

[0069] The GEO prediction block is obtained by combining inter-frame prediction block 1 (i.e., inter-frame prediction values ​​of pixel positions obtained using inter-frame prediction mode 1) and inter-frame prediction block 2 (i.e., inter-frame prediction values ​​of pixel positions obtained using inter-frame prediction mode 2). The GEO prediction block can be divided into two regions: one region can be inter-frame region 1, and the other region can be inter-frame region 2.

[0070] For each pixel location in inter-frame region 1, the predicted value for that pixel location is primarily determined based on the inter-frame prediction value of inter-frame prediction block 1. For example, when weighting the inter-frame prediction value of inter-frame prediction block 1 for that pixel location with the inter-frame prediction value of inter-frame prediction block 2 for that pixel location, the weight value of the inter-frame prediction value of inter-frame prediction block 1 is larger, and the weight value of the inter-frame prediction value of inter-frame prediction block 2 is smaller. Similarly, for each pixel location in inter-frame region 2, the predicted value for that pixel location is primarily determined based on the inter-frame prediction value of inter-frame prediction block 2. For example, when weighting the inter-frame prediction value of inter-frame prediction block 1 for that pixel location with the inter-frame prediction value of inter-frame prediction block 2 for that pixel location, the weight value of the inter-frame prediction value of inter-frame prediction block 2 is larger, and the weight value of the inter-frame prediction value of inter-frame prediction block 1 is smaller.

[0071] For example, the weight values ​​of the GEO prediction block are configured based on the distance of the pixel position from the dividing line. Referring to Figure 2E, pixel positions A, B, and C are located on the lower right side of the dividing line, while pixel positions D, E, and F are located on the upper left side. For pixel positions A, B, and C, the weight values ​​of inter-frame region 2 are ordered as B ≥ A ≥ C, and the weight values ​​of inter-frame region 1 are ordered as C ≥ A ≥ B. For pixel positions D, E, and F, the weight values ​​of inter-frame region 1 are ordered as D ≥ F ≥ E, and the weight values ​​of inter-frame region 2 are ordered as E ≥ F ≥ D. This method requires calculating the distance between the pixel position and the dividing line to determine the weight value of the pixel position.

[0072] To address the aforementioned scenarios and achieve weighted prediction, it is necessary to determine the weight value for each pixel position within the current block and perform weighted prediction based on these weight values. However, current technologies lack an effective method for configuring these weight values, leading to poor prediction results and inefficient encoding performance.

[0073] In response to the above findings, this application proposes a method for deriving weight values. This method can determine the target weight value for each pixel position in the current block based on the reference weight values ​​of the surrounding positions outside the current block. This allows for the configuration of a reasonable target weight value for each pixel position, improving prediction accuracy, prediction performance, and coding performance, and resulting in predicted values ​​that are closer to the original pixels.

[0074] The encoding and decoding methods in the embodiments of this application will be described in detail below with reference to several specific embodiments.

[0075] Example 1: Referring to Figure 3, which is a flowchart of the encoding / decoding method, this method can be applied to either the decoding end (also known as a video decoder) or the encoding end (also known as a video encoder). The method may include:

[0076] Step 301: When determining to initiate weighted prediction for the current block, obtain the weight prediction angle and weight configuration parameters for the current block. These weight configuration parameters include the weight transformation rate and the starting position of the weight transformation. The starting position of the weight transformation can be determined by at least one of the following parameters: the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block.

[0077] For example, when prediction of the current block is required, the decoding or encoding end can first determine whether to initiate weighted prediction for the current block. If weighted prediction is initiated for the current block, the encoding / decoding method of this application embodiment is adopted, that is, step 301 and subsequent steps are executed. If weighted prediction is not initiated for the current block, the implementation method is not limited in this application embodiment.

[0078] For example, when determining to initiate weighted prediction for the current block, the weight prediction angle, weight prediction position, and weight transformation rate of the current block can be obtained. Then, based on at least one of the weight prediction angle, weight prediction position, and size of the current block, the starting position of the weight transformation of the current block can be determined. Thus, the weight prediction angle, weight transformation rate, and starting position of the weight transformation of the current block can be obtained.

[0079] Step 302: Configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters of the current block.

[0080] For example, the number of surrounding locations outside the current block can be determined based on the size of the current block and / or the weight prediction angle of the current block. For instance, the number M of surrounding locations outside the current block can be determined based on the size of the current block and / or the weight prediction angle of the current block, and reference weight values ​​can be configured for the M surrounding locations according to the weight configuration parameters of the current block.

[0081] For example, the reference weight values ​​of the surrounding locations outside the current block can monotonically increase; or, the reference weight values ​​of the surrounding locations outside the current block can monotonically decrease. For instance, the arrangement of the reference weight values ​​of the surrounding locations outside the current block can be 00…0024688…88, or the arrangement of the reference weight values ​​of the surrounding locations outside the current block can be 88…8864200…00.

[0082] For example, the perimeter of the current block can include integer pixel positions, sub-pixel positions, or both integer and sub-pixel positions. The perimeter of the current block can include, but is not limited to: the perimeter of the row above the current block, the perimeter of the column to the left of the current block, the perimeter of the row below the current block, or the perimeter of the column to the right of the current block. Of course, the above are just examples of perimeter positions and are not intended to be limiting.

[0083] In one possible implementation, the reference weight values ​​of the surrounding locations outside the current block include the reference weight value of the target region, the reference weight value of the first neighboring region of the target region, and the reference weight value of the second neighboring region of the target region.

[0084] For example, the reference weight values ​​of the first neighboring regions are all the first reference weight value, and the reference weight values ​​of the second neighboring regions are monotonically increasing. Alternatively, the reference weight values ​​of the first neighboring regions are all the first reference weight value, and the reference weight values ​​of the second neighboring regions are monotonically decreasing. Alternatively, the reference weight values ​​of the first neighboring regions are all the second reference weight value, and the reference weight values ​​of the second neighboring regions are all the third reference weight value, where the second reference weight value is different from the third reference weight value. Alternatively, the reference weight values ​​of the first neighboring regions are monotonically increasing, and the reference weight values ​​of the second neighboring regions are also monotonically increasing. Alternatively, the reference weight values ​​of the first neighboring regions are monotonically decreasing, and the reference weight values ​​of the second neighboring regions are also monotonically decreasing.

[0085] For example, the target region includes one reference weight value or at least two reference weight values; if the target region includes at least two reference weight values, then the at least two reference weight values ​​of the target region are monotonically increasing or monotonically decreasing.

[0086] Step 303: For each pixel position in the current block, determine the surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weight prediction angle of the current block; determine the target weight value of the pixel position according to the reference weight value associated with the surrounding matching position; and determine the associated weight value of the pixel position according to the target weight value of the pixel position.

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

[0088] For each pixel position in the current block, after determining the surrounding matching positions to which the pixel position points, a target weight value for the pixel position is determined based on the reference weight value associated with the surrounding matching positions. For example, the reference weight value associated with the surrounding 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 example, the sum of the target weight value and the associated weight value for each pixel position can both be fixed preset values. Therefore, the associated weight value can be the difference between the preset value and the target weight value. Assuming the preset value is 8, if the target weight value of the pixel position is 0, then the associated weight value of the pixel position is 8; if the target weight value of the pixel position is 1, then the associated weight value of the pixel position is 7, and so on, as long as the sum of the target weight value and the associated weight value is 8.

[0089] Step 304: Obtain a motion information candidate list, which includes at least one candidate motion information; based on the motion information candidate list, obtain the first target motion information and the second target motion information of the current block.

[0090] Step 305: For each pixel position in the current block, determine a first predicted value for the pixel position based on the first target motion information of the current block, and determine a second predicted value for the pixel position based on the second target motion information 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.

[0091] For example, assuming the target weight value is the weight value corresponding to the first target motion information and the associated weight value is the weight value corresponding to the second target motion information, the weighted prediction value for this pixel position can be: (the first predicted value for this pixel position * the target weight value for this pixel position + the second predicted value for this pixel position * the associated weight value for this pixel position) / a fixed preset value. Alternatively, assuming the target weight value is the weight value corresponding to the second target motion information and the associated weight value is the weight value corresponding to the first target motion information, the weighted prediction value for this pixel position can be: (the second predicted value for this pixel position * the target weight value for this pixel position + the first predicted value for this pixel position * the associated weight value for this pixel position) / a fixed preset value.

[0092] Step 306: Determine the weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0093] For example, the weighted predicted values ​​of all pixel positions in the current block are combined to form the weighted predicted value of the current block.

[0094] As can be seen from the above technical solutions, the embodiments of this application propose an effective way to configure weight values, which can configure reasonable target weight values ​​for each pixel position of the current block, thereby improving the accuracy of prediction, improving prediction performance, improving coding performance, making the predicted value of the current block closer to the original pixel, and bringing about an improvement in coding performance.

[0095] Example 2: This application proposes another encoding / decoding method that can be applied to the encoding end. The method includes:

[0096] In step a1, when determining to initiate weighted prediction for the current block, the encoder obtains the weight prediction angle, weight prediction position, and weight transformation rate of the current block. For example, the encoder determines whether to initiate weighted prediction for the current block. If yes, step a1 and subsequent steps are executed; otherwise, the processing method is not limited in this application.

[0097] In one possible implementation, if the current block meets the conditions for initiating weighted prediction, then weighted prediction is initiated for the current block. If the current block does not meet the conditions for initiating weighted prediction, then weighted prediction is not initiated for the current block. For example, it is determined whether the feature information of the current block meets specific conditions. If yes, weighted prediction is initiated for the current block; if no, weighted prediction is not initiated for the current block. Feature information includes, but is not limited to, one or any combination of the following: the frame type of the current frame in which the current block is located, the size information of the current block, and switch control information. Switch control information may include, but is not limited to: sequence-level (SPS, SH) switch control information, or image-level (PPS, PH) switch control information, or slice-level (Slice, Tile, Patch), or maximum coding unit-level (LCU, CTU), or block-level (CU, PU, ​​TU) switch control information.

[0098] For example, if the feature information is the frame type of the current frame containing the current block, and the frame type of the current frame containing the current block meets a specific condition, this may include, but is not limited to: if the frame type of the current frame containing the current block is a B-frame, then the frame type is determined to meet the specific condition. Or, if the frame type of the current frame containing the current block is an I-frame, then the frame type is determined to meet the specific condition.

[0099] For example, if the feature information is the size information of the current block, such as the width and height of the current block, the size information must meet specific conditions, including but not limited to: if the width is greater than or equal to a first value and the height is greater than or equal to a second value, the size information of the current block is determined to meet the specific conditions. Alternatively, if the width is greater than or equal to a third value and the height is greater than or equal to a fourth value, and the width is less than or equal to a fifth value and the height is less than or equal to a sixth value, the size information of the current block is determined to meet the specific conditions. Or, if the product of the width and height is greater than or equal to a seventh value, the size information of the current block is determined to meet the specific conditions. The above values ​​can be configured empirically, such as 8, 16, 32, 64, 128, etc. For example, the first value is 8, the second value is 8, the third value is 8, the fourth value is 8, the fifth value is 64, the sixth value is 64, and the seventh value is 64. In summary, if the width is greater than or equal to 8 and the height is greater than or equal to 8, the size information of the current block is determined to meet the specific conditions. Alternatively, if the width is greater than or equal to 8 and the height is greater than or equal to 8, and the width is less than or equal to 64 and the height is less than or equal to 64, then the current block's size information is determined to meet specific conditions. Alternatively, if the product of the width and height is greater than or equal to 64, then the current block's size information is determined to meet specific conditions.

[0100] For example, if the feature information is the size information of the current block, such as the width and height of the current block, then the size information of the current block must meet specific conditions, which may include, but are not limited to: the width is not less than a and not greater than b, and the height is not less than a and not greater than b. a can be less than or equal to 16, and b can be greater than or equal to 16. For example, a equals 8, b equals 64, or b equals 32.

[0101] For example, if the feature information is switch control information, then the switch control information meets specific conditions, which may include, but are not limited to: if the switch control information allows the current block to enable weighted prediction, then it is determined that the switch control information meets specific conditions.

[0102] For example, if the feature information is the frame type of the current frame containing the current block and the size information of the current block, then if both the frame type and size information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions. Alternatively, if the feature information is the frame type of the current frame containing the current block and switch control information, then if both the frame type and switch control information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions. Alternatively, if the feature information is the size information and switch control information of the current block, then if both the size information and switch control information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions. Alternatively, if the feature information is the frame type of the current frame containing the current block, the size information of the current block, and switch control information, then if both the frame type and size information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions.

[0103] In one possible implementation, when determining to initiate weighted prediction for the current block, the encoder can obtain the weight prediction angle, the weight prediction position, and the weight transformation rate of the current block.

[0104] For example, the weight prediction angle represents the angular direction pointed to by the pixel positions within the current block. Referring to Figure 4A, based on a certain weight prediction angle, the angular direction pointed to by the pixel positions within the current block (such as pixel positions 1, 2, and 3) is shown, and this angular direction points to a certain peripheral position outside the current block. Referring to Figure 4B, based on another weight prediction angle, the angular direction pointed to by the pixel positions within the current block (such as pixel positions 2, 3, and 4) is shown, and this angular direction points to a certain peripheral position outside the current block.

[0105] For example, the weighted prediction position (also known as the distance parameter) is used to configure the reference weight value of the surrounding positions outside the current block. For instance, the range of the surrounding positions outside the current block (i.e., the number of surrounding 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, as shown in Figure 4A or Figure 4B.

[0106] Then, the range of the surrounding positions is divided into N equal parts. The value of N can be configured arbitrarily, such as 4, 6, 8, etc. Taking 8 as an example, the weight prediction position is used to indicate which surrounding position outside the current block is used as the starting position of the weight transformation of the current block. Thus, the reference weight value of the surrounding position outside the current block is configured according to the starting position of the weight transformation.

[0107] Referring to Figure 4C, after dividing all surrounding positions into 8 equal parts, 7 weighted prediction positions are obtained. Based on this, when the weighted prediction position is 0, the surrounding position a0 (i.e., the surrounding position pointed to by the dashed line 0; in actual applications, the dashed line 0 does not exist, it is just an example for ease of understanding; dashed lines 0-6 are used to divide all surrounding positions into 8 equal parts) can be considered the starting position for the weight transformation of the current block's outer surrounding positions. Similarly, when the weighted prediction position is 6, the surrounding position a6 is considered the starting position for the weight transformation of the current block's outer surrounding positions.

[0108] The value of N can be different for different weight prediction angles. For example, for weight prediction angle A, the value of N is 6, which means that the range of the surrounding location determined based on weight prediction angle A is divided into 6 equal parts. For weight prediction angle B, the value of N is 8, which means that the range of the surrounding location determined based on weight prediction angle B is divided into 8 equal parts.

[0109] For different weight prediction angles, the value of N can be the same. When the value of N is the same, the number of weight prediction positions can be different. For example, for weight prediction angle A, the value of N is 8, which means that the range of the surrounding positions determined based on weight prediction angle A will be divided into 8 equal parts. For weight prediction angle B, the value of N is 8, which means that the range of the surrounding positions determined based on weight prediction angle B will be divided into 8 equal parts. However, the weight prediction positions corresponding to weight prediction angle A are selected from a1 to a5, a total of 5 positions, and the weight prediction positions corresponding to weight prediction angle B are selected from a0 to a6, a total of 7 positions.

[0110] The above example uses dividing the surrounding area into N equal parts. In practical applications, uneven division can also be used. For example, the surrounding area can be divided into N parts instead of N equal parts. There are no restrictions on this.

[0111] After dividing all the surrounding positions into 8 equal parts, 7 weight prediction positions can be obtained. In step a1, the encoder can obtain one weight prediction position from the 7 weight prediction positions, or select some weight prediction positions from the 7 weight prediction positions (such as 5 weight prediction positions) and obtain one weight prediction position from the 5 weight prediction positions.

[0112] For example, the weight transformation rate represents the transformation rate of the reference weight values ​​of the surrounding positions outside the current block. It is used to indicate the rate of change of the reference weight values. The weight transformation rate can be any non-zero number, such as -4, -2, -1, 1, 2, 4, 0.5, 0.75, 1.5, etc. When the absolute value of the weight transformation rate is 1, that is, the weight transformation rate is -1 or 1, it indicates that the rate of change of the reference weight value is 1. The reference weight value from 0 to 8 requires passing through the values ​​0, 1, 2, 3, 4, 5, 6, 7, 8, etc., and the reference weight value from 8 to 0 requires passing through the values ​​8, 7, 6, 5, 4, 3, 2, 1, 0, etc. When the absolute value of the weight transformation rate is 2, that is, the weight transformation rate is -2 or 2, it indicates that the rate of change of the reference weight value is 2. The reference weight value from 0 to 8 requires passing through the values ​​0, 2, 4, 6, 8, etc., and the reference weight value from 8 to 0 requires passing through the values ​​8, 6, 4, 2, 0, etc. When the absolute value of the weight transformation rate is 4 (i.e., the weight transformation rate is -4 or 4), it indicates that the reference weight value changes at a rate of 4. For example, the reference weight value from 0 to 8 requires passing through the values ​​0, 4, 8, and so on. Similarly, the reference weight value from 8 to 0 requires passing through the values ​​8, 4, 0, and so on. When the absolute value of the weight transformation rate is 0.5 (i.e., the weight transformation rate is -0.5 or 0.5), it indicates that the reference weight value changes at a rate of 0.5. For example, the reference weight value from 0 to 8 requires passing through the values ​​0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, and so on. Similarly, the reference weight value from 8 to 0 requires passing through the values ​​8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, and so on. Of course, the above examples are for values ​​from 0 to 8; 0 and 8 can be replaced with any numbers.

[0113] Step a2: The encoding end configures reference weight values ​​for the surrounding positions outside the current block based on the weight transformation rate and the starting position of the weight transformation (the weight transformation rate and the starting position of the weight transformation can be called weight configuration parameters).

[0114] For example, the starting position of the weight transformation can be determined by at least one of the following parameters: the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block. Therefore, the starting position of the weight transformation of the current block can be determined based on at least one of the weight prediction angle, the weight prediction position, and the size of the current block. Then, reference weight values ​​are configured for the surrounding positions outside the current block according to the weight transformation rate and the starting position of the weight transformation.

[0115] Step a3: For each pixel position in the current block, the encoder determines the surrounding matching position pointed to by that pixel position from the surrounding positions outside the current block based on the weighted prediction angle of the current block. For ease of distinction, in this embodiment, the surrounding position outside the current block pointed to by that pixel position can be referred to as the surrounding matching position of that pixel position.

[0116] For example, since the weight prediction angle represents the angular direction pointed to by the pixel position inside the current block, for each pixel position in the current block, the angular direction pointed to by the pixel position is determined based on the weight prediction angle, and then the surrounding matching position pointed to by the pixel position is determined from the surrounding positions outside the current block according to the angular direction.

[0117] The surrounding positions of the current block can include: the positions of the top row above the current block, such as the position of the n1th row above the current block, where n1 can be 1, 2, 3, etc., without restriction; or the positions of the left column above the current block, such as the position of the n2th column to the left of the current block, where n2 can be 1, 2, 3, etc., without restriction; or the positions of the bottom row below the current block, such as the position of the n3th row below the current block, where n3 can be 1, 2, 3, etc., without restriction; or the positions of the right column above the current block, such as the position of the n4th column to the right of the current block, where n4 can be 1, 2, 3, etc., without restriction.

[0118] Of course, the above are just a few examples of surrounding positions and are not intended to limit the scope. In practical applications, in addition to using the external surrounding positions of the current block, the internal positions of the current block can also be used. That is, the internal positions of the current block can be used to replace the external surrounding positions of the current block. For example, the internal position located in the n5th row of the current block, where n5 can be 1, 2, 3, etc., or the internal position located in the n6th column of the current block, where n6 can be 1, 2, 3, etc. Of course, the length of the internal position (i.e., the row within the current block that is located at that internal position) can exceed the scope of the current block. For example, the position in the n7th row can exceed the scope of the current block, that is, it can extend to both sides.

[0119] Of course, you can also use both the internal position of the current block and the external perimeter position of the current block at the same time.

[0120] For cases where the internal position of the current block is used, or where both the internal position and the external position of the current block are used, the current block can be divided into two smaller blocks, one above the other, based on the row where the internal position is located, or into two smaller blocks, one to the left and one to the right, based on the column where the internal position is located. In this case, the two smaller blocks have the same weighted prediction angle and the same reference weight configuration.

[0121] For example, the outer perimeter of the current block can be located between pixel positions, i.e., sub-pixel positions. In this case, the outer perimeter of the current block cannot be simply described as row x, but rather as a sub-pixel position row between row x and row y.

[0122] For ease of description, in the following embodiments, we will take the perimeter of the first row on the top side of the current block, or the perimeter of the first column on the left side of the current block, as an example. The implementation method is similar for other perimeter positions.

[0123] For example, regarding the range of the surrounding positions outside the current block, a certain range can be pre-specified as the range of the surrounding positions outside the current block; or, the range of the surrounding positions outside the current block can be determined according to the weighted prediction angle. For example, the surrounding positions pointed to by each pixel position inside the current block can be determined according to the weighted prediction angle, and the boundary of the surrounding positions pointed to by all pixel positions can be the range of the surrounding positions outside the current block, without any restriction on the range of these surrounding positions.

[0124] The current block's outer perimeter position can include integer pixel positions; or, the current block's outer perimeter position can include non-integer pixel positions, which can be sub-pixel positions, such as 1 / 2 sub-pixel positions, 1 / 4 sub-pixel positions, 3 / 4 sub-pixel positions, etc., without restriction; or, the current block's outer perimeter position can include both integer pixel positions and sub-pixel positions.

[0125] For example, the two peripheral positions outside the current block can correspond to an integer pixel position; or, the four peripheral positions outside the current block can correspond to an integer pixel position; or, one peripheral position outside the current block can correspond to an integer pixel position; or, one peripheral position outside the current block can correspond to two integer pixel positions. Of course, the above are just a few examples and are not restrictive; the relationship between peripheral positions and integer pixel positions can be configured arbitrarily.

[0126] Referring to Figures 4A and 4B, one peripheral position corresponds to one integer pixel position. Referring to Figure 4D, two peripheral positions correspond to one integer pixel position. Other cases will not be described in this embodiment.

[0127] Step a4: The encoding end determines the target weight value of the pixel position based on the reference weight values ​​associated with the surrounding matching positions.

[0128] For each pixel position in the current block, after determining the surrounding matching position to which the pixel position points, the encoder determines the reference weight value associated with the surrounding matching position, and determines the target weight value of the pixel position based on the reference weight value associated with the surrounding matching position. For example, the reference weight value associated with the surrounding matching position is determined as the target weight value of the pixel position.

[0129] In one possible implementation, the encoder determines the target weight value of the pixel position based on the reference weight value associated with the surrounding matching positions. This may include: Case 1: If the surrounding matching position is an integer pixel position and the integer pixel position has been configured with a reference weight value, then the target weight value of the pixel position is determined based on the reference weight value of the integer pixel position.

[0130] Scenario 2: If the surrounding matching position is an integer pixel position and no reference weight value is configured for that integer pixel position, the target weight value of that pixel position can be determined based on the reference weight values ​​of its neighboring positions. For example, the target weight value of the pixel position can 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 by interpolating the reference weight values ​​of the neighboring positions. There are no restrictions on which method is used.

[0131] Scenario 3: If the surrounding matching position is a sub-pixel position and a reference weight value has been configured for the sub-pixel position, the target weight value of the pixel position can be determined based on the reference weight value of the sub-pixel position.

[0132] Scenario 4: If the surrounding matching position is a sub-pixel position and no reference weight value is configured for that sub-pixel position, the target weight value of the pixel position can be determined based on the reference weight values ​​of its neighboring positions. For example, the target weight value of the pixel position can be obtained by rounding up the reference weight values ​​of the neighboring positions; or, the target weight value of the pixel position can be obtained by rounding down the reference weight values ​​of the neighboring positions; or, the target weight value of the pixel position can be determined by interpolation based on the reference weight values ​​of the neighboring positions of the sub-pixel position. There are no restrictions on this approach.

[0133] Scenario 5: Determine the target weight value of the pixel location based on multiple reference weight values ​​associated with the surrounding matching locations. For example, if the surrounding matching location is an integer pixel location or a sub-pixel location, obtain the reference weight values ​​of multiple adjacent locations of the surrounding matching location. If the surrounding matching location has a configured reference weight value, perform a weighted calculation based on the reference weight value of the surrounding matching location and the reference weight values ​​of multiple adjacent locations to obtain the target weight value of the pixel location; if the surrounding matching location has no configured reference weight value, perform a weighted calculation based on the reference weight values ​​of multiple adjacent locations to obtain the target weight value of the pixel location.

[0134] Step a5: The encoding end determines the associated weight value of the pixel position based on the target weight value of the pixel position.

[0135] For example, for each pixel location, the sum of the target weight value and the associated weight value of that pixel location can be a fixed preset value; that is, the associated weight value can be the difference between the preset value and the target weight value. Based on this, assuming the preset value is 8 and the target weight value of that pixel location is 2, then the associated weight value of that pixel location is 6.

[0136] Step a6: The encoding end obtains a motion information candidate list, which includes at least one candidate motion information; based on the motion information candidate list, it obtains the first target motion information and the second target motion information of the current block.

[0137] Step a7: For each pixel position in the current block, the encoder determines a first predicted value for the pixel position based on the first target motion information of the current block, and determines a second predicted value for the pixel position based on the second target motion information of the current block.

[0138] Step a8: The encoder determines the weighted prediction value of the pixel position based on the first predicted value of the pixel position, the target weight value of the pixel position, the second predicted value of the pixel position, and the associated weight value of the pixel position.

[0139] For example, the weighted predicted value for a pixel location can be: (first predicted value for the pixel location * target weight value for the pixel location + second predicted value for the pixel location * associated weight value for the pixel location) / fixed preset value.

[0140] Step a9: The encoder determines the weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0141] Example 3: This application proposes another encoding / decoding method that can be applied to the decoding end. The method includes:

[0142] In step b1, when it is determined that weighted prediction should be initiated for the current block, the decoder obtains the weight prediction angle, the weight prediction position, and the weight transformation rate of the current block. For example, the decoder determines whether to initiate weighted prediction for the current block. If yes, step b1 and subsequent steps are executed; otherwise, the processing method is not limited in this application.

[0143] In one possible implementation, the encoder determines whether the feature information of the current block meets a specific condition. If so, it determines to initiate weighted prediction for the current block. The decoder also determines whether the feature information of the current block meets the specific condition. If so, it determines to initiate weighted prediction for the current block; otherwise, it determines not to initiate weighted prediction for the current block. How the decoder determines whether to initiate weighted prediction for the current block based on the feature information is similar to the method used by the encoder, and will not be repeated here.

[0144] In another possible implementation, the encoder determines whether the current block supports weighted prediction based on its feature information. If the current block supports weighted prediction, other strategies can be used to determine whether to initiate weighted prediction, such as using the rate-distortion principle. After determining whether to initiate weighted prediction, the encoder can include a syntax indicating whether to initiate weighted prediction when sending the encoded bitstream of the current block. The decoder determines whether the current block supports weighted prediction based on its feature information, in a similar manner to the encoder, and will not be described further here. If the current block supports weighted prediction, the decoder can also parse the syntax for initiating weighted prediction from the encoded bitstream and determine whether to initiate weighted prediction based on this syntax.

[0145] For example, when determining to start weighted prediction for the current block, the decoder can also obtain the weight prediction angle, the weight prediction position, and the weight transformation rate of the current block. For related explanations of the weight prediction angle, the weight prediction position, and the weight transformation rate, please refer to step a1, which will not be repeated here.

[0146] Step b2: The decoding end configures reference weight values ​​for the surrounding positions outside the current block based on the weight transformation rate and the starting position of the weight transformation of the current block (the weight transformation rate and the starting position of the weight transformation can be called weight configuration parameters).

[0147] For example, the decoder can determine the starting position of the weight transformation of the current block based on at least one of the weight prediction angle, the weight prediction position, and the size of the current block. Then, the decoder configures reference weight values ​​for the surrounding positions outside the current block according to the weight transformation rate and the starting position of the weight transformation.

[0148] Step b3: For each pixel position in the current block, the decoder determines the surrounding matching position that the pixel position points to from the surrounding positions outside the current block based on the weight prediction angle of the current block.

[0149] Step b4: The decoding end determines the target weight value of the pixel position based on the reference weight value associated with the surrounding matching position.

[0150] Step b5: The decoding end determines the associated weight value of the pixel position based on the target weight value of the pixel position.

[0151] Step b6: The decoding end obtains a motion information candidate list, which includes at least one candidate motion information; based on the motion information candidate list, it obtains the first target motion information and the second target motion information of the current block.

[0152] Step b7: For each pixel position in the current block, the decoder determines the first predicted value of the pixel position based on the first target motion information of the current block, and determines the second predicted value of the pixel position based on the second target motion information of the current block.

[0153] Step b8: The decoding end determines the weighted prediction value of the pixel position based on the first predicted value of the pixel position, the target weight value of the pixel position, the second predicted value of the pixel position, and the associated weight value of the pixel position.

[0154] Step b9: The decoding end determines the weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0155] For example, the implementation process of steps b2-b8 can be found in steps a2-a8. The difference is that steps b2-b8 are the processing flow of the decoding end, not the processing flow of the encoding end, and will not be described again here.

[0156] Example 4: Referring to Figure 5, which is a flowchart of the encoding / decoding method, this method can be applied to the decoding end (also known as a video decoder) or the encoding end (also known as a video encoder). The method may include:

[0157] Step 501: When determining to initiate weighted prediction for the current block, obtain the weight prediction angle and weight configuration parameters for the current block. These weight configuration parameters include the weight transformation rate and the starting position of the weight transformation. The starting position of the weight transformation can be determined by at least one of the following parameters: the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block.

[0158] Step 502: Configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters of the current block.

[0159] Step 503: For each pixel position in the current block, determine the surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weight prediction angle of the current block; determine the target weight value of the pixel position according to the reference weight value associated with the surrounding matching position; and determine the associated weight value of the pixel position according to the target weight value of the pixel position.

[0160] For example, steps 501-503 can be referred to steps 301-303, and will not be repeated here.

[0161] Step 504: Obtain reference frame information and obtain a motion vector candidate list corresponding to the reference frame information. The motion vector candidate list includes at least one candidate motion vector. The reference frame information includes first reference frame information and second reference frame information. Based on the motion vector candidate list, obtain the first target motion vector and the second target motion vector of the current block.

[0162] Step 505: For each pixel position in the current block, determine a first predicted value for the pixel position based on the first target motion information of the current block, and determine a second predicted value for the pixel position based on the second target motion information 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.

[0163] In one possible implementation, the first target motion information of the current block may include the first target motion vector of the current block and the first reference frame information corresponding to the first target motion vector, and the second target motion information of the current block may include the second target motion vector of the current block and the second reference frame information corresponding to the second target motion vector.

[0164] For example, the first reference frame information and the second reference frame information can be the same, or they can be different. If the first reference frame information and the second reference frame information are the same, then the reference frame pointed to by the first target motion vector and the reference frame pointed to by the second target motion vector are the same frame. If the first reference frame information and the second reference frame information are different, then the reference frame pointed to by the first target motion vector and the reference frame pointed to by the second target motion vector are different frames.

[0165] Step 506: Determine the weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions in the current block.

[0166] For example, when the encoding and decoding method is applied to the encoding end, the detailed process of steps 501-506 can also be implemented through embodiment 2. The difference is that in step a6, the encoding end obtains a motion vector candidate list, and obtains the first target motion vector and the second target motion vector of the current block based on the motion vector candidate list. The first target motion information is obtained based on the first target motion vector and the first reference frame information corresponding to the first target motion vector, and the second target motion information is obtained based on the second target motion vector and the second reference frame information corresponding to the second target motion vector. This will not be elaborated further here.

[0167] For example, when the encoding and decoding method is applied to the decoding end, the detailed process of steps 501-506 can also be implemented through embodiment 3. The difference is that in step b6, the decoding end obtains a motion vector candidate list, and obtains the first target motion vector and the second target motion vector of the current block based on the motion vector candidate list. The first target motion information is obtained based on the first target motion vector and the first reference frame information corresponding to the first target motion vector, and the second target motion information is obtained based on the second target motion vector and the second reference frame information corresponding to the second target motion vector. This will not be elaborated further here.

[0168] As can be seen from the above technical solutions, the embodiments of this application propose an effective way to configure weight values, which can configure reasonable target weight values ​​for each pixel position of the current block, thereby improving the accuracy of prediction, improving prediction performance, improving coding performance, making the predicted value of the current block closer to the original pixel, and bringing about an improvement in coding performance.

[0169] Example 5: In Examples 1-4, weighted processing is required based on the predicted angle. This weighted processing method can be referred to as the Angular Weighted Prediction (AWP) mode. That is, when the current block supports the AWP mode, Examples 1-4 are used to predict the current block to obtain the predicted value of the current block.

[0170] Examples 1-4 involve weight prediction angles, which can be any angle, such as any angle within 180 degrees or any angle within 360 degrees. There are no restrictions on this weight prediction angle, such as 10 degrees, 20 degrees, 30 degrees, etc.

[0171] In one possible implementation, the weight prediction angle can be a horizontal angle; or, the weight prediction angle can be a vertical angle; or, the absolute value of the slope of the weight prediction angle (the absolute value of the slope of the weight prediction angle is also the tan value of the weight prediction angle) can be a power of 2, where n is an integer, such as a positive integer, 0, a negative integer, etc.

[0172] For example, the absolute value of the slope of the weight prediction angle can be 1 (i.e., 2 to the power of 0), or 2 (i.e., 2 to the power of 1), or 1 / 2 (i.e., 2 to the power of -1), or 4 (i.e., 2 to the power of 2), or 1 / 4 (i.e., 2 to the power of -2), or 8 (i.e., 2 to the power of 3), or 1 / 8 (i.e., 2 to the power of -3), etc. For example, Figure 6 shows eight weight prediction angles, where the absolute value of the slope of these weight prediction angles is a power of 2.

[0173] In this embodiment of the application, the weight prediction angle can be shifted. For an example of shifting the weight prediction angle, please refer to the following embodiments. Therefore, when the absolute value of the slope of the weight prediction angle is a power of 2, the division operation can be avoided when shifting the weight prediction angle, thus making the shifting operation convenient.

[0174] For example, different block sizes (i.e., the size of the current block) can support the same or different numbers of weight prediction angles. For instance, block size A supports 8 weight prediction angles, while block sizes B and C support 6 weight prediction angles, and so on.

[0175] Example 6: In Examples 1-4 above, the encoder / decoder needs to configure reference weight values ​​for the surrounding 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 implementation, the following method can be used: For each surrounding position outside the current block, configure the reference weight value of the surrounding position based on the coordinate value of the surrounding position, the coordinate value of the starting position of the weight transformation, and the weight transformation rate.

[0176] For example, for each surrounding position outside the current block, if the surrounding position is in the row above or below the current block, then the coordinate value of the surrounding position can be the x-coordinate value, and the coordinate value of the starting position of the weight transformation can also be the x-coordinate value. Alternatively, if the surrounding position is in the column to the left or right of the current block, then the coordinate value of the surrounding position can be the y-coordinate value, and the coordinate value of the starting position of the weight transformation can also be the y-coordinate value.

[0177] For example, the top-left pixel position of the current block (such as the first pixel position in the top-left corner) can be used as the origin of the coordinate system. The coordinate values ​​of the surrounding positions of the current block (such as x-coordinates or y-coordinates) and the coordinate values ​​of the starting position of the weight transformation (such as x-coordinates or y-coordinates) are all relative to this origin. Of course, other pixel positions of the current block can also be used as the origin, and the implementation is similar to that of using the top-left pixel position as the origin.

[0178] In one possible implementation, the difference between the coordinates of the surrounding location and the coordinates of the starting position of the weight transformation is first determined, and then the product of this difference and the weight transformation rate of the current block is determined. If the product is less than a first value (i.e., the minimum reference weight value, such as 0), the reference weight associated with the surrounding location is determined to be the first value; if the product is greater than a second value (i.e., the maximum reference weight value, such as 8), the reference weight associated with the surrounding location is determined to be the second value; if the product is not less than the first value and not greater than the second value, the reference weight associated with the surrounding location is determined to be the product. In another possible implementation, the reference weight associated with the surrounding location can also be directly determined based on the relationship between the coordinates of the surrounding location and the coordinates of the starting position of the weight transformation. For example, if the coordinates of the surrounding location are less than the coordinates of the starting position of the weight transformation, the reference weight associated with the surrounding location is determined to be the first value; if the coordinates of the surrounding location are not less than the coordinates of the starting position of the weight transformation, the reference weight associated with the surrounding location is determined to be the second value. For example, if the coordinates of the surrounding location are less than the coordinates of the starting location of the weight transformation, the reference weight value associated with the surrounding location is determined to be the second value; if the coordinates of the surrounding location are not less than the coordinates of the starting location of the weight transformation, the reference weight value associated with the surrounding location is determined to be the first value.

[0179] For example, both the first and second values ​​can be configured based on experience, and the first value is less than the second value. There are no restrictions on either the first or second value. For instance, the first value is the minimum value of a pre-agreed reference weight, such as 0, and the second value is the maximum value of a pre-agreed reference weight, such as 8. Of course, 0 and 8 are just examples.

[0180] For example, referring to Figure 4C, after dividing all the surrounding positions into 8 equal parts, 7 weight prediction positions can be obtained. When the weight prediction position is 0, it represents the surrounding position a0, and the coordinates of the starting position of the weight transformation are the coordinates of the surrounding position a0. When the weight prediction position is 1, it represents the surrounding position a1, and the coordinates of the starting position of the weight transformation are the coordinates of the surrounding position a1, and so on. The method for determining the coordinates of the starting position of the weight transformation will not be elaborated here.

[0181] Example 7: In Examples 1-4, the encoder / decoder needs to configure reference weight values ​​for the surrounding positions outside the current block based on the weight transformation rate and the starting position of the weight transformation of the current block. In one possible implementation, this can be done as follows: obtain the weight prediction angle, weight transformation rate, and weight prediction position of the current block; determine the starting position of the weight transformation of the current block based on the weight prediction position; determine weight configuration parameters based on the starting position and the weight transformation rate, i.e., the weight configuration parameters include the starting position and the weight transformation rate. Then, determine the reference weight values ​​for the surrounding positions outside the current block based on the weight configuration parameters.

[0182] The following steps illustrate the process of configuring reference weight values ​​for the surrounding locations outside the current block.

[0183] Step c1: Obtain a valid number of reference weight values.

[0184] For example, the number of surrounding locations outside the current block is the valid number. In step c1, it is necessary to obtain the valid number of reference weight values. This valid number can be determined based on the size of the current block and / or the weight prediction angle of the current block. For example, the valid number can be determined as follows: ValidLength=(N+(M>>X))<<1, where N and M are the height and width of the current block, respectively, and X is the log2 logarithm of the absolute value of the slope of the weight prediction angle of the current block, such as 0 or 1.

[0185] In one possible implementation, the reference weight values ​​can be monotonically increasing or monotonically decreasing for a valid number of reference weight values. Alternatively, for a valid number of reference weight values, multiple first values ​​can be included first, followed by multiple second values, or multiple second values ​​can be included first. Several specific cases will be used to illustrate this below.

[0186] Scenario 1: For a valid number of reference weight values, the order can be monotonically increasing or monotonically decreasing. For example, a valid number of reference weight values ​​could be [88...88765432100...00], which is monotonically decreasing. Another example is [00...00123456788...88], which is monotonically increasing. Of course, these are just examples and are not considered limitations.

[0187] For example, the reference weight value can be configured according to the weight configuration parameters, which may include the weight transformation rate and the starting position of the weight transformation. The method for obtaining the weight transformation rate can be found in the following embodiments. The starting position of the weight transformation can be a value configured based on experience, or it can be determined by the weight prediction position, or it can be determined by the weight prediction angle and the weight prediction position. There are no restrictions on this.

[0188] For a valid number of reference weight values, the order from first to last can be monotonically increasing or monotonically decreasing. For example, if the maximum value of the reference weight value is M1 and the minimum value is M2, for a valid number of reference weight values, the order can be monotonically decreasing from the maximum value M1 to the minimum value M2; or monotonically increasing from the minimum value M2 to the maximum value M1. Assuming M1 is 8 and M2 is 0, the multiple reference weight values ​​can either monotonically decrease from 8 to 0, or monotonically increase from 0 to 8.

[0189] For example, the weight transformation rate and the starting position of the weight transformation can be obtained first. Then, multiple reference weight values ​​can be determined based on the weight transformation rate and the starting position of the weight transformation. For example, the reference weight values ​​can be determined as follows: y = Clip3(minimum, maximum, a*(xs)), where x represents the index of the surrounding position, that is, the value of x is 1 to a valid number of values. For example, if x is 1, it represents the first surrounding position, and y represents the reference weight value of the first surrounding position; if x is 2, it represents the second surrounding position, and y represents the reference weight value of the second surrounding position. a represents the weight transformation rate, and s represents the starting position of the weight transformation.

[0190] Clip3 is used to limit the reference weight value to between the minimum and maximum values. Both the minimum and maximum values ​​can be configured based on experience. For ease of description, we will use a minimum value of 0 and a maximum value of 8 as an example in the following process.

[0191] 'a' represents the weight transformation rate, which can be a non-zero integer, such as -4, -2, -1, 1, 2, 4, etc. There are no restrictions on the value of 'a'. If the absolute value of 'a' is 1, then the reference weight value from 0 to 8 needs to go through the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, or the reference weight value from 8 to 0 needs to go through the sequence 8, 7, 6, 5, 4, 3, 2, 1, 0.

[0192] 's' represents the starting position of the weight transformation. 's' can be determined by the weight prediction position, for example, 's = f(weight prediction position),' meaning 's' is a function related to the weight prediction position. For instance, after determining the range of the surrounding positions outside the current block, the effective number of surrounding positions can be determined, and all surrounding positions can be divided into N equal parts. The value of N can be arbitrarily configured, such as 4, 6, 8, etc. The weight prediction position indicates which surrounding position outside the current block is used as the target surrounding area of ​​the current block, and the surrounding position corresponding to this weight prediction position is the starting position of the weight transformation. Alternatively, 's' can be determined by the weight prediction angle and the weight prediction position, for example, 's = f(weight prediction angle, weight prediction position), meaning 's' is a function related to the weight prediction angle and the weight prediction position. For instance, the range of the surrounding positions outside the current block can be determined based on the weight prediction angle. After determining the range of the surrounding positions outside the current block, the effective number of surrounding positions can be determined, and all surrounding positions can be divided into N equal parts. The weight prediction position indicates which surrounding position outside the current block is used as the target surrounding area of ​​the current block, and the surrounding position corresponding to this weight prediction position is the starting position of the weight transformation.

[0193] In summary, in y = Clip3(minimum, maximum, a*(xs)), both the weight transformation rate *a* and the starting position *s* of the weight transformation are known values. For each surrounding position outside the current block, the reference weight value for that position can be determined using this functional relationship. For example, assuming the weight transformation rate *a* is 2 and the starting position *s* of the weight transformation is 2, then the functional relationship can be y = 2*(x-2), and for each surrounding position *x* outside the current block, the reference weight value *y* can be obtained.

[0194] In summary, a valid number of reference weight values ​​for the current block can be obtained, and these reference weight values ​​either increase or decrease monotonically. In one possible implementation, the reference weight values ​​of the surrounding locations outside the current block include the reference weight value of the target region, the reference weight value of the first neighboring region of the target region, and the reference weight value of the second neighboring region of the target region.

[0195] For example, the target region includes one reference weight value or at least two reference weight values. For instance, a reference weight value is determined based on the starting position of the weight transformation, and this reference weight value is used as the reference weight value for the target region. Or, for another example, at least two reference weight values ​​are determined based on the starting position of the weight transformation, and these at least two reference weight values ​​are used as the reference weight values ​​for the target region.

[0196] If the target region includes at least two reference weight values, then the at least two reference weight values ​​of the target region are either monotonically increasing or monotonically decreasing. Monotonically increasing can be strictly monotonically increasing (i.e., the at least two reference weight values ​​of the target region are strictly monotonically increasing); monotonically decreasing can be strictly monotonically decreasing (i.e., the at least two reference weight values ​​of the target region are strictly monotonically decreasing). For example, the reference weight values ​​of the target region are monotonically increasing from 1 to 7, or the reference weight values ​​of the target region are monotonically decreasing from 7 to 1.

[0197] For example, the reference weight values ​​of the first neighboring regions can all be the first reference weight value, and the reference weight values ​​of the second neighboring regions can monotonically increase. For instance, the reference weight values ​​of the first neighboring regions can all be 0, the target region includes a reference weight value of 1, and the reference weight values ​​of the second neighboring regions monotonically increase from 2 to 8.

[0198] Alternatively, the reference weight values ​​for the first neighboring regions can all be the first reference weight value, and the reference weight values ​​for the second neighboring regions can monotonically decrease. For example, the reference weight values ​​for the first neighboring regions can all be 8, the target region includes a reference weight value of 7, and the reference weight values ​​for the second neighboring regions monotonically decrease from 6 to 0.

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

[0200] Alternatively, the reference weight value of the first neighboring region may monotonically increase or decrease, and the reference weight value of the second neighboring region may also monotonically increase or decrease; for example, if the reference weight value of the first neighboring region monotonically increases, the reference weight value of the second neighboring region may also monotonically increase; or, for another example, if the reference weight value of the first neighboring region monotonically decreases, the reference weight value of the second neighboring region may also monotonically decrease. For instance, if the reference weight value of the first neighboring region monotonically increases from 0 to 3, the target region includes a reference weight value of 4, and the reference weight value of the second neighboring region monotonically increases from 5 to 8.

[0201] Scenario 2: For a valid number of reference weight values, multiple first values ​​can be included first, followed by multiple second values, or vice versa. For example, the valid number of reference weight values ​​can be [88...8800...00] or [00...0088...88]. For instance, multiple reference weight values ​​can be determined based on the starting position of the weight transformation. For example, if the starting position of the weight transformation represents the s-th reference weight value, then all reference weight values ​​before (excluding) the s-th reference weight value are first values ​​(e.g., 8), and all reference weight values ​​after (including) the s-th reference weight value are second values ​​(e.g., 0). Alternatively, all reference weight values ​​before the s-th reference weight value are second values, and all reference weight values ​​after the s-th reference weight value are first values.

[0202] Step c2: Configure the reference weight values ​​of the surrounding positions outside the current block according to the effective number of reference weight values.

[0203] For example, the number of surrounding locations outside the current block is a valid number, and the number of reference weight values ​​is a valid number. Therefore, the valid number of reference weight values ​​can be configured as the reference weight values ​​of the surrounding locations outside the current block.

[0204] For example, the first reference weight value can be configured as the reference weight value of the first surrounding position outside the current block, the second reference weight value can be configured as the reference weight value of the second surrounding position outside the current block, and so on.

[0205] In summary, since reference weight values ​​have been configured for the surrounding positions outside the current block, meaning each surrounding position has a reference weight value, after determining the surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block, the reference weight value associated with that surrounding matching position can be determined, which is the target weight value of that pixel position.

[0206] The implementation of the above process is explained below with reference to several specific application scenarios. For example, in the following application scenarios, assume the current block size is M*N, where M is the width of the current block and N is the height of the current block. X is the logarithmic value of the tan of the weight prediction angle, such as 0 or 1. Y is the index of the weight prediction position, and a, b, c, and d are preset constant values. ValidLength represents the number of valid values, FirstPos represents the starting position of the weight transformation, ReferenceWeights[i] represents the reference weight value of the i-th surrounding position, Clip3 is used to limit the reference weight value to be between the minimum value of 0 and the 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 transformation rate.

[0207] Application Scenario 1: Determine the effective weight (also known as the reference weight effective length, or ValidLength) based on the current block's size and weight prediction angle, and obtain the starting position of the weight transformation (i.e., FirstPos). For example, ValidLength can be determined by the following formula: ValidLength=(N+(M>>X))<<1; FirstPos can be determined by the following formula: FirstPos=(ValidLength>>1)-a+Y*((ValidLength-1)>>3). Based on this, the reference weight value of each surrounding position of the current block can be derived by the following formula: ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The value of i can be 0~ValidLength-1; or 1~ValidLength. After obtaining the reference weight values ​​ReferenceWeights[i] of the surrounding positions of the current block, the target weight value of the pixel position (x, y) of the current block is derived by the following formula: SampleWeight[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>X)], where << indicates left shift and >> indicates right shift.

[0208] Application Scenario 2: ValidLength can be determined using the following formula: ValidLength=(N+(M>>X))<<1; FirstPos can be determined using the following formula: FirstPos=(ValidLength>>1)-b+Y*((ValidLength-1)>>3)–((M<<1)>>X). Based on this, the reference weight value of each surrounding position of the current block can be derived using the following formula: ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weight value of each pixel position (x, y) of the current block can be derived using the following formula: SampleWeight[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>X)].

[0209] Application Scenario 3: ValidLength can be determined using the following formula: ValidLength=(M+(N>>X))<<1; FirstPos can be determined using the following formula: FirstPos=(ValidLength>>1)-c+Y*((ValidLength-1)>>3)–((N<<1)>>X). Based on this, the reference weight value of each surrounding position of the current block can be derived using the following formula: ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weight value of each pixel position (x, y) of the current block can be derived using the following formula: SampleWeight[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>X)].

[0210] Application Scenario 4: ValidLength can be determined using the following formula: ValidLength=(M+(N>>X))<<1; FirstPos can be determined using the following formula: FirstPos=(ValidLength>>1)-d+Y*((ValidLength-1)>>3); Based on this, the reference weight value of each surrounding position of the current block can be derived using the following formula: ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weight value of each pixel position (x, y) of the current block can be derived using the following formula: SampleWeight[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>X)].

[0211] Application Scenario 5: As shown in Figure 7, a schematic diagram of the reference weight values ​​for four weight transformation rates is presented.

[0212] When the absolute value of the weight transformation rate is 1, i.e., the weight transformation rate is 1 or -1, the reference weight value of each surrounding position of the current block can be derived by the following formula: ReferenceWeights[i] = Clip3(0,8, 1*(i-FirstPos)), which is equivalent to ReferenceWeight[i] = Clip3(0,8,i–FirstPos). In this case, referring to the first case shown in Figure 7, FirstPos can be 4, that is, the reference weight value of the 1st to 4th surrounding positions is 0, the reference weight value of the 5th surrounding position is 1, the reference weight value of the 6th surrounding position is 2, and so on.

[0213] When the absolute value of the weight transformation rate is 2, i.e., the weight transformation rate is 2 or -2, the reference weight value of each surrounding position of the current block is derived by the following formula: ReferenceWeights[i] = Clip3(0,8,2*(i-FirstPos)), which is equivalent to ReferenceWeight[i] = Clip3(0,8,(i–FirstPos)<<1). In this case, referring to the second case shown in Figure 7, FirstPos can be 6, that is, the reference weight value of the 1st to 6th surrounding positions is 0, the reference weight value of the 7th surrounding position is 2, the reference weight value of the 8th surrounding position is 4, and so on.

[0214] When the absolute value of the weight transformation rate is 4, i.e., the weight transformation rate is 4 or -4, the reference weight value of each surrounding position of the current block can be derived by the following formula: ReferenceWeights[i] = Clip3(0,8,4*(i-FirstPos)), which is equivalent to ReferenceWeight[i] = Clip3(0,8,(i–FirstPos)<<2). In this case, referring to the third case shown in Figure 7, FirstPos can be 7, the reference weight value of the 1st to 7th surrounding positions is 0, the reference weight value of the 8th surrounding position is 4, the reference weight value of the 9th to 17th surrounding positions is 8, and so on.

[0215] When the absolute value of the weight transformation rate is 8, i.e., the weight transformation rate is 8 or -8, the reference weight value of each surrounding position of the current block is derived by the following formula: ReferenceWeights[i]=Clip3(0,8,8*(i-FirstPos)), which is equivalent to ReferenceWeight[i]=Clip3(0,8,(i–FirstPos)<<3). In this case, referring to the fourth case shown in Figure 7, FirstPos can be 8, that is, the reference weight value of the 1st to 8th surrounding positions is 0, the reference weight value of the 9th surrounding position is 9, the reference weight value of the 10th to 17th surrounding positions is 8, and so on.

[0216] In summary, when the absolute value of the weight transformation rate is 1, FirstPos is 4; when the absolute value of the weight transformation rate is 2, FirstPos is 6 (i.e., FirstPos + 2 when the weight transformation rate is 1); and when the absolute value of the weight transformation rate is 4, FirstPos is 7 (i.e., FirstPos + 3 when the weight transformation rate is 1). Based on this, the position with a reference weight value of 4 can be aligned.

[0217] For example, for the current block, when weight transformation rate switching is supported and activated, one of the four types of weight transformation rate reference weight value distribution examples shown in Figure 7 can be selected for switching. This reduces the abruptness of image display transitions in some image display scenarios by switching the weight transformation rate of the image or a local area of ​​the image. For instance, in some image display scenarios where abrupt transitions are prominent, the weight transformation rate switching in AWP mode can solve this problem. For example, in mixed image content including partial screen content, animations, and images containing animations, the weight transformation rate can be switched for a specific area containing screen content to resolve the issue of prominent abrupt transitions.

[0218] In the above process, ValidLength is related to the weight prediction angle and size of the current block. To simplify the solution, certain parameters can be fixed to achieve optimization. For example, the weight prediction angle of the current block can be configured to a fixed value, and ValidLength can only be related to the size of the current block. FirstPos is related to the weight prediction angle, size, and position of the current block. To simplify the solution, certain parameters can be fixed to achieve optimization. For example, the weight prediction angle of the current block can be configured to a fixed value, and FirstPos can only be related to the size and position of the current block. Alternatively, the weight prediction position of the current block can be configured to a fixed value, and FirstPos can only be related to the size and angle of the current block. Or, both the weight prediction angle and position of the current block can be configured to fixed values, which can be the same or different, and FirstPos can only be related to the size of the current block.

[0219] Example 8: In Examples 1-4, the encoder / decoder needs to configure reference weight values ​​for the surrounding positions outside the current block based on the weight transformation rate and the starting position of the weight transformation of the current block. In one possible implementation, let M and N be the width and height of the current block, and the weight array derivation method of the Angle Weighted Prediction Mode (AWP) includes:

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

[0221] For example, AwpIdx represents the index value of the weight prediction position and the weight prediction angle. Assuming there are 7 weight prediction positions and 8 weight prediction angles, the value range of AwpIdx is 0-55. If the weight prediction position is -3 to 3 (meaning the 4th weight prediction position is the center, and the 4th weight prediction position is 0), and the index of the weight prediction angle is 0-7, then the weight prediction positions and weight prediction angles corresponding to the 56 index values ​​of AwpIdx can be found in Table 1.

[0222] Table 1

[0223] AwpIdx weight prediction position weight prediction angle 0-30 1-31………7-37 8-20 9-21………5537

[0224] For example, stepIdx represents the weight prediction position (i.e., the index value of the weight prediction position), and the weight prediction position can range from -3 to 3. For instance, for the first weight prediction position, the weight prediction position is -3, for the second weight prediction position, the weight prediction position is -2, and so on, with the weight prediction position being 3 for the seventh weight prediction position.

[0225] `angleIdx` represents the logarithmic value of the absolute value of the slope of the weighted prediction angle (e.g., 0, 1, or a large constant), and `subAngleIdx` represents the angle partition in which the weighted prediction angle is located. Referring to Figure 8A, eight weighted prediction angles are shown. The `angleIdx` of weighted prediction angle 0 is the logarithmic value of the absolute value of its slope; the `angleIdx` of weighted prediction angle 1 is the logarithmic value of its slope; and so on, with the `angleIdx` of weighted prediction angle 7 being the logarithmic value of its slope. Weighted prediction angles 0 and 1 are located in angle partition 0, weighted prediction angles 2 and 3 are located in angle partition 1, weighted prediction angles 4 and 5 are located in angle partition 2, and weighted prediction angles 6 and 7 are located in angle partition 3.

[0226] For example, stepIdx can be determined using the following formula: stepIdx = (AwpIdx >> 3) – 3.

[0227] For example, modAngNum (angle number) can be determined according to the following formula: modAngNum = AwpIdx % 8; based on modAngNum, angleIdx can be determined as follows: if modAngNum equals 2, then angleIdx = 7; if modAngNum equals 6, then angleIdx = 8; otherwise, angleIdx = modAngNum % 2.

[0228] For example, subAngleIdx can be determined using the following formula: subAngleIdx = modAngNum >> 1.

[0229] In summary, after determining the weight prediction angle and weight prediction position of the current block, the encoder can determine the value of AwpIdx based on these two values, as shown in Table 1. When the encoder sends the encoded bitstream to the decoder, the encoded bitstream can carry the value of AwpIdx. Based on this, the decoder can obtain the value of AwpIdx and retrieve stepIdx, angleIdx, and subAngleIdx from it.

[0230] For example, angleIdx and subAngleIdx can uniquely determine a weight prediction angle, as shown in Table 2. Of course, other methods can also be used to determine the weight prediction angle, such as changing the partition number.

[0231] Table 2

[0232]

[0233] Step d2: Configure reference weight values ​​for the external perimeter positions of the current block based on stepIdx, angleIdx, and subAngleIdx.

[0234] Scenario 1: If subAngleIdx is 0, meaning the weight prediction angle is located in angle partition 0 (e.g., weight prediction angle 0 or weight prediction angle 1), then the starting position FirstPos of the weight transformation can be determined using the following formula: FirstPos = (ValidLength_H>>1) - 6 + DeltaPos_H. Then, the reference weight values ​​of the surrounding positions outside the current block are determined using the following formula: ReferenceWeights[x] = Clip3(0, 8, x - FirstPos). This formula is illustrated with the example of a minimum reference weight value of 0, a maximum reference weight value of 8, and a weight transformation rate of 1. In other words, the above formula is equivalent to ReferenceWeights[x] = Clip3(minimum, maximum, a * (x - FirstPos)). x can be the index of the surrounding position outside the current block, with a value ranging from 0 to ValidLength_H-1, and a representing the weight transformation rate.

[0235] In the above formula, ValidLength_H represents the number of surrounding positions outside the current block (i.e., the effective number, also known as the effective length). When subAngleIdx is 0, the surrounding positions outside the current block pointed to by the weight prediction angle can be the surrounding positions in the left column. Therefore, the effective number can be denoted as ValidLength_H. For example, the effective number ValidLength_H can be determined using the following formula: ValidLength_H = (N + (M >> angleIdx)) << 1. The formula is shifted one position to the left because it 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; if it is 2-pel precision, then ValidLength_H = (N + (M >> angleIdx)) >> 1, and so on for other pixel precisions, which will not be elaborated here. In the subsequent formulas, the >>1 operations may change due to differences in pixel precision.

[0236] In the above formula, DeltaPos_H represents the position change parameter (i.e., an intermediate parameter). When subAngleIdx is 0, it refers to the peripheral position outside the current block that the weighted prediction angle points to. This can be the peripheral position of the column to the left of the current block. Therefore, the position change parameter can be denoted as DeltaPos_H. For example, DeltaPos_H can be determined using the following formula: DeltaPos_H = stepIdx * ((ValidLength_H >> 3) - 1).

[0237] Scenario 2: If subAngleIdx is 1, meaning the weight prediction angle is located in angle partition 1 (e.g., weight prediction angle 2 or weight prediction angle 3), then the starting position FirstPos of the weight transformation can be determined using the following formula: FirstPos = (ValidLength_H>>1) - 4 + DeltaPos_H – ((M<<1)>>angleIdx). Then, the reference weight values ​​for the surrounding positions outside the current block are determined using the following formula: ReferenceWeights[x] = Clip3(0, 8, a*(x-FirstPos)). This formula is illustrated with the minimum reference weight value being 0, the maximum reference weight value being 8, and the weight transformation rate being a. x can be the index of the surrounding positions outside the current block, and the value of x ranges from 0 to ValidLength_H-1.

[0238] In the above formula, ValidLength_H and DeltaPos_H can be found in Case 1, and will not be repeated here.

[0239] Scenario 3: If subAngleIdx is 2, meaning the weight prediction angle is located in angle partition 2 (e.g., weight prediction angle 4 or weight prediction angle 5), then the starting position FirstPos of the weight transformation can be determined using the following formula: FirstPos = (ValidLength_W>>1) - 4 + DeltaPos_W – ((N<<1)>>angleIdx). Then, the reference weight values ​​of the surrounding positions outside the current block are determined using the following formula: ReferenceWeights[x] = Clip3(0, 8, a*(x-FirstPos)). This formula is illustrated with the minimum reference weight value being 0, the maximum reference weight value being 8, and the weight transformation rate being a. x can be the index of the surrounding positions outside the current block, and the value of x ranges from 0 to ValidLength_W-1.

[0240] In the above formula, ValidLength_W represents the number of surrounding positions outside the current block (i.e., the effective number, also known as the effective length). When subAngleIdx is 2, the surrounding position outside the current block pointed to by the weight prediction angle can be the surrounding position of the row above. Therefore, the effective number is denoted as ValidLength_W. For example, the effective number ValidLength_W can be determined using the following formula: ValidLength_W=(M+(N>>angleIdx))<<1.

[0241] In the above formula, DeltaPos_W represents the position change parameter (i.e., an intermediate parameter). When subAngleIdx is 2, it refers to the peripheral position outside the current block that the weight prediction angle points to. This can be the peripheral position of the row above the current block. Therefore, the position change parameter can be denoted as DeltaPos_W. For example, DeltaPos_W can be determined using the following formula: DeltaPos_W = stepIdx * ((ValidLength_W >> 3) - 1).

[0242] Scenario 4: If subAngleIdx is 3, meaning the weight prediction angle is located in angle partition 3 (e.g., weight prediction angle 6 or 7), then the starting position FirstPos of the weight transformation can be determined using the following formula: FirstPos = (ValidLength_W>>1) - 6 + DeltaPos_W. Then, the reference weight values ​​of the surrounding positions outside the current block can be determined using the following formula: ReferenceWeights[x] = Clip3(0, 8, a*(x-FirstPos)). This formula uses a minimum reference weight value of 0, a maximum reference weight value of 8, and a weight transformation rate of a as an example. x can be the index of the surrounding positions outside the current block, and the value of x ranges from 0 to ValidLength_W-1.

[0243] In the above formula, ValidLength_W and DeltaPos_W can be found in Case 3, and will not be repeated here.

[0244] In summary, the appropriate processing method can be determined based on `subAngleIdx`. For example, in cases one and two, `ValidLength_H` and `DeltaPos_H` can be determined based on `angleIdx` and `stepIdx`, and `FirstPos` can be determined based on `ValidLength_H` and `DeltaPos_H`, then the reference weight value can be configured based on `FirstPos`. In cases three and four, `ValidLength_W` and `DeltaPos_W` can be determined based on `angleIdx` and `stepIdx`, and `FirstPos` can be determined based on `ValidLength_W` and `DeltaPos_W`, then the reference weight value can be configured based on `FirstPos`.

[0245] The difference in the formulas for the above cases lies in the starting position of the reference weight value ReferenceWeights[x] when the top-left corner of the current block is taken as the origin of the coordinate system. For example, as shown in Figure 8B, which illustrates angle partition 2 and angle partition 3, at 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 of angle partition 0 and angle partition 1 is similar, except that the offset in the formula is "–((M<<1)>>angleIdx)", i.e., the height is replaced with the width.

[0246] Step d3: Obtain the brightness weight value of the pixel position based on angleIdx and ReferenceWeights[x].

[0247] Scenario 1: If subAngleIdx is 0, the brightness weight value of pixel position (x, y) can be determined using the following formula: AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)], where (y<<1)+((x<<1)>>angleIdx) represents the surrounding position pointed to by pixel position (x, y), and ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)] represents the reference weight value of that surrounding position. The value range of x is 0~M-1, and the value range of y is 0~N-1.

[0248] Scenario 2: If subAngleIdx is 1, the brightness weight value of pixel position (x, y) can be determined using the following formula: AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)], where (y<<1)-((x<<1)>>angleIdx) represents the surrounding position pointed to by pixel position (x, y), and ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)] represents the reference weight value of that surrounding position. The value range of x is 0~M-1; the value range of y is 0~N-1.

[0249] Scenario 3: If subAngleIdx is 2, the brightness weight value of pixel position (x, y) can be determined using the following formula: AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)], where (x<<1)-((y<<1)>>angleIdx) represents the surrounding position pointed to by pixel position (x, y), and ReferenceWeights[(x <<1)-((y<<1)>>angleIdx)] represents the reference weight value of that surrounding position. The value range of x is 0~M-1; the value range of y is 0~N-1.

[0250] Case 4: If subAngleIdx is 3, the brightness weight value of pixel position (x, y) can be determined using the following formula: AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)], where (x<<1)+((y<<1)>>angleIdx) represents the surrounding position pointed to by pixel position (x, y), and ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)] represents the reference weight value of that surrounding position. The value range of x is 0~M-1; the value range of y is 0~N-1.

[0251] The above steps d2 and d3 can be combined into one step, that is, step d2 (configuring reference weight values ​​for the surrounding positions outside the current block according to stepIdx, angleIdx and subAngleIdx) and step d3 (obtaining the brightness weight value according to angleIdx and the reference weight value ReferenceWeight[x]) are combined into: obtaining the brightness weight value of the pixel position according to stepIdx, angleIdx and subAngleIdx, that is, determining it according to the coordinate values ​​of the surrounding positions and the coordinate values ​​of the starting position of the weight transformation.

[0252] Taking case one as an example: If subAngleIdx is 0, that is, the weight prediction angle is located in angle partition 0. If the weight prediction angle is weight prediction angle 0 or weight prediction angle 1, then the starting position FirstPos of the weight transformation is determined by the following formula: FirstPos=(ValidLength_H>>1)-6+DeltaPos_H. Then, the brightness weight value of pixel position (x, y) is determined by the following formula: AwpWeightArrayY[x][y]=Clip3(0,8,(y<<1)+((x<<1)>>angleIdx)-FirstPos): (y<<1)+((x<<1)>>angleIdx) represents the surrounding matching position pointed to by pixel position (x, y).

[0253] Step d4: Obtain the chromaticity weight value of the pixel position based on the luminance weight value of the pixel position. The luminance weight value and the chromaticity weight value of the pixel position can then be combined to form the target weight value of the pixel position.

[0254] For example, if the chroma resolution format is 4:2:0, the chroma weight value of pixel position (x, y) is determined by the following formula: AwpWeightArrayUV[x][y] = AwpWeightArrayY[x<<1][y<<1]. As another example, if the chroma resolution format is 4:4:4, the chroma weight value of pixel position (x, y) is determined by the following formula: AwpWeightArrayUV[x][y] = AwpWeightArrayY[x][y]. Here, the value of x ranges from 0 to M / 2-1; the value of y ranges from 0 to N / 2-1.

[0255] Another way to implement step d4 is to obtain the chromaticity weight value of the pixel position based on angleIdx and the reference weight value ReferenceWeight[x], instead of obtaining the chromaticity weight value based on the luminance weight value. For example, if the chromaticity resolution format is 4:2:0, then the chromaticity weight value of the pixel position is obtained based on angleIdx and the reference weight value ReferenceWeight[x].

[0256] For example, if subAngleIdx is 0, the chromatic weight value of the pixel position (x, y) can be determined by the following formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)+((x<<2)>>angleIdx)].

[0257] For example, if subAngleIdx is 1, the chromatic weight value of the pixel position (x, y) can be determined by the following formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)-((x<<2)>>angleIdx)].

[0258] For example, if subAngleIdx is 2, the chromatic weight value of the pixel position (x, y) can be determined by the following formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)-((y<<2)>>angleIdx)].

[0259] For example, if subAngleIdx is 3, the chromatic weight value of the pixel position (x, y) can be determined by the following formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)+((y<<2)>>angleIdx)].

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

[0261] The difference in the formulas for each case in steps d3 and d4 is shown in Figure 8C, which illustrates examples of angle partition 2 and angle partition 3. When the top-left corner of the current block is taken as the origin, the formula for calculating the matching position of (x,y) in angle partition 2 is: x – y >> angleIdx; the formula for calculating the matching position of (x,y) in angle partition 3 is: x + y >> angleIdx. At 1 / 2-pel precision, the formula for calculating the matching position of (x,y) in angle partition 2 is: (x << 1) – (y << 1) >> angleIdx; the formula for calculating the matching position of (x,y) in angle partition 3 is: (x << 1) + (y << 1) >> angleIdx. The implementation of angle partition 0 and angle partition 1 is similar, except that the positions of (x,y) are swapped.

[0262] Example 9: In Examples 1-4, the encoder / decoder needs to obtain the weight transformation rate of the current block. If the current block supports a weight transformation rate switching mode, the weight transformation rate of the current block is obtained as follows: obtain the weight transformation rate indication information of the current block, and determine the weight transformation rate of the current block based on the weight transformation rate indication information. For example, if the weight transformation rate indication information is a first indication information, the weight transformation rate of the current block is the first weight transformation rate; if the weight transformation rate indication information is a second indication information, the weight transformation rate of the current block is the second weight transformation rate. If the current block does not support a weight transformation rate switching mode, the preset weight transformation rate is determined as the weight transformation rate of the current block.

[0263] In summary, if the current block supports a weight transformation rate switching mode, the weight transformation rate of the current block can be either a first weight transformation rate or a 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 it can adaptively switch the weight transformation rate instead of using a uniform weight transformation rate.

[0264] For example, if the switching control information allows the current block to enable the weight transformation rate switching mode, then the current block supports the weight transformation rate switching mode; if the switching control information does not allow the current block to enable the weight transformation rate switching mode, then the current block does not support the weight transformation rate switching mode. This switching control information may include, but is not limited to: sequence-level switching control information, frame-level switching control information, slice-level switching control information, tile-level switching control information, patch-level switching control information, CTU (Coding Tee Unit)-level switching control information, LCU (Largest Coding Unit)-level switching control information, block-level switching control information, CU (Coding Unit)-level switching control information, PU (Prediction Unit)-level switching control information, etc., without limitation.

[0265] For the encoder, it can obtain the switching control information and determine whether the switching control information allows the current block to enable the weight transformation rate switching mode, thereby determining whether the current block supports the weight transformation rate switching mode. The encoder can encode the switching control information into the bitstream, allowing the decoder to parse the switching control information from the bitstream, determine whether the switching control information allows the current block to enable the weight transformation rate switching mode, and thus determine whether the current block supports the weight transformation rate switching mode. Alternatively, the encoder can choose not to encode the switching control information into the bitstream, but instead have the decoder implicitly deduce the switching control information, determine whether the switching control information allows the current block to enable the weight transformation rate switching mode, and thus determine whether the current block supports the weight transformation rate switching mode.

[0266] Taking sequence-level switching control information as an example, the sequence-level switching control information can be `awp_adptive_flag` (inter-frame angle-weighted prediction adaptation flag). If `awp_adptive_flag` has the first value, it means that the sequence-level switching control information allows the current sequence to enable the weight transformation rate switching mode, thus allowing the current block to enable the weight transformation rate switching mode. If `awp_adptive_flag` has the second value, it means that the sequence-level switching control information does not allow the current sequence to enable the weight transformation rate switching mode, thus disallowing the current block to enable the weight transformation rate switching mode. For example, 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 just examples of the first and second values ​​and are not intended to limit the scope. The implementation process for other types of switching control information is similar to that for sequence-level switching control information and will not be elaborated here.

[0267] In one possible implementation, the weight transformation rate indication information for the current block can be an SCC (Screen Content Coding) identifier corresponding to the current block. A first indication information indicates that the current block belongs to screen content coding, and a second indication information indicates that the current block belongs to non-screen content coding. Based on this, the SCC identifier corresponding to the current block can be obtained, and the weight transformation rate of the current block can be determined according to the SCC identifier. For example, if the SCC identifier indicates that the current block belongs to screen content coding, then the weight transformation rate of the current block is a first weight transformation rate; if the SCC identifier indicates that the current block belongs to non-screen content coding, then the weight transformation rate of the current block is a second weight transformation rate.

[0268] For example, the absolute value of the first weight transformation rate can be greater than the absolute value of the second weight transformation rate. For instance, the absolute value of the first weight transformation rate can be 4, and the absolute value of the second weight transformation rate can be 1 or 2. Or, for another example, the absolute value of the first weight transformation rate can be 2, and the absolute value of the second weight transformation rate can be 1. Or, for yet another example, the absolute value of the first weight transformation rate can be 8, and the absolute value of the second weight transformation rate can be 1, 2, or 4. Or, for yet another example, the absolute value of the first weight transformation rate can be 8 or 4, and the absolute value of the second weight transformation rate can be 1 or 2. Of course, these are just a few examples and are not restrictive, as long as the absolute value of the first weight transformation rate is greater than the absolute value of the second weight transformation rate.

[0269] For example, the SCC identifier may include, but is not limited to: sequence-level SCC identifier, frame-level SCC identifier, slice-level SCC identifier, tile-level SCC identifier, patch-level SCC identifier, CTU-level SCC identifier, LCU-level SCC identifier, block-level SCC identifier, CU-level SCC identifier, PU-level SCC identifier, etc., without limitation. For example, the sequence-level SCC identifier corresponding to the current block can be determined as the SCC identifier corresponding to the current block, or the frame-level SCC identifier corresponding to the current block can be determined as the SCC identifier corresponding to the current block, and so on, as long as the SCC identifier corresponding to the current block can be obtained.

[0270] For example, the encoding end can decide whether the current block belongs to screen content encoding or non-screen content encoding. If the current block belongs to screen content encoding, the encoding end determines the weight transformation rate of the current block to be a first weight transformation rate. If the current block belongs to non-screen content encoding, the encoding end determines the weight transformation rate of the current block to be a second weight transformation rate. Alternatively, the encoding end can obtain the SCC identifier corresponding to the current block. If the SCC identifier indicates that the current block belongs to screen content encoding, the encoding end determines the weight transformation rate of the current block to be a first weight transformation rate. If the SCC identifier indicates that the current block belongs to non-screen content encoding, the encoding end determines the weight transformation rate of the current block to be a second weight transformation rate.

[0271] The encoding end can encode SCC identifiers (such as sequence-level SCC identifiers, frame-level SCC identifiers, slice-level SCC identifiers, etc.) into the bitstream, allowing the decoding end to parse the SCC identifier from the bitstream and determine it as the SCC identifier corresponding to the current block. For example, the sequence-level SCC identifier corresponding to the current block can be determined as the SCC identifier corresponding to the current block. In summary, the decoding end can obtain the SCC identifier corresponding to the current block. If the SCC identifier indicates that the current block belongs to screen content encoding, the decoding end determines the weight transformation rate of the current block to be a first weight transformation rate. If the SCC identifier indicates that the current block belongs to non-screen content encoding, the decoding end determines the weight transformation rate of the current block to be a second weight transformation rate. For example, if the SCC identifier has the first value, it indicates that the current block belongs to screen content encoding; if the SCC identifier has the second value, it indicates that the current block belongs to non-screen content encoding. 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 just examples of the first and second values ​​and are not limiting.

[0272] The encoding end can also choose not to encode the SCC identifier into the bitstream, but instead implicitly derive the SCC identifier using information consistent with that of the decoding end. In this case, the decoding end can also implicitly derive the SCC identifier and determine it as the SCC identifier corresponding to the current block. For example, if multiple consecutive frames are screen content encoded, the current frame is deduced to be screen content encoded. Therefore, the decoding end implicitly derives the frame-level SCC identifier and determines it as the SCC identifier corresponding to the current block, and this SCC identifier is used to indicate that the current block belongs to screen content encoded. For example, if multiple consecutive frames are non-screen content encoded, the current frame is deduced to be non-screen content encoded. Therefore, the decoding end implicitly derives the frame-level SCC identifier, and this SCC identifier is used to indicate that the current block belongs to non-screen content encoded. For example, if the IBC mode percentage is less than a certain percentage, the next frame is determined to be non-screen content encoded; otherwise, screen content encoded continues. Of course, the above methods are just examples of implicitly deriving the SCC identifier, and there are no restrictions on this implicit derivation method. In summary, the decoder can obtain the SCC identifier corresponding to the current block. If the SCC identifier indicates that the current block belongs to screen content encoding, the decoder determines the weight transformation rate of the current block to be the first weight transformation rate. If the SCC identifier indicates that the current block belongs to non-screen content encoding, the decoder determines the weight transformation rate of the current block to be the second weight transformation rate. For example, if the SCC identifier is the first value, it indicates that the current block belongs to screen content encoding; if the SCC identifier is the second value, it indicates that the current block belongs to non-screen content encoding.

[0273] In summary, the weight transformation rate of the current block can be either the first weight transformation rate or the second weight transformation rate. That is, the weight transformation rate of the current block can be switched, and the switching of the weight transformation rate depends on the explicit or implicit SCC flag of a certain level. The explicit SCC flag means that scc_flag (SCC flag) is encoded into the bitstream so that the decoder can parse the SCC flag from the bitstream. The implicit SCC flag means that the decoder adaptively derives the SCC flag based on the information it can obtain.

[0274] A specific SCC identifier refers to: At the sequence level, it indicates the SCC identifier of the current sequence, which serves as the SCC identifier for all blocks belonging to the current sequence; at the frame level, it indicates the SCC identifier of the current frame, which serves as the SCC identifier for all blocks belonging to the current frame; at the slice level, it indicates the SCC identifier of the current slice, which serves as the SCC identifier for all blocks belonging to the current slice; at the tile level, it indicates the SCC identifier of the current tile, which serves as the SCC identifier for all blocks belonging to the current tile; at the patch level, it indicates the SCC identifier of the current patch, which serves as the SCC identifier for all blocks belonging to the current patch. The SCC identifiers of all blocks in the current patch; the CTU level indicates the SCC identifier of the current CTU, which serves as the SCC identifier for all blocks belonging to the current CTU; the LCU level indicates the SCC identifier of the current LCU, which serves as the SCC identifier for all blocks belonging to the current LCU; the block level indicates the SCC identifier of the current block, which serves as the SCC identifier for all blocks belonging to the current block; the CU level indicates the SCC identifier of the current CU, which serves as the SCC identifier for the current CU; the PU level indicates the SCC identifier of the current PU, which serves as the SCC identifier for the current PU.

[0275] For example, the second weight transformation rate can be used as the default weight transformation rate. When the SCC flag indicates that the current block belongs to non-screen content encoding, there is no need to switch the weight transformation rate; that is, the weight transformation rate of the current block is determined to be the second weight transformation rate. When the SCC flag indicates that the current block belongs to screen content encoding, the weight transformation rate needs to be switched; that is, the weight transformation rate of the current block is determined to be the first weight transformation rate. Alternatively, the first weight transformation rate can be used as the default weight transformation rate. When the SCC flag indicates that the current block belongs to non-screen content encoding, the weight transformation rate needs to be switched; that is, the weight transformation rate of the current block is determined to be the second weight transformation rate. When the SCC flag indicates that the current block belongs to screen content encoding, there is no need to switch the weight transformation rate; that is, the weight transformation rate of the current block is determined to be the first weight transformation rate.

[0276] In summary, when the current block belongs to screen content encoding, the weight transformation rate of the current block is the first weight transformation rate. When the current block belongs to non-screen content encoding, the weight transformation rate of the current block is the second weight transformation rate. The absolute value of the first weight transformation rate is greater than the absolute value of the second weight transformation rate. For example, if the absolute value of the first weight transformation rate is 4 and the absolute value of the second weight transformation rate is 1, the absolute value of the weight transformation rate of the current block belonging to the SCC sequence increases, that is, the transformation speed increases.

[0277] In another possible implementation, the weight transformation rate indication information for the current block can be a weight transformation rate switching identifier corresponding to the current block. A first indication indicates that the current block does not need to undergo a weight transformation rate switch, and a second indication indicates that the current block needs to undergo a weight transformation rate switch. Based on this, the weight transformation rate switching identifier corresponding to the current block can be obtained, and the weight transformation rate of the current block can be determined according to this identifier. For example, if the weight transformation rate switching identifier indicates that the current block does not need to undergo a weight transformation rate switch, then the weight transformation rate of the current block can be a first weight transformation rate; if the weight transformation rate switching identifier indicates that the current block needs to undergo a weight transformation rate switch, then the weight transformation rate of the current block can be a second weight transformation rate. The absolute value of the first weight transformation rate is not equal to the absolute value of the second weight transformation rate.

[0278] For example, the absolute value of the first weight transformation rate can be greater than the absolute value of the second weight transformation rate. For instance, the absolute value of the first weight transformation rate can be 4, and the absolute value of the second weight transformation rate can be 1 or 2. Or, the absolute value of the first weight transformation rate can be 2, and the absolute value of the second weight transformation rate can be 1. Or, the absolute value of the first weight transformation rate can be 8, and the absolute value of the second weight transformation rate can be 1, 2, or 4. As another example, the absolute value of the first weight transformation rate can be less than the absolute value of the second weight transformation rate. For instance, the absolute value of the first weight transformation rate can be 1, and the absolute value of the second weight transformation rate can be 2, 4, or 8. Or, the absolute value of the first weight transformation rate can be 2, and the absolute value of the second weight transformation rate can be 4 or 8. Or, the absolute value of the first weight transformation rate can be 4, and the absolute value of the second weight transformation rate can be 8. Of course, these are just a few examples and are not restrictive, as long as the absolute value of the first weight transformation rate is not equal to the absolute value of the second weight transformation rate.

[0279] For example, the weight transformation rate switching identifier may include, but is not limited to: sequence-level weight transformation rate switching identifier, frame-level weight transformation rate switching identifier, slice-level weight transformation rate switching identifier, tile-level weight transformation rate switching identifier, patch-level weight transformation rate switching identifier, CTU-level weight transformation rate switching identifier, LCU-level weight transformation rate switching identifier, block-level weight transformation rate switching identifier, CU-level weight transformation rate switching identifier, PU-level weight transformation rate switching identifier, etc., without limitation.

[0280] For example, the sequence-level weight transformation rate switching identifier corresponding to the current block can be determined as the weight transformation rate switching identifier corresponding to the current block, or the frame-level weight transformation rate switching identifier corresponding to the current block can be determined as the weight transformation rate switching identifier corresponding to the current block, and so on, as long as the weight transformation rate switching identifier corresponding to the current block can be obtained.

[0281] For example, a first weight transformation rate can be used as the default weight transformation rate. The encoder can determine whether the current block needs a weight transformation rate switch. If the current block does not need a weight transformation rate switch, the encoder determines the current block's weight transformation rate to be the first weight transformation rate. If the current block needs a weight transformation rate switch, the encoder determines the current block's weight transformation rate to be the second weight transformation rate. Alternatively, the encoder can obtain a weight transformation rate switching flag corresponding to the current block. If the flag indicates that the current block does not need a weight transformation rate switch, the encoder can determine the current block's weight transformation rate to be the first weight transformation rate. If the flag indicates that the current block needs a weight transformation rate switch, the encoder determines the current block's weight transformation rate to be the second weight transformation rate.

[0282] For example, the encoder determines the rate-distortion value 1 corresponding to the first weight transformation rate and the rate-distortion value 2 corresponding to the second weight transformation rate. If the rate-distortion value 1 is less than the rate-distortion value 2, it is determined that the current block does not need to switch the weight transformation rate; if the rate-distortion value 2 is less than the rate-distortion value 1, it is determined that the current block needs to switch the weight transformation rate.

[0283] The encoding end can encode a weight transformation rate switching identifier (such as a sequence-level weight transformation rate switching identifier) ​​into the bitstream, allowing the decoding end to parse this identifier from the bitstream and determine it as the weight transformation rate switching identifier corresponding to the current block. In summary, the decoding end can obtain the weight transformation rate switching identifier corresponding to the current block. If the identifier indicates that the current block does not require a weight transformation rate switch, the decoding end determines the weight transformation rate of the current block to be the first weight transformation rate. If the identifier indicates that the current block requires a weight transformation rate switch, the decoding end determines the weight transformation rate of the current block to be the second weight transformation rate. For example, if the identifier is the first value, it indicates that the current block does not require a weight transformation rate switch; if the identifier is the second value, it indicates that the current block requires a weight transformation rate switch. The first value can be 1 and the second value can be 0, or the first value can be 0 and the second value can be 1. Of course, the above are just examples of the first and second values ​​and are not restrictive.

[0284] The encoder may choose not to encode the weight transition rate switching identifier into the bitstream. Instead, the decoder implicitly derives the identifier and sets it as the weight transition rate switching identifier for the current block. For example, if multiple consecutive blocks require weight transition rate switching, the current block also requires switching. The decoder implicitly derives the weight transition rate switching identifier, sets it as the identifier for the current block, and this identifier indicates that the current block requires a weight transition rate switch. Conversely, if multiple consecutive blocks do not require weight transition rate switching, the current block also does not require switching. The decoder implicitly derives the identifier, and this identifier indicates that the current block does not require a weight transition rate switch. This is merely an example of implicitly deriving the weight transition rate switching identifier, and no limitation is imposed on this method. In summary, the decoder can determine the weight transition rate switching identifier for the current block. If this identifier indicates that the current block does not require a weight transition rate switch, then the weight transition rate for the current block is determined to be the first weight transition rate. If the weight transformation rate switching flag indicates that the current block needs to switch weight transformation rates, then the weight transformation rate of the current block is determined to be the second weight transformation rate.

[0285] In summary, the weight transformation rate of the current block can be either the first weight transformation rate or the second weight transformation rate, meaning that the weight transformation rate of the current block can be switched. The switching of the weight transformation rate depends on the weight transformation rate switching flag (refine_flag) of a certain level. This refine_flag can be an explicit flag or an implicit flag. An explicit flag means that refine_flag is encoded into the bitstream so that the decoder can parse refine_flag from the bitstream. An implicit flag means that the encoder and decoder adaptively derive refine_flag based on the information they can obtain.

[0286] For example, a certain level of refine_flag refers to: sequence level indicating the refine_flag of the current sequence, which serves as the refine_flag of all blocks belonging to the current sequence; frame level indicating the refine_flag of the current frame, which serves as the refine_flag of all blocks belonging to the current frame; slice level indicating the refine_flag of the current slice, which serves as the refine_flag of all blocks belonging to the current slice; and tile level indicating the refine_flag of the current tile, which serves as the refine_flag of all blocks belonging to the current tile. At the patch level, the `refine_flag` is set to the current patch, serving as the `refine_flag` for all blocks belonging to that patch. At the CTU level, the `refine_flag` is set to the current CTU, serving as the `refine_flag` for all blocks belonging to that CTU. At the LCU level, the `refine_flag` is set to the current LCU, serving as the `refine_flag` for all blocks belonging to that LCU. At the block level, the `refine_flag` is set to the current block, serving as the `refine_flag` for that block. At the CU level, the `refine_flag` is set to the current CU, serving as the `refine_flag` for that CU. At the PU level, the `refine_flag` is set to the current PU, serving as the `refine_flag` for that PU. These are just a few examples and are not intended to be restrictive.

[0287] For example, the first weight transformation rate can be used as the default weight transformation rate. When the weight transformation rate switching flag indicates that the current block does not need to switch the weight transformation rate, the weight transformation rate is not switched, that is, the weight transformation rate of the current block is determined to be the first weight transformation rate. When the weight transformation rate switching flag indicates that the current block needs to switch the weight transformation rate, 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.

[0288] Example 10: In Examples 1-4, the encoder / decoder needs to obtain the weight prediction angle and weight prediction position of the current block. In Example 9, the weight transformation rate of the current block, such as the first weight transformation rate or the second weight transformation rate, can be obtained. Based on this, the weight prediction angle and weight prediction position of the current block are obtained in the following way:

[0289] Method 1: The encoder and decoder agree on the same weight prediction angle as the weight prediction angle of the current block, and agree on the same weight prediction position as the weight prediction position of the current block. For example, the encoder and decoder use weight prediction angle A as the weight prediction angle of the current block, and weight prediction position 4 as the weight prediction position of the current block.

[0290] Method 2: The encoding end constructs a list of weight prediction angles, which includes at least one weight prediction angle, such as weight prediction angle A and weight prediction angle B. The encoding end also constructs a list of weight prediction positions, which includes at least one weight prediction position, such as weight prediction position 0 through weight prediction position 6. Each weight prediction angle in the weight prediction angle list and each weight prediction position in the weight prediction position list are iterated sequentially, i.e., each combination of weight prediction angle and weight prediction position is iterated. Each combination is used as the weight prediction angle and weight prediction position obtained in step a1. Based on this weight prediction angle, weight prediction position, and weight transformation rate, the weighted prediction value of the current block is obtained.

[0291] For example, when the encoder iterates to weight prediction angle A and weight prediction position 0, it obtains the weighted prediction value of the current block based on weight prediction angle A and weight prediction position 0. When it iterates to weight prediction angle A and weight prediction position 1, it obtains the weighted prediction value of the current block based on weight prediction angle A and weight prediction position 1. When it iterates to weight prediction angle B and weight prediction position 0, it obtains the weighted prediction value of the current block based on weight prediction angle B and weight prediction position 0, and so on. The encoder can obtain the weighted prediction value of the current block based on each combination of weight prediction angle and weight prediction position.

[0292] After obtaining the weighted prediction value of the current block based on the combination of weighted prediction angle and weighted prediction position, the encoder can determine the rate-distortion cost value based on the weighted prediction value of the current block. There are no restrictions on the method of determining this rate-distortion cost value. The encoder can obtain the rate-distortion cost value of each combination and select the minimum rate-distortion cost value from all rate-distortion cost values.

[0293] Then, the encoder combines the weight prediction angle and weight prediction position corresponding to the minimum rate distortion cost as the target weight prediction angle and target weight prediction position. Finally, the index value of the target weight prediction angle in the weight prediction angle list and the index value of the target weight prediction position in the weight prediction position list are encoded into the bitstream.

[0294] For the decoding end, it constructs a weight prediction angle list, which is identical to the weight prediction angle list of the encoding end, and includes at least one weight prediction angle. It also constructs a weight prediction position list, identical to the weight prediction position list of the encoding end, and includes at least one weight prediction position. Upon receiving the encoded bitstream of the current block, the decoding end parses the indication information from the encoded bitstream, selects a weight prediction angle from the weight prediction angle list as the weight prediction angle for the current block based on this indication information, and selects a weight prediction position from the weight prediction position list as the weight prediction position for the current block based on this indication information.

[0295] Application Scenario 1: When the encoding end sends the encoded bitstream to the decoding end, the encoded bitstream may include indication information 1. Indication information 1 is used to indicate the weight prediction angle (i.e., the target weight prediction angle) and the weight prediction position (i.e., the target weight prediction position) of the current block. For example, when indication information 1 is 0, it indicates the first weight prediction angle in the weight prediction angle list and the first weight prediction position in the weight prediction position list. When indication information 1 is 1, it indicates the first weight prediction angle in the weight prediction angle list and the second weight prediction position in the weight prediction position list, and so on. The value of indication information 1 can indicate which weight prediction angle and which weight prediction position, as long as the encoding end and the decoding end agree on it. This embodiment does not impose any restrictions on this.

[0296] After receiving the encoded bitstream, the decoder parses indication information 1 from it. Based on indication information 1, the decoder can select the weight prediction angle corresponding to indication information 1 from the weight prediction angle list, and this weight prediction angle is used as the weight prediction angle for the current block. Based on indication information 1, the decoder can select the weight prediction position corresponding to indication information 1 from the weight prediction position list, and this weight prediction position is used as the weight prediction position for the current block.

[0297] Application Scenario 2: When the encoding end sends the encoded bitstream to the decoding end, the encoded bitstream may include indication information 2 and indication information 3. Indication information 2 indicates the target weight prediction angle of the current block, such as index 1 in the weight prediction angle list, where index 1 indicates which weight prediction angle the target weight prediction angle is in the list. Indication information 3 indicates the target weight prediction position of the current block, such as index 2 in the weight prediction position list, where index 2 indicates which weight prediction position the target weight prediction position is in the list. After receiving the encoded bitstream, the decoding end parses indication information 2 and indication information 3 from the encoded bitstream. Based on indication information 2, it selects the weight prediction angle corresponding to index 1 from the weight prediction angle list, and this weight prediction angle is used as the weight prediction angle of the current block. Based on indication information 3, it selects the weight prediction position corresponding to index 2 from the weight prediction position list, and this weight prediction position is used as the weight prediction position of the current block.

[0298] Application Scenario 3: The encoder and decoder can agree on a preferred configuration combination. There are no restrictions on this preferred configuration combination. It can be configured based on actual experience. For example, the encoder and decoder agree on a preferred configuration combination 1 that includes weight prediction angle A and weight prediction position 4, and a preferred configuration combination 2 that includes weight prediction angle B and weight prediction position 4.

[0299] After determining the target weight prediction angle and target weight prediction position of the current block, the encoder determines whether the target weight prediction angle and target weight prediction position are a preferred configuration combination. If so, when the encoder sends the encoded bitstream to the decoder, the encoded bitstream may include indication information 4 and indication information 5. Indication information 4 is used to indicate whether the current block adopts a preferred configuration combination. If indication information 4 is the first value (e.g., 0), it indicates that the current block adopts a preferred configuration combination. Indication information 5 is used to indicate which preferred configuration combination the current block adopts. For example, if indication information 5 is 0, it indicates that the current block adopts preferred configuration combination 1; if indication information 5 is 1, it indicates that the current block adopts preferred configuration combination 2.

[0300] After receiving the encoded bitstream, the decoder parses indication information 4 and indication information 5 from it. Based on indication information 4, the decoder determines whether the current block uses the preferred configuration combination. If indication information 4 is the first value, the current block uses the preferred configuration combination. When the current block uses the preferred configuration combination, the decoder determines which preferred configuration combination is used based on indication information 5. For example, when indication information 5 is 0, the current block uses preferred configuration combination 1, meaning the weight prediction angle of the current block is weight prediction angle A, and the weight prediction position of the current block is weight prediction position 4. As another example, when indication information 5 is 1, the current block uses preferred configuration combination 2, meaning the weight prediction angle of the current block is weight prediction angle B, and the weight prediction position of the current block is weight prediction position 4.

[0301] For example, if the encoder and decoder agree on only one preferred configuration combination, such as a preferred configuration combination including weight prediction angle A and weight prediction position 4, then the encoded bitstream may include indication information 4 but not indication information 5. Indication information 4 is used to indicate that the current block adopts the preferred configuration combination. After the decoder parses the indication information 4 from the encoded bitstream, if the indication information 4 is the first value, it determines that the current block adopts the preferred configuration combination. Based on the preferred configuration combination, it determines that the weight prediction angle of the current block is weight prediction angle A and the weight prediction position of the current block is weight prediction position 4.

[0302] Application Scenario 4: The encoder and decoder can agree on a preferred configuration combination. After determining the target weight prediction angle and target weight prediction position of the current block, the encoder determines whether the target weight prediction angle and target weight prediction position are the preferred configuration combination. If not, when the encoder sends the encoded bitstream to the decoder, this encoded bitstream includes indication information 4 and indication information 6. Indication information 4 is used to indicate whether the current block uses the preferred configuration combination. If indication information 4 is the second value (e.g., 1), it indicates that the current block does not use the preferred configuration combination. Indication information 6 is used to indicate the target weight prediction angle and the target weight prediction position of the current block. For example, when indication information 6 is 0, it indicates the first weight prediction angle in the weight prediction angle list and the first weight prediction position in the weight prediction position list, and so on.

[0303] After receiving the encoded bitstream, the decoder parses indication information 4 and indication information 6 from it. Based on indication information 4, the decoder determines whether the current block uses the preferred configuration combination. If indication information 4 is the second value, it is determined that the current block does not use the preferred configuration combination. When the current block does not use the preferred configuration combination, the decoder, based on indication information 6, can select the weight prediction angle corresponding to indication information 6 from the weight prediction angle list. This weight prediction angle is used as the weight prediction angle of the current block. Based on indication information 6, the decoder can also select the weight prediction position corresponding to indication information 6 from the weight prediction position list. This weight prediction position is used as the weight prediction position of the current block.

[0304] Application Scenario 5: The encoder and decoder can agree on a preferred configuration combination. After determining the target weight prediction angle and target weight prediction position of the current block, the encoder determines whether the target weight prediction angle and target weight prediction position are the preferred configuration combination. If not, when the encoder sends the encoded bitstream to the decoder, the encoded bitstream includes indication information 4, indication information 7, and indication information 8. For example, indication information 4 indicates whether the current block uses the preferred configuration combination; if indication information 4 is the second value, it indicates that the current block does not use the preferred configuration combination. Indication information 7 indicates the target weight prediction angle of the current block; for example, if the target weight prediction angle is index 1 in the weight prediction angle list, index 1 indicates which weight prediction angle in the weight prediction angle list it is. Indication information 8 indicates the target weight prediction position of the current block; for example, if the target weight prediction position is index 2 in the weight prediction position list, index 2 indicates which weight prediction position in the weight prediction position list it is.

[0305] After receiving the encoded bitstream, the decoder parses indication information 4, indication information 7, and indication information 8 from it. Based on indication information 4, the decoder determines whether the current block uses the preferred configuration combination. If indication information 4 is the second value, it is determined that the current block does not use the preferred configuration combination. When the current block does not use the preferred configuration combination, the decoder selects the weight prediction angle corresponding to index value 1 from the weight prediction angle list based on indication information 7, and this weight prediction angle is used as the weight prediction angle of the current block. Based on indication information 8, the decoder selects the weight prediction position corresponding to index value 2 from the weight prediction position list, and this weight prediction position is used as the weight prediction position of the current block.

[0306] Example 11: In Examples 1-4, the encoder / decoder needs to obtain the weight transformation rate of the current block. If the current block supports a weight transformation rate switching mode, the weight transformation rate of the current block is obtained as follows: Obtain the weight transformation rate indication information of the current block; select the weight transformation rate corresponding to the weight transformation rate indication information from a preset lookup table; the preset lookup table includes at least two weight transformation rates. The selected weight transformation rate is determined as the weight transformation rate of the current block.

[0307] Since the preset lookup table includes at least two weight transformation rates, if the current block supports weight transformation rate switching mode, the weight transformation rate of the current block can be selected from at least two weight transformation rates. That is, the weight transformation rate of the current block is variable, so it can adaptively switch the weight transformation rate instead of using a uniform weight transformation rate.

[0308] For example, if the switching control information allows the current block to enable the weight transformation rate switching mode, then the current block supports the weight transformation rate switching mode; if the switching control information does not allow the current block to enable the weight transformation rate switching mode, then the current block does not support the weight transformation rate switching mode. For details on whether the current block supports the weight transformation rate switching mode, please refer to Example 9.

[0309] In one possible implementation, the preset lookup table may include at least two weight transformation rates, and the weight transformation rate indication information may include weight transformation rate index information (used to indicate a specific weight transformation rate among all weight transformation rates in the lookup table). Based on this, the weight transformation rate corresponding to the weight transformation rate index information can be selected from the lookup table.

[0310] For the encoder, if there is only one lookup table, for each weight transformation rate in the lookup table, the encoder can determine the rate distortion cost corresponding to that weight transformation rate, and take the weight transformation rate corresponding to the smallest rate distortion cost as the target weight transformation rate of the current block, and determine the index information of the target weight transformation rate in the lookup table, that is, the weight transformation rate index information, which indicates which weight transformation rate in the lookup table.

[0311] For the decoder, if only one lookup table exists, when the encoder sends the encoded bitstream of the current block to the decoder, this encoded bitstream can carry weight transformation rate index information. This index information indicates the index of the target weight transformation rate in the lookup table. The decoder selects the weight transformation rate corresponding to this index information from the lookup table, and this weight transformation rate is used as the target weight transformation rate for the current block.

[0312] Example 12: In Examples 1-4, the encoder / decoder needs to obtain the weight prediction angle, weight prediction position, and weight transformation rate of the current block. In Example 11, the weight transformation rate of the current block can be obtained. Based on this, the weight prediction angle and weight prediction position of the current block can be obtained in the following way:

[0313] Method 1: The encoder and decoder agree on the same weight prediction angle as the weight prediction angle of the current block, and agree on the same weight prediction position as the weight prediction position of the current block. For example, the encoder and decoder use weight prediction angle A as the weight prediction angle of the current block, and weight prediction position 4 as the weight prediction position of the current block.

[0314] Method 2: The encoding end constructs a list of weight prediction angles, which includes at least one weight prediction angle. The encoding end also constructs a list of weight prediction positions, which includes at least one weight prediction position. The encoding end constructs at least two lookup tables, taking a first lookup table and a second lookup table as examples. The first lookup table includes at least one weight transformation rate, and the second lookup table includes at least one weight transformation rate. The encoding end determines the target lookup table, as described in Example 11, taking the first lookup table as the target lookup table. The encoding end sequentially traverses each weight prediction angle in the weight prediction angle list, each weight prediction position in the weight prediction position list, and each weight transformation rate in the target lookup table, i.e., it traverses each combination of weight prediction angle, weight prediction position, and weight transformation rate. For each combination of weight prediction angle, weight prediction position, and weight transformation rate, it is used as the weight prediction angle, weight prediction position, and weight transformation rate obtained in step a1. Based on the weight prediction angle, weight prediction position, and weight transformation rate, the weighted prediction value of the current block is obtained.

[0315] In summary, the encoder can obtain the weighted prediction value of the current block based on each combination. After obtaining the weighted prediction value of the current block, the encoder can determine the rate-distortion cost based on the weighted prediction value of the current block. That is, the encoder can obtain the rate-distortion cost of each combination and select the minimum rate-distortion cost from all rate-distortion costs.

[0316] Then, the encoder uses the weight prediction angle, weight prediction position, and weight transformation rate corresponding to the minimum rate distortion cost as the target weight prediction angle, target weight prediction position, and target weight transformation rate, respectively. Finally, the index values ​​of the target weight prediction angle in the weight prediction angle list, the index values ​​of the target weight prediction position in the weight prediction position list, and the index values ​​of the target weight transformation rate in the target lookup table are all encoded into the bitstream of the current block.

[0317] For the decoding end, the decoding end constructs a weight prediction angle list, which is the same as the weight prediction angle list of the encoding end. The decoding end also constructs a weight prediction position list, which is the same as the weight prediction position list of the encoding end. Furthermore, the decoding end constructs a first lookup table and a second lookup table, where the first lookup table is the same as the first lookup table of the encoding end, and the second lookup table is the same as the second lookup table of the encoding end. After receiving the encoded bitstream of the current block, the decoding end parses the indication information from the encoded bitstream. Based on this indication information, it selects a weight prediction angle from the weight prediction angle list as the weight prediction angle of the current block, and selects a weight prediction position from the weight prediction position list as the weight prediction position of the current block. The method for obtaining the weight prediction angle and weight prediction position is described in Example 10 and will not be repeated here. After receiving the encoded bitstream of the current block, the decoding end can determine a target lookup table (such as the first lookup table or the second lookup table) and select a weight transformation rate from the target lookup table as the weight transformation rate of the current block based on the weight transformation rate index information. The method for obtaining the weight transformation rate is described in Example 11 and will not be repeated here.

[0318] Example 13: In Examples 1-3, the encoder / decoder needs to obtain a motion information candidate list, such as by obtaining at least one available motion information to be added to the motion information candidate list; and obtaining the motion information candidate list based on the at least one available motion information. For example, the at least one available motion information includes, but is not limited to, at least one of the following motion information: spatial motion information; temporal motion information; HMVP (History-based Motion Vector Prediction) motion information; and preset motion information.

[0319] For example, for spatial motion information, at least one available motion information to be added to the motion information candidate list can be obtained in the following way: for the spatial neighboring blocks of the current block, if the spatial neighboring blocks exist and the spatial neighboring blocks adopt the inter-frame prediction mode, then the motion information of the spatial neighboring blocks is determined as available motion information.

[0320] For example, for temporal motion information, at least one available motion information to be added to the motion information candidate list can be obtained in the following manner: based on the preset position of the current block (e.g., the top left pixel position of the current block), a temporal neighboring block corresponding to the preset position is selected from the reference frame of the current block, and the motion information of the temporal neighboring block is determined as available motion information.

[0321] For example, for preset motion information, at least one available motion information to be added to the motion information candidate list can be obtained in the following way: the preset motion information is determined as available motion information, and the preset motion information may include, but is not limited to: default motion information derived from the candidate motion information already existing in the motion information candidate list.

[0322] In one possible implementation, based on at least one available motion information, a motion information candidate list can be obtained in the following manner: For available motion information to be added to the motion information candidate list, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with the existing candidate motion information in the motion information candidate list, then the unidirectional motion information is added to the motion information candidate list; if the available motion information is bidirectional motion information, then the bidirectional motion information is trimmed into a first unidirectional motion information and a second unidirectional motion information; if the first unidirectional motion information does not overlap with the existing candidate motion information in the motion information candidate list, then the first unidirectional motion information is added to the motion information candidate list.

[0323] In the above embodiments, the first unidirectional motion information may be unidirectional motion information pointing to a reference frame in the first reference frame list; the second unidirectional motion information may be unidirectional motion information pointing to a reference frame in the second reference frame list.

[0324] In one possible implementation, List0 can be a forward reference frame list, and List1 can be a backward reference frame list.

[0325] In the above embodiments, the deduplication operation for unidirectional motion information and candidate motion information already existing in the motion information candidate list may include, but is not limited to: if the POC (display order) of the reference frame pointed to by the unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the unidirectional motion information and the candidate motion information are duplicated; otherwise, it is determined that the unidirectional motion information and the candidate motion information are not duplicated.

[0326] The deduplication operation for the first unidirectional motion information and the candidate motion information already existing in the motion information candidate list may include, but is not limited to: if the reference frame list pointed to by the first unidirectional motion information is the same as the reference frame list pointed to by the candidate motion information, and the refIdx of the first unidirectional motion information is the same as the refIdx of the candidate motion information, and the motion vector of the first unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the first unidirectional motion information and the candidate motion information are duplicated; otherwise, it is determined that the first unidirectional motion information and the candidate motion information are not duplicated. Alternatively, if the POC of the reference frame pointed to by the first unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the first unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the first unidirectional motion information and the candidate motion information are duplicated; otherwise, it is determined that the first unidirectional motion information and the candidate motion information are not duplicated.

[0327] The deduplication operation for the second unidirectional motion information and existing candidate motion information in the motion information candidate list may include, but is not limited to: if the reference frame list pointed to by the second unidirectional motion information is the same as the reference frame list pointed to by the candidate motion information, and the refIdx of the second unidirectional motion information is the same as the refIdx of the candidate motion information, and the motion vector of the second unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the second unidirectional motion information and the candidate motion information are duplicated; otherwise, it is determined that the second unidirectional motion information and the candidate motion information are not duplicated. Alternatively, if the POC of the reference frame pointed to by the second unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the second unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the second unidirectional motion information and the candidate motion information are duplicated; otherwise, it is determined that the second unidirectional motion information and the candidate motion information are not duplicated.

[0328] For example, the above process requires comparing whether the Point of Conversion (POC) of the reference frame pointed to by the unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information. It should be noted that the POC of the reference frame is only one example for confirming whether the reference frames are the same. Besides the POC, other attributes that can confirm whether the reference frames are the same can also be used, such as the DOC (Decoding Order Mark) of the reference frame, etc., without limitation. In summary, it is also possible to compare whether the DOC of the reference frame pointed to by the unidirectional motion information is the same as the DOC of the reference frame pointed to by the candidate motion information, and the implementation principle is similar to that of the POC implementation principle.

[0329] Example 14: Regarding Example 13, a candidate list of motion information can be obtained using spatial motion information (the motion information of spatially adjacent blocks of the current block is referred to as spatial motion information in this document) and / or temporal motion information (the motion information of temporally adjacent blocks of the current block is referred to as temporal motion information in this document). Therefore, it is necessary to first select usable motion information from the spatial motion information and / or temporal motion information. Referring to Figure 9A, which is a schematic diagram of the spatially adjacent blocks of the current block, the spatial motion information can be the motion information of spatially adjacent blocks such as F, G, C, A, B, and D, and the temporal motion information can be at least one.

[0330] For airspace motion information, the following methods can be used to obtain available motion information to be added to the motion information candidate list:

[0331] Method 11: Referring to Figure 9A, F, G, C, A, B, and D are the spatially adjacent blocks of the current block E. The "availability" of motion information for F, G, C, A, B, and D can be determined. For example, if F exists and uses inter-frame prediction mode, then the motion information of F is available motion information; otherwise, the motion information of F is unavailable motion information. If G exists and uses inter-frame prediction mode, then the motion information of G is available motion information; otherwise, the motion information of G is unavailable motion information. If C exists and uses inter-frame prediction mode, then the motion information of C is available motion information; otherwise, the motion information of C is unavailable motion information. If A exists and uses inter-frame prediction mode, then the motion information of A is available motion information; otherwise, the motion information of A is unavailable motion information. If B exists and uses inter-frame prediction mode, then the motion information of B is available motion information; otherwise, the motion information of B is unavailable motion information. If D exists and uses inter-frame prediction mode, then the motion information of D is available motion information; otherwise, the motion information of D is unavailable motion information.

[0332] Method 12: F, G, C, A, B, and D are spatially adjacent blocks of the current block E. Determine the "availability" of motion information for F, G, C, A, B, and D. If F exists and uses inter-frame prediction mode, then F's motion information is available; otherwise, F's motion information is unavailable. If G exists and uses inter-frame prediction mode, and G's motion information is different from F's, then G's motion information is available; otherwise, G's motion information is unavailable. If C exists and uses inter-frame prediction mode, and C's motion information is different from G's, then C's motion information is available; otherwise, C's motion information is unavailable. If A exists and uses inter-frame prediction mode, and A's motion information is different from F's, then A's motion information is available; otherwise, A's motion information is unavailable. If B exists and uses inter-frame prediction mode, and B's motion information is different from G's, then B's motion information is available; otherwise, B's motion information is unavailable. If D exists and uses inter-frame prediction mode, and the motion information of D is different from the motion information of A, and the motion information of D is different from the motion information of G, then the motion information of D is usable motion information; otherwise, the motion information of D is unusable motion information.

[0333] Method 13: F, G, C, A, B, and D are spatially adjacent blocks of the current block E. The "availability" of motion information for F, G, C, A, B, and D can be determined. For example, if F exists and uses inter-frame prediction mode, then the motion information of F is available motion information; otherwise, the motion information of F is unavailable motion information. If G exists and uses inter-frame prediction mode, and the motion information of G is different from the motion information of F, then the motion information of G is available motion information; otherwise, the motion information of G is unavailable motion information. If C exists and uses inter-frame prediction mode, and the motion information of C is different from the motion information of G, then the motion information of C is available motion information; otherwise, the motion information of C is unavailable motion information. If A exists and uses inter-frame prediction mode, and the motion information of A is different from the motion information of F, then the motion information of A is available motion information; otherwise, the motion information of A is unavailable motion information. If B exists and uses inter-frame prediction mode, then the motion information of B is available motion information; otherwise, the motion information of B is unavailable motion information. If D exists and uses inter-frame prediction mode, and the motion information of D is different from the motion information of A, and the motion information of D is different from the motion information of G, then the motion information of D is usable motion information; otherwise, the motion information of D is unusable motion information.

[0334] For example, in methods 12 and 13, when determining whether the motion information of adjacent blocks in the spatial domain is usable motion information, it may be necessary to compare whether the motion information of two adjacent blocks in the spatial domain is the same. For example, comparing whether the motion information of G is the same as the motion information of F. The process of comparing whether the motion information is the same is actually a motion information deduplication operation. If the deduplication result is duplicate, the motion information comparison result is the same; if the deduplication result is not duplicate, the motion information comparison result is different. For the motion information deduplication operation, please refer to the following embodiments, which will not be repeated here.

[0335] For time-domain motion information, the available motion information to be added to the motion information candidate list can be obtained in the following way:

[0336] Method 21: Based on the preset position of the current block, select the temporal neighboring block corresponding to the preset position from the reference frame of the current block, and determine the motion information of the temporal neighboring block as usable motion information. For example, if the current frame containing the current block is a B-frame, unidirectional or bidirectional motion information is derived from the co-located block of the co-located reference frame, and this unidirectional or bidirectional motion information is used as usable motion information. If the current frame is a P-frame, unidirectional motion information is derived from the co-located block of the co-located reference frame, and this unidirectional motion information is used as usable motion information.

[0337] For example, a co-located block is a temporally adjacent block in the co-located reference frame that corresponds to a preset position of the current block. The preset position of the current block can be configured empirically and is not limited, such as the top-left pixel position, top-right pixel position, bottom-left pixel position, bottom-right pixel position, or center pixel position of the current block. The co-located reference frame can be a preset reference frame, such as the first reference frame in List0 of the current block, or an exported reference frame, such as the reference frame in List0 of the current block that is closest to the current frame, or a reference frame parsed from the bitstream. For example, at the decoding end, the information of the co-located reference frame can be parsed from the bitstream to determine the co-located reference frame.

[0338] If the current frame containing the current block is a B-frame, then unidirectional motion information or bidirectional motion information is derived based on the motion information of the co-located block. If the current frame containing the current block is a P-frame, then unidirectional motion information is derived based on the motion information of the co-located block.

[0339] Method 22: Based on the weight prediction angle and weight prediction position of the current block, determine the target position of the current block; select the temporal neighboring block corresponding to the target position from the reference frame of the current block, and determine the motion information of the temporal neighboring block as usable motion information. For example, based on the weight prediction angle and weight prediction position of the current block, the target position of the current block can be determined, such as based on the index value of the weight prediction angle and weight prediction position of the current block. Then, based on the target position of the current block, the co-located block of the co-located reference frame can be determined. If the current frame containing the current block is a B-frame, unidirectional motion information or bidirectional motion information is derived from the co-located block of the co-located reference frame, and this unidirectional motion information or bidirectional motion information is used as usable motion information. If the current frame is a P-frame, unidirectional motion information is derived from the co-located block of the co-located reference frame, and this unidirectional motion information is used as usable motion information.

[0340] A co-located block is a temporally adjacent block in the co-located reference frame that corresponds to the target position of the current block. The target position can be the top-left pixel position, top-right pixel position, bottom-left pixel position, bottom-right pixel position, etc. of the current block.

[0341] For example, based on the weight prediction angle and weight prediction position of the current block, the weight matrix of the current block can be obtained, as shown in Figure 9B. Since the weight part on the upper right side accounts for a small proportion (black part), the spatial motion information has a low correlation with the black part. Therefore, the selection of temporal motion information can be biased towards the weight part on the upper right side to provide suitable candidate motion information. On this basis, the co-located block can be the temporal neighbor block corresponding to the upper right pixel position of the current block (i.e., the weight part with a small proportion). That is, the target position of the current block is the upper right pixel position of the current block.

[0342] Similarly, referring to Figure 9C, based on the weight prediction angle and weight prediction position of the current block, the target position of the current block can be determined as the lower right pixel position. Referring to Figure 9D, based on the weight prediction angle and weight prediction position of the current block, the target position of the current block can be determined as the lower left pixel position.

[0343] After obtaining available motion information, for each available motion information (such as spatial motion information, temporal motion information, etc.), one or a combination of the following methods can be used to add the available motion information to the motion information candidate list:

[0344] Method 31: No deduplication processing. For example, if the available motion information is unidirectional, then add that unidirectional motion information to the motion information candidate list. If the available motion information is bidirectional, then trim that bidirectional motion information into a first unidirectional motion information and a second unidirectional motion information, and add one of the trimmed unidirectional motion information to the motion information candidate list. For example, the first unidirectional motion information can be added to the motion information candidate list.

[0345] Method 32: Perform partial deduplication, i.e., do not deduplicate the other half of the bidirectional motion information. For example, if the available motion information is unidirectional, and the unidirectional motion information does not overlap with the existing candidate motion information in the motion information candidate list, then add the unidirectional motion information to the motion information candidate list. If the available motion information is bidirectional, then the bidirectional motion information is trimmed into a first unidirectional motion information and a second unidirectional motion information, and one of the unidirectional motion information is added to the motion information candidate list. For example, if the first unidirectional motion information in the bidirectional motion information does not overlap with the existing candidate motion information in the motion information candidate list, then add the first unidirectional motion information to the motion information candidate list.

[0346] Method 33: Perform full deduplication. For example, if the available motion information is unidirectional, and the unidirectional motion information does not overlap with any existing candidate motion information in the motion information candidate list, then add the unidirectional motion information to the motion information candidate list. If the available motion information is bidirectional, then the bidirectional motion information is trimmed into a first unidirectional motion information and a second unidirectional motion information, and one of the unidirectional motion information is added to the motion information candidate list. For example, if the first unidirectional motion information in the bidirectional motion information does not overlap with any existing candidate motion information in the motion information candidate list, then add the first unidirectional motion information to the motion information candidate list; if the first unidirectional motion information overlaps with any existing candidate motion information in the motion information candidate list, and the second unidirectional motion information in the bidirectional motion information does not overlap with any existing candidate motion information in the motion information candidate list, then add the second unidirectional motion information to the motion information candidate list.

[0347] In methods 31, 32, and 33, the first unidirectional motion information can be unidirectional motion information pointing to a reference frame in the first reference frame list; the second unidirectional motion information can be unidirectional motion information pointing to a reference frame in the second reference frame list.

[0348] For example, if the total number of candidate motion information already existing in the motion information candidate list (i.e., the total number of candidate motion information currently existing in the motion information candidate list when adding available motion information) is even, then the first reference frame list is List0, and the second reference frame list is List1; if the total number of candidate motion information already existing in the motion information candidate list is odd, then the first reference frame list is List1, and the second reference frame list is List0. Alternatively, if the total number of candidate motion information already existing in the motion information candidate list is odd, then the first reference frame list is List0, and the second reference frame list is List1; if the total number of candidate motion information already existing in the motion information candidate list is even, then the first reference frame list is List1, and the second reference frame list is List0. Alternatively, the first reference frame list is List0, and the second reference frame list is List1. Alternatively, the first reference frame list is List1, and the second reference frame list is List0.

[0349] In the above embodiments, a deduplication operation is performed on unidirectional motion information (such as unidirectional motion information, first unidirectional motion information, second unidirectional motion information, etc.) and on candidate motion information already existing in the motion information candidate list. The result of the deduplication operation can be either duplicated or not duplicated. The deduplication operation also involves performing a deduplication operation on the motion information of two spatially adjacent blocks, with the result also being either duplicated or not duplicated. In the subsequent embodiment 19, a deduplication operation is further performed on bidirectional motion information and on candidate motion information already existing in the motion information candidate list, with the result also being either duplicated or not duplicated.

[0350] For ease of description, the two motion information pieces used in the deduplication operation are referred to as motion information 1 and motion information 2. When motion information 1 is a unidirectional motion information to be deduplicated, motion information 2 is a candidate motion information already existing in the motion information candidate list. When motion information 1 is a bidirectional motion information to be deduplicated, motion information 2 is a candidate motion information already existing in the motion information candidate list. When motion information 1 is the motion information of a spatial adjacent block whose availability needs to be determined, motion information 2 is the motion information of a spatial adjacent block whose availability has been determined. See method 12. For example, if the motion information of F is available, when it is necessary to determine whether the motion information of G is available, motion information 1 is the motion information of G, and motion information 2 is the motion information of F.

[0351] This plagiarism check can be performed in the following way:

[0352] Method 41: Perform deduplication based on List + refIdx + MV_x + MV_y. For example, first check if the Lists they point to are the same (i.e., whether they point to List0, List1, or both), then check if refIdx is the same, and then check if MV is the same (i.e., whether the horizontal components are the same and the vertical components are the same).

[0353] For example, first, it checks whether the reference frame list pointed to by motion information 1 is the same as the reference frame list pointed to by motion information 2. If they are different, then motion information 1 and motion information 2 are not duplicates. If they are the same, it checks whether the refIdx of motion information 1 is the same as the refIdx of motion information 2. If they are different, then motion information 1 and motion information 2 are not duplicates. If they are the same, it checks whether the motion vector of motion information 1 is the same as the motion vector of motion information 2. If not, then motion information 1 and motion information 2 are not duplicates; if they are, then it is determined that motion information 1 and motion information 2 are duplicates.

[0354] For example, if the reference frame list pointed to by motion information 1 and the reference frame list pointed to by motion information 2 are both List0, then they are the same; or, if the reference frame list pointed to by motion information 1 and the reference frame list pointed to by motion information 2 are both List1, then they are the same; or, if the reference frame list pointed to by motion information 1 is List0 and the reference frame list pointed to by motion information 2 is List1, then they are different; or, if the reference frame list pointed to by motion information 1 is List1 and the reference frame list pointed to by motion information 2 is List0, then they are different; or, if the reference frame list pointed to by motion information 1 is List0 and the reference frame list pointed to by motion information 2 is List0 and... If List1 is the reference frame list, then the two are different. Alternatively, if motion information 1 points to List1, and motion information 2 points to both List0 and List1, then the two are different. Or, if reference frame index refIdx0 in reference frame list List0, which is pointed to by motion information 1, points to reference frame index refIdx1 in List1, and motion information 2 points to reference frame index refIdx2 in List0, which points to reference frame index refIdx3 in List1, then refIdx0 is not equal to refIdx2, or refIdx1 is not equal to refIdx3, then the two are different. Of course, the above are just a few examples of comparing reference frame lists, and no restrictions are imposed on this.

[0355] For example, if the horizontal component of the motion vector of motion information 1 is the same as the horizontal component of the motion vector of motion information 2, and the vertical component of the motion vector of motion information 1 is the same as the vertical component of the motion vector of motion information 2, then it means that the motion vector of motion information 1 is the same as the motion vector of motion information 2.

[0356] Method 42: Perform deduplication based on POC+MV_x+MV_y.

[0357] For example, first check if the POC of the reference frames they point to is the same (that is, if the POC of the reference frame with reference frame index refIdx0 in List0 is equal to the POC of the reference frame with reference frame index refIdx1 in List1, it is also determined to be the same. This applies to the deduplication of unidirectional motion information and the deduplication of bidirectional motion information); then check if the MV is the same (that is, whether the horizontal component is the same and whether the vertical component is the same).

[0358] For example, first check if the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. If they are different, then motion information 1 and motion information 2 are not duplicates. If they are the same, then continue to check if the motion vector of motion information 1 is the same as the motion vector of motion information 2. If they are different, then motion information 1 and motion information 2 are not duplicates. If they are the same, then it is determined that motion information 1 and motion information 2 are duplicates.

[0359] For example, the reference frames pointing to the same POC can include: Motion information 1 pointing to the reference frame with reference frame index refIdx0 in List0, and motion information 2 pointing to the reference frame with reference frame index refIdx0 in List0, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Alternatively, motion information 1 pointing to the reference frame with reference frame index refIdx1 in List1, and motion information 2 pointing to the reference frame with reference frame index refIdx1 in List1, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Alternatively, motion information 1 pointing to the reference frame with reference frame index refIdx0 in List0, and motion information 2 pointing to the reference frame with reference frame index refIdx1 in List1, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Alternatively, motion information 1 points to the reference frame with reference frame index refIdx1 in List1, and motion information 2 points to the reference frame with reference frame index refIdx0 in List0, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Alternatively, motion information 1 points to the reference frame with reference frame index refIdx0 in List0, and then points to the reference frame with reference frame index refIdx1 in List1, while motion information 2 points to the reference frame with reference frame index refIdx2 in List0, and then points to the reference frame with reference frame index refIdx3 in List1, and the POC of the reference frame with reference frame index refIdx0 in List0 pointed to by motion information 1 is the same as the POC of the reference frame with reference frame index refIdx3 in List1 pointed to by motion information 2, and the POC of the reference frame with reference frame index refIdx1 in List1 pointed to by motion information 1 is the same as the POC of the reference frame with reference frame index refIdx2 in List0 pointed to by motion information 2. Of course, the above are just a few examples of POCs with the same reference frame, and there are no limitations on this.

[0360] For example, the above process checks the POC of the reference frame for duplicates. It's important to note that the POC of the reference frame is just one example of the duplicate checking operation. Besides the POC, other attributes that can confirm whether reference frames are identical can be used, such as the DOC of the reference frame, etc. There are no restrictions on this. In summary, the POC mentioned above can be replaced with DOC.

[0361] In summary, a candidate list of motion information can be obtained, which can also be called AwpUniArray. The following section explains the process of obtaining this candidate list using several specific application scenarios. In subsequent application scenarios, assume the length of the candidate list is X, meaning X available motion information items need to be added. After adding the available motion information to the candidate list, the added motion information is referred to as candidate motion information.

[0362] Application Scenario 1: Add spatial motion information to the motion information candidate list. If the list length is equal to X, the addition process ends. If the list length is less than X, add the preset motion information to the motion information candidate list until the list length is X.

[0363] For example, first determine the available motion information (i.e., spatial motion information) to be added to the motion information candidate list. For instance, determine the available motion information using method 11, method 12, or method 13. When determining available motion information using method 12 or method 13, the deduplication operation involving motion information of two spatially adjacent blocks can be performed using method 41 or method 42.

[0364] For example, referring to Figure 9A, the available motion information is added to the motion information candidate list in the order of F, G, C, A, B, and D (this order is variable). For each piece of available motion information, it can be added to the motion information candidate list using method 31, method 32, or method 33.

[0365] For example, when adding the available motion information to the motion information candidate list using method 32 or method 33, a deduplication operation can also be performed between the unidirectional motion information and the existing candidate motion information in the motion information candidate list. For example, a deduplication operation can be performed using method 41 or method 42.

[0366] Application Scenario 2: Add time-domain motion information to the motion information candidate list. If the list length is equal to X, the addition process ends. If the list length is less than X, add the preset motion information to the motion information candidate list until the list length is X.

[0367] For example, first determine the available motion information (i.e., domain motion information) to be added to the motion information candidate list. For instance, determine the available motion information using method 21, or determine the available motion information using method 22.

[0368] For example, for each available motion information, the available motion information can be added to the motion information candidate list in method 31, method 32, or method 33.

[0369] For example, when adding the available motion information to the motion information candidate list using method 32 or method 33, a deduplication operation can also be performed between the unidirectional motion information and the existing candidate motion information in the motion information candidate list. For example, a deduplication operation can be performed using method 41 or method 42.

[0370] Application Scenario 3: Add spatial motion information and temporal motion information together to the motion information candidate list (spatial motion information can be placed before temporal motion information, and temporal motion information can also be placed before spatial motion information. For ease of description, we will take spatial motion information being placed before temporal motion information as an example below). If the list length is equal to X, the addition process ends. If the list length is less than X, add the preset motion information to the motion information candidate list until the list length is X.

[0371] For example, the available motion information (i.e., spatial motion information and temporal motion information) to be added to the motion information candidate list is determined. For instance, methods 11 and 21, or methods 11 and 22, or methods 12 and 21, or methods 12 and 22, or methods 13 and 21, or methods 13 and 22 are used to determine available motion information. Of course, these are just a few examples and are not intended to be limiting.

[0372] When determining available motion information using method 12 or method 13, the deduplication operation involving motion information of two adjacent blocks in the spatial domain can be performed using method 41 or method 42.

[0373] For example, the available motion information is added to the motion information candidate list in the order of available motion information in F, G, C, A, B, and D, and in the order of time-domain motion information (i.e., available motion information). For each piece of available motion information, the available motion information is added to the motion information candidate list using method 31, method 32, or method 33.

[0374] For example, when adding the available motion information to the motion information candidate list using method 32 or method 33, a deduplication operation can also be performed between the unidirectional motion information and the existing candidate motion information in the motion information candidate list. For example, a deduplication operation can be performed using method 41 or method 42.

[0375] In summary, based on the order of spatial motion information and temporal motion information, spatial motion information and temporal motion information can be added together to the motion information candidate list until the list length is equal to X, or, after the traversal ends and the list length is less than X, the preset motion information is added to the motion information candidate list until the list length is X.

[0376] Application Scenario 4: After adding spatial motion information to the motion information candidate list, reserve at least Y positions for temporal motion information, which can be bidirectional or unidirectional. For example, when adding spatial motion information to the motion information candidate list, if the list length is equal to XY, the process ends, or continues until the spatial motion information is traversed to its final length and the list length is less than XY. Then, when adding temporal motion information to the motion information candidate list, if the list length is equal to X, the process ends, or continues until the temporal motion information is traversed to its final length and the list length is less than X. Preset motion information is then added to the motion information candidate list until the list length reaches X.

[0377] For example, the available motion information (i.e., spatial motion information and temporal motion information) to be added to the motion information candidate list is determined. For instance, methods 11 and 21, or methods 11 and 22, or methods 12 and 21, or methods 12 and 22, or methods 13 and 21, or methods 13 and 22 are used to determine available motion information. Of course, these are just a few examples and are not intended to be limiting.

[0378] When determining available motion information using method 12 or method 13, the deduplication operation involving motion information of two adjacent blocks in the spatial domain can be performed using method 41 or method 42.

[0379] For example, in the order of available motion information (i.e., spatial motion information) in F, G, C, A, B, and D, available motion information is added to the motion information candidate list until the list length equals XY, or the spatial motion information traversal ends. Then, temporal motion information (i.e., available motion information) is added to the motion information candidate list until the list length equals X, or the temporal motion information traversal ends. During the process of adding available motion information, for each piece of available motion information, method 31, method 32, or method 33 are used to add the available motion information to the motion information candidate list.

[0380] For example, when adding the available motion information to the motion information candidate list using method 32 or method 33, a deduplication operation can also be performed between the unidirectional motion information and the existing candidate motion information in the motion information candidate list. For example, a deduplication operation can be performed using method 41 or method 42.

[0381] In the above application scenarios, X can take any positive integer value. For example, X can take the value 4, 5, etc.

[0382] In all the above application scenarios, preset motion information (also known as default motion information) may be added to the motion information candidate list. The implementation methods for preset motion information may include, but are not limited to, the following:

[0383] Method 51: Preset motion information to zero motion information, such as a zero motion vector pointing to ListX where refIdx is less than the number of reference frames in ListX. For example, zero padding can be performed, so the motion information can be (0,0,ref_idx3,ListZ).

[0384] Method 52: Default motion information derived from existing candidate motion information in the motion information candidate list.

[0385] For example, let temp_val be the absolute value of the x-axis or y-axis direction that needs to be enlarged or reduced, and the result be result:

[0386] 1. If temp_val < 8, then result = 8, or result = -8.

[0387] For example, if the temp_val in the x-axis direction of the candidate motion information is less than 8, then the motion vector in the x-axis direction of the default motion information is 8, or the motion vector in the x-axis direction of the default motion information is -8.

[0388] If the temp_val in the y-axis direction of the candidate motion information is less than 8, then the motion vector in the y-axis direction of the default motion information is 8, or the motion vector in the y-axis direction of the default motion information is -8.

[0389] 2. Assuming that condition 1 is not met, if temp_val <= 64, then result = (temp_val * 5 + 2) >> 2, or result = (temp_val * 3 + 2) >> 2, with the sign being the same as the sign of the motion vector of the candidate motion information.

[0390] For example, if the motion vector in the x-axis direction of the candidate motion information is positive and the absolute value of the motion vector in the x-axis direction (i.e., temp_val) is less than or equal to 64, then the motion vector in the x-axis direction of the default motion information is (temp_val*5+2)>>2. If the motion vector in the x-axis direction of the candidate motion information is negative and the absolute value of the motion vector in the x-axis direction (i.e., temp_val) is less than or equal to 64, then the motion vector in the x-axis direction of the default motion information is result=(temp_val*3+2)>>2.

[0391] The motion vector along the y-axis for the default motion information is similar to the motion vector along the x-axis.

[0392] 3. Assuming that conditions 1 and 2 are not met, if temp_val <= 128, then result = (temp_val * 9 + 4) >> 3, or result = (temp_val * 7 + 4) >> 3, with the sign being the same as the sign of the motion vector of the candidate motion information.

[0393] 4. If 1, 2, and 3 are not satisfied, then result = (temp_val*33+16)>>5, or result = (temp_val*31+16)>>5, and the sign is the same as the sign of the motion vector of the candidate motion information.

[0394] Method 53: Default motion information derived from existing candidate motion information in the motion information candidate list.

[0395] For example, based on any valid candidate motion information (x, y, ref_idx, ListX) in the candidate list of motion information, where ref_idx and ListX are the reference frame index and the reference frame list, respectively, and both are collectively referred to as reference frame information, at least one of the following motion information can be added: (x+a, y+b, ref_idx, ListX), where a and b can be any integer; (k1*x, k1*y, ref_idx_new1, ListX), where k1 is any non-zero positive integer, i.e., scaling operation is performed on the motion vector; (k2*x, k2*y, ref_idx_new2, ListY), where k2 is any non-zero positive integer, i.e., scaling operation is performed on the motion vector.

[0396] Method 54: The preset motion information is the candidate motion information that already exists in the motion information candidate list. That is, an expansion (padding) operation is performed, which can use the candidate motion information that already exists in the motion information candidate list to repeatedly fill the information. For example, the last unidirectional motion information that already exists in the motion information candidate list can be used to repeatedly fill the information.

[0397] In summary, when the list length is less than X and preset motion information needs to be added to the motion information candidate list, the preset motion information of method 51 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of method 52 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of method 53 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of methods 51 and 52 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of methods 51 and 53 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of methods 52 and 53 can be added to the motion information candidate list until the list length is X. Alternatively, the preset motion information of methods 51, 52, and 53 can be added to the motion information candidate list until the list length is X.

[0398] For example, after adding the preset motion information to the motion information candidate list in the above manner, if the list length is still less than X, the preset motion information in method 54 can be added to the motion information candidate list. That is, the existing candidate motion information in the motion information candidate list is used to repeatedly fill the list until the list length is X.

[0399] In another possible implementation, when the list length is less than X and it is necessary to add the preset motion information to the motion information candidate list, the preset motion information of method 54 can be directly added to the motion information candidate list. That is, the existing candidate motion information in the motion information candidate list is used to repeatedly fill the list until the list length is X.

[0400] In the above embodiments, the preset motion information can be unidirectional or bidirectional. If the preset motion information is unidirectional, a deduplication operation can be performed or not when adding the preset motion information to the motion information candidate list. If no deduplication operation is performed, the preset motion information is directly added to the motion information candidate list. If a deduplication operation is performed, either method 41 or method 42 can be used. If the result of the deduplication operation is that the preset motion information is not duplicated, it is added to the motion information candidate list. If the result of the deduplication operation is that the preset motion information is duplicated, it is not added to the motion information candidate list.

[0401] Example 15: In Examples 1-3, after obtaining the motion information candidate list (see Examples 13 and 14), the encoder / decoder can obtain the first target motion information and the second target motion information of the current block based on the motion information candidate list. The method for obtaining the first target motion information and the second target motion information can be implemented as follows:

[0402] Method 1: Select one candidate motion information from the motion information candidate list as the first target motion information of the current block, and select another candidate motion information from the motion information candidate list as the second target motion information of the current block.

[0403] For example, both the encoding and decoding ends can obtain a motion information candidate list, and the motion information candidate list of the encoding end is the same as that of the decoding end. There are no restrictions on this motion information candidate list.

[0404] For the encoding end, based on the rate-distortion principle, a candidate motion information can be selected from the motion information candidate list as the first target motion information of the current block, and another candidate motion information can be selected from the motion information candidate list as the second target motion information of the current block. The first target motion information and the second target motion information are different, and there is no restriction on this.

[0405] In one possible implementation, when the encoding end sends the encoded bitstream to the decoding end, the encoded bitstream may carry indication information a and indication information b. Indication information a indicates the index value 1 of the first target motion information in the current block, where index value 1 indicates which candidate motion information the first target motion information is in the motion information candidate list. Indication information b indicates the index value 2 of the second target motion information in the current block, where index value 2 indicates which candidate motion information the second target motion information is in the motion information candidate list. For example, index value 1 and index value 2 may be different.

[0406] After receiving the encoded bitstream, the decoding end parses out indication information 'a' and indication information 'b' from the encoded bitstream. Based on indication information 'a', the decoding end selects the candidate motion information corresponding to index value 1 from the motion information candidate list, and this candidate motion information is used as the first target motion information of the current block. Based on indication information 'b', the decoding end selects the candidate motion information corresponding to index value 2 from the motion information candidate list, and this candidate motion information is used as the second target motion information of the current block.

[0407] In another possible implementation, when the encoding end sends the encoded bitstream to the decoding end, the encoded bitstream may carry indication information 'a' and indication information 'c'. Indication information 'a' can be used to indicate the index value 1 of the first target motion information in the current block, where index value 1 indicates which candidate motion information the first target motion information is in the motion information candidate list. Indication information 'c' can be used to indicate the difference between index value 2 and index value 1, where index value 2 indicates which candidate motion information the second target motion information is in the motion information candidate list. For example, index value 1 and index value 2 may be different.

[0408] After receiving the encoded bitstream, the decoding end can parse indication information 'a' and indication information 'c' from it. Based on indication information 'a', the decoding end can select the candidate motion information corresponding to index value 1 from the motion information candidate list, and this candidate motion information is used as the first target motion information of the current block. Based on indication information 'c', the decoding end first determines index value 2 based on the difference between index value 2 and index value 1, and then the decoding end can select the candidate motion information corresponding to index value 2 from the motion information candidate list, and this candidate motion information is used as the second target motion information of the current block.

[0409] For example, the indication information of the first target motion information and the indication information of the second target motion information can be interchanged, as long as the encoding and decoding ends are consistent. This interchange of indication information does not affect the parsing process; that is, there is no parsing dependency. The indication information of the first target motion information and the indication information of the second target motion information cannot be equal. Assuming two index values ​​are encoded, index value a is 1 and index value b is 3. If index value a is encoded first, index value b can be encoded as 2 (i.e., 3-1). If index value b is encoded first, then index value b needs to be encoded as 3. In summary, encoding the indication information with the smaller index value first can reduce the encoding cost of the larger index value. For example, the indication information of the first target motion information, such as index value a, can be encoded first, followed by the indication information of the second target motion information, such as index value b. Alternatively, the indication information of the second target motion information, such as index value b, can be encoded first, followed by the indication information of the first target motion information, such as index value a. For example, assuming index value a is 1 and index value b is 3, then index value a can be encoded first, followed by index value b. For example, if the index value b is 1 and the index value a is 3, then the index value b is encoded first, and the index value a is encoded later.

[0410] Method 2: Select candidate motion information from the motion information candidate list as the first original motion information of the current block, and select candidate motion information from the motion information candidate list as the second original motion information of the current block. For example, the first original motion information and the second original motion information can be different, i.e., two different candidate motion information are selected from the motion information candidate list as the first and second original motion information; or, the first original motion information and the second original motion information can be the same, i.e., the same candidate motion information is selected from the motion information candidate list as the first and second original motion information. Then, determine the first target motion information of the current block based on the first original motion information, and determine the second target motion information of the current block based on the second original motion information. For example, the first target motion information and the second target motion information can be different.

[0411] Regarding how to determine target motion information based on original motion information, this embodiment provides a scheme of angular weighted prediction with motion vector refinement (AWP_MVR) for superimposed unidirectional motion information. For example, 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, the first motion vector difference (i.e., MVD) corresponding to the first original motion vector can be obtained; the first target motion vector is determined based on the first motion vector difference and the first original motion vector (i.e., the sum of the first motion vector difference and the first original motion vector is used as the first target motion vector). The second motion vector difference corresponding to the second original motion vector can be obtained; the second target motion vector is determined based on the second motion vector difference and the second original motion vector (i.e., the sum of the second motion vector difference and the second original motion vector is used as the second target motion vector).

[0412] For example, when determining the first target motion vector, the first motion vector difference may not be superimposed; that is, the first original motion vector may be determined as the first target motion vector. However, when determining the second target motion vector, the second motion vector difference may be superimposed; that is, the second target motion vector may be determined based on the second motion vector difference and the second original motion vector. Or,

[0413] When determining the second target motion vector, the second motion vector difference can be omitted, meaning the second original motion vector can be used as the second target motion vector. However, when determining the first target motion vector, the first motion vector difference can be added, meaning the first target motion vector is determined based on the first motion vector difference and the first original motion vector. Alternatively,

[0414] To determine the motion vector of the first target, the first motion vector difference can be superimposed; that is, the first target motion vector is determined based on the first motion vector difference and the first original motion vector. Similarly, to determine the motion vector of the second target, the second motion vector difference can be superimposed; that is, the second target motion vector is determined based on the second motion vector difference and the second original motion vector.

[0415] For example, the direction and amplitude information of a first motion vector difference can be obtained, and the first motion vector difference can be determined based on the direction and amplitude information of the first motion vector difference. Similarly, the direction and amplitude information of a second motion vector difference can be obtained, and the second motion vector difference can be determined based on the direction and amplitude information of the second motion vector difference.

[0416] For example, the decoding end can obtain the direction information of the first motion vector difference in the following ways: the decoding end parses the direction information of the first motion vector difference from the encoded bitstream of the current block; or, the decoding end derives the direction information of the first motion vector difference based on the weight prediction angle of the current block. Similarly, the decoding end can obtain the direction information of the second motion vector difference in the following ways: the decoding end parses the direction information of the second motion vector difference from the encoded bitstream of the current block; or, the decoding end derives the direction information of the second motion vector difference based on the weight prediction angle of the current block.

[0417] For example, for the decoding end, the amplitude information of the first motion vector difference can be obtained as follows: the amplitude information of the first motion vector difference is parsed from the encoded bitstream of the current block. The amplitude information of the second motion vector difference can be obtained as follows: the amplitude information of the second motion vector difference is parsed from the encoded bitstream of the current block.

[0418] In one possible implementation, the encoder and decoder can agree on the direction and magnitude information of the motion vector difference. If the direction information indicates a rightward direction and the magnitude information indicates an amplitude of A, then the motion vector difference is (A, 0); if the direction information indicates a downward direction and the magnitude information indicates an amplitude of A, then the motion vector difference is (0, -A); if the direction information indicates a leftward direction and the magnitude information indicates an amplitude of A, then the motion vector difference is (-A, 0); if the direction information indicates an upward direction and the magnitude information indicates an amplitude of A, then the motion vector difference is (-A, 0); if the direction information indicates an upward direction and the magnitude information indicates an upward direction ... If the value is A, then the motion vector difference is (0, A); if the direction information indicates the direction is upward to the right and the amplitude information indicates the amplitude is A, then the motion vector difference is (A, A); if the direction information indicates the direction is upward to the left and the amplitude information indicates the amplitude is A, then the motion vector difference is (-A, A); if the direction information indicates the direction is downward to the left and the amplitude information indicates the amplitude is A, then the motion vector difference is (-A, -A); if the direction information indicates the direction is downward to the right and the amplitude information indicates the amplitude is A, then the motion vector difference is (A, -A). Of course, the above are just a few examples, and there are no restrictions on the direction and amplitude information.

[0419] For example, the motion vector difference can support some or all of the above direction information. The range of values ​​for the amplitude A supported by the motion vector difference is configured empirically, with at least one value, and is not limited in this regard. For instance, if the motion vector difference supports directions such as up, down, left, and right, it supports the following five step size configurations: 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 4-pel, which means the amplitude A can be 1, 2, 4, 8, or 16. In summary, when the direction is upward, the motion vector difference can be (0, 1), (0, 2), (0, 4), (0, 8), or (0, 16). When the direction is downward, the motion vector difference can be (0, -1), (0, -2), (0, -4), (0, -8), or (0, -16). When the direction is to the left, the motion vector difference can be (-1, 0), (-2, 0), (-4, 0), (-8, 0), (-16, 0). When the direction is to the right, the motion vector difference can be (1, 0), (2, 0), (4, 0), (8, 0), (16, 0).

[0420] For example, motion vector difference supports directions such as up, down, left, and right, and the motion vector difference supports the following 6 step size configurations: 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, 4-pel, that is, the amplitude A can take the values ​​of 1, 2, 4, 8, 12, and 16.

[0421] For example, the motion vector difference supports eight directions: up, down, left, right, upper left, lower left, upper right, and lower right. The motion vector difference supports the following three step size configurations: 1 / 4-pel, 1 / 2-pel, and 1-pel, meaning that the amplitude A can be 1, 2, or 4.

[0422] For example, the motion vector difference supports four directions: up, down, left, and right. The motion vector difference supports the following four step size configurations: 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, meaning that the amplitude A can be 1, 2, 4, or 8.

[0423] Of course, the above are just a few examples and are not intended to be restrictive. For example, the directions supported by motion vector difference can be arbitrarily selected, such as supporting six directions: up, down, left, right, upper left, and lower left, or only two directions: up and down. Another example is that the step size configuration supported by motion vector difference is variable and can be flexibly configured. Yet another example is that the step size configuration can be adaptively configured based on encoding parameters such as quantization parameters (QP), such as using 1-pel, 2-pel, 4-pel, and 8-pel for larger QPs and 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel for smaller QPs. Furthermore, appropriate step size configurations can be configured at the sequence level, image level, frame level, slice level, tile level, patch level, and CTU level, allowing the decoder to perform decoding operations based on the step size configuration parsed at these levels.

[0424] For ease of description, in the following embodiments, it is assumed that the motion vector difference supports the up and down directions and supports step size configurations such as 1-pel and 2-pel. If described with 1 / 4-pel precision, the motion vector difference can be (0, 4), (0, 8), (0, -4), (0, -8), that is, (0, 1<<2), (0, 1<<3), (0, -1<<2), (0, -1<<3).

[0425] For the encoding end, after obtaining the candidate list of motion information, each candidate motion information combination in the list is traversed sequentially. Each candidate motion information combination includes two candidate motion information pieces: one as the first original motion information and the other as the second original motion information. It's important to note that the first and second original motion information pieces can be the same (i.e., the two candidate motion information pieces selected from the motion information candidate list are the same) or different. If the first and second original motion information pieces are the same, different motion vector differences can be superimposed to ensure that the first and second target motion information pieces are different. For each candidate motion information combination, the motion vector difference combination is traversed sequentially. This motion vector difference combination includes a first motion vector difference and a second motion vector difference, which can be the same or different. For example, there are two motion vector differences, namely motion vector difference 1 and motion vector difference 2. Motion vector difference combination 1 is motion vector difference 1 and motion vector difference 1. Motion vector difference combination 2 is motion vector difference 1 (i.e. the first motion vector difference) and motion vector difference 2. Motion vector difference combination 3 is motion vector difference 2 (i.e. the first motion vector difference) and motion vector difference 1. Motion vector difference combination 4 is motion vector difference 2 and motion vector difference 2.

[0426] For example, for the currently traversed candidate motion information combination and motion vector difference combination, if the first original motion information is different from the second original motion information, then the first motion vector difference and the second motion vector difference can be the same or different. If the first original motion information is the same as the second original motion information, then the first motion vector difference and the second motion vector difference can be different.

[0427] For the currently traversed candidate motion information combinations and motion vector difference combinations, the sum of the motion vector of the first original motion information and the first motion vector difference is taken as the first target motion vector, and the sum of the motion vector of the second original motion information and the second motion vector difference is taken as the second target motion vector. Rate-distortion cost is determined based on the first and second target motion vectors, without any restrictions on the determination method. This process is repeated for each candidate motion information combination and each motion vector difference combination to obtain the rate-distortion cost. Then, the minimum rate-distortion cost is selected from all rate-distortion costs. The information of the candidate motion information combination (first original motion information and second original motion information) and the information of the motion vector difference combination (first motion vector difference and second motion vector difference) corresponding to the minimum rate-distortion cost are encoded in the encoded bitstream of the current block.

[0428] For example, in the encoded bitstream of the current block, the index value of the first original motion information corresponding to the minimum rate distortion cost in the motion information candidate list, the index value of the second original motion information corresponding to the minimum rate distortion cost in the motion information candidate list, the direction and amplitude information of the first motion vector difference corresponding to the minimum rate distortion cost, and the direction and amplitude information of the second motion vector difference corresponding to the minimum rate distortion cost are encoded. For example, for the direction information of the first or second motion vector difference, the indication information of the direction information can be 0, indicating the first direction in the direction list. For the amplitude information of the first or second motion vector difference, the indication information of the amplitude information can be 0, indicating the first step size configuration in the step size configuration list.

[0429] For example, if the motion vector difference supports four directions (up, down, left, and right) and five step size configurations (1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel), then the direction information of the motion vector difference can be encoded using a 2-bin fixed-length code (four value classes). The four values ​​of the 2-bin fixed-length code represent the four directions (up, down, left, and right). The amplitude information of the motion vector difference can be encoded using a truncated unary code, that is, the five step size configurations are represented by truncated unary codes.

[0430] For example, if the motion vector difference supports four directions (up, down, left, and right) and six step size configurations (1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, 4-pel), then the direction information of the motion vector difference can be encoded using a 2-bin fixed-length code (four types of values), and the amplitude information of the motion vector difference can be encoded using a truncated unary code.

[0431] For example, if the motion vector difference supports eight directions (up, down, left, right, upper left, lower left, upper right, and lower right) and supports three step size configurations (1 / 4-pel, 1 / 2-pel, and 1-pel), then the direction information of the motion vector difference can be encoded using a 3-bin fixed-length code (a total of 8 values), and the amplitude information of the motion vector difference can be encoded using a truncated unary code.

[0432] For example, if the motion vector difference supports four directions (up, down, left, and right) and supports four step size configurations (1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel), then the direction information of the motion vector difference can be encoded using truncated unary codes, and the amplitude information of the motion vector difference can be encoded using 2bin fixed-length codes (four types of values).

[0433] Of course, the above are just a few examples of encoding methods, and no restrictions are placed on this encoding method.

[0434] In summary, from the encoding perspective, the optimal motion vector (i.e., the target motion vector) can be searched within a certain area. The difference between the optimal motion vector and the original motion vector is then used as the motion vector difference (MVD), and the magnitude and direction information of the motion vector difference are encoded into the bitstream. When searching for the optimal motion vector within a certain area, the encoding end needs to define the direction and magnitude of the motion vector difference. That is, the optimal motion vector is searched within the defined range of motion vector differences such as (A, 0), (0, -A), (-A, 0), (0, A), (A, A), (-A, A), (-A, -A), and (A, -A).

[0435] For the decoding end, after receiving the encoded bitstream of the current block, it can parse the index value of the first original motion information in the motion information candidate list from the encoded bitstream, and select the candidate motion information corresponding to that index value from the motion information candidate list, using that candidate motion information as the first original motion information of the current block. Similarly, the decoding end can parse the index value of the second original motion information in the motion information candidate list from the encoded bitstream, and select the candidate motion information corresponding to that index value from the motion information candidate list, using that candidate motion information as the second original motion information of the current block.

[0436] The decoding end can also parse the direction and amplitude information of the first motion vector difference from the encoded bitstream, and determine the first motion vector difference based on the direction and amplitude information. Furthermore, it can parse the direction and amplitude information of the second motion vector difference from the encoded bitstream, and determine the second motion vector difference based on the direction and amplitude information.

[0437] Then, the decoding end can determine the first target motion information of the current block based on the first motion vector difference and the first original motion information, and determine the second target motion information of the current block based on the second motion vector difference and the second original motion information.

[0438] For example, when determining the first motion vector difference based on the direction information and the magnitude information of the first motion vector difference, if the direction information of the first motion vector difference indicates a rightward direction and the magnitude information of the first motion vector difference indicates an amplitude of A, then the first motion vector difference is (A, 0); if the direction information of the first motion vector difference indicates a downward direction and the magnitude information of the first motion vector difference indicates an amplitude of A, then the first motion vector difference is (0, -A); if the direction information of the first motion vector difference indicates a leftward direction and the magnitude information of the first motion vector difference indicates an amplitude of A, then the first motion vector difference is (-A, 0); if the direction information of the first motion vector difference indicates an upward direction and the magnitude information of the first motion vector difference indicates an amplitude of A, then the first motion vector difference is (0, A). When determining the second motion vector difference based on its direction and magnitude, if the direction of the second motion vector difference indicates a rightward direction and the magnitude of the second motion vector difference indicates an amplitude of A, then the second motion vector difference is (A, 0); if the direction of the second motion vector difference indicates a downward direction and the magnitude of the second motion vector difference indicates an amplitude of A, then the second motion vector difference is (0, -A); if the direction of the second motion vector difference indicates a leftward direction and the magnitude of the second motion vector difference indicates an amplitude of A, then the second motion vector difference is (-A, 0); if the direction of the second motion vector difference indicates an upward direction and the magnitude of the second motion vector difference indicates an amplitude of A, then the second motion vector difference is (0, A).

[0439] Referring to the above embodiments, when the encoding end encodes the direction information of the motion vector difference, it can use fixed-length code, truncated unary code, etc. Therefore, the decoding end can use fixed-length code, truncated unary code, etc. to decode the direction information of the motion vector difference to obtain the direction information of the motion vector difference, such as up, down, left, right, upper left, lower left, upper right, lower right, etc.

[0440] Referring to the above embodiments, when encoding the amplitude information of the motion vector difference, the encoding end can use fixed-length code, truncated unary code, or other methods. Therefore, the decoding end can use fixed-length code, truncated unary code, or other methods to decode the amplitude information of the motion vector difference, and obtain the amplitude information of the motion vector difference, such as step size configurations of 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc. Then, the value of the amplitude A of the motion vector difference is determined according to the step size configurations of 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc.

[0441] In one possible implementation, the encoder may further encode a first sub-mode flag and a second sub-mode flag in the encoded bitstream to enhance the angle-weighted prediction mode. The first sub-mode flag indicates that a motion vector difference is superimposed on the first original motion information, or that a motion vector difference is not superimposed on the first original motion information. The second sub-mode flag indicates that a motion vector difference is superimposed on the second original motion information, or that a motion vector difference is not superimposed on the second original motion information.

[0442] After receiving the encoded bitstream of the current block, the decoder can first parse out the first sub-mode flag and the second sub-mode flag of the enhanced angle-weighted prediction mode from the encoded bitstream of the current block. If the first sub-mode flag indicates that a motion vector difference is superimposed on the first original motion information, then the direction information and amplitude information of the first motion vector difference are parsed from the encoded bitstream of the current block, and the first motion vector difference is determined based on the direction information and amplitude information. Then, the first target motion information of the current block is determined based on the first original motion information and the first motion vector difference. If the first sub-mode flag indicates that a motion vector difference is not superimposed on the first original motion information, then the direction information and amplitude information of the first motion vector difference are not parsed, and the first original motion information can be directly used as the first target motion information of the current block. If the second sub-mode flag indicates that a motion vector difference is superimposed on the second original motion information, then the direction information and amplitude information of the second motion vector difference are parsed from the encoded bitstream of the current block, and the second motion vector difference is determined based on the direction information and amplitude information. Then, the second target motion information of the current block is determined based on the second original motion information and the second motion vector difference. If the second sub-mode flag indicates that the motion vector difference is not superimposed on the second original motion information, then the direction and amplitude information of the second motion vector difference will not be parsed, and the second original motion information can be directly used as the second target motion information of the current block.

[0443] For example, when the first sub-mode flag of the enhanced angle-weighted prediction mode is a first value, it indicates that the motion vector difference is superimposed on the first original motion information; when the first sub-mode flag of the enhanced angle-weighted prediction mode is a second value, it indicates that the motion vector difference is not superimposed on the first original motion information. When the second sub-mode flag of the enhanced angle-weighted prediction mode is a first value, it indicates that the motion vector difference is superimposed on the second original motion information; when the second sub-mode flag of the enhanced angle-weighted prediction mode is a second value, it indicates that the motion vector difference is not superimposed on the second original motion information. The first and second values ​​can be configured empirically, such as the first value being 1 and the second value being 0, or the first value being 0 and the second value being 1.

[0444] In the above embodiments, the decoding end parses the direction information of the first motion vector difference and the direction information of the second motion vector difference from the encoded bit stream of the current block. In practical applications, the direction information of the first motion vector difference can also be derived based on the weight prediction angle of the current block, and the direction information of the second motion vector difference can be derived based on the weight prediction angle of the current block.

[0445] For example, the weight prediction angle of the current block represents an angular direction. See Figure 6 for the eight angular directions. The weight prediction angle of the current block represents one of the eight angular directions. For the decoding end, it can select the direction information that matches the angular direction from all direction information (such as up, down, left, right, upper left, lower left, upper right, lower right, etc.) and directly use the direction information as the direction information of the first motion vector difference and the second motion vector difference.

[0446] The direction information matching the angle direction may include: the angle difference between the direction information and the angle direction is a preset angle or close to a preset angle; or, among all direction information, the angle difference between the direction information and the angle direction is the smallest compared to the preset angle. The preset angle can be configured empirically, such as 90 degrees.

[0447] For example, from the encoding end's perspective, the direction information of the first motion vector difference can be derived based on the weight prediction angle of the current block, and the direction information of the second motion vector difference can be derived based on the weight prediction angle of the current block, without needing to use rate-distortion cost to determine the direction information of the first and second motion vector differences. When the encoding end sends the encoded bitstream of the current block to the decoding end, it may also choose not to encode the direction information of the first and second motion vector differences, allowing the decoding end to derive the direction information of the first and second motion vector differences.

[0448] Example 16: In Example 15, the decoding end can parse the amplitude information of the first motion vector difference and the amplitude information of the second motion vector difference from the encoded bitstream. In one possible implementation, the encoding end and the decoding end can construct the same motion vector difference amplitude list. The encoding end determines the amplitude index of the first motion vector difference amplitude information in the motion vector difference amplitude list, and the encoded bitstream includes the amplitude index of the first motion vector difference. The decoding end parses the amplitude index of the first motion vector difference from the encoded bitstream of the current block and selects the amplitude information corresponding to the amplitude index from the motion vector difference amplitude list. This amplitude information is the amplitude information of the first motion vector difference. The encoding end determines the amplitude index of the second motion vector difference amplitude information in the motion vector difference amplitude list, and the encoded bitstream includes the amplitude index of the second motion vector difference. The decoding end parses the amplitude index of the second motion vector difference from the encoded bitstream of the current block and selects the amplitude information corresponding to the amplitude index from the motion vector difference amplitude list. This amplitude information is the amplitude information of the second motion vector difference.

[0449] In another possible implementation, the encoder and decoder can construct at least two identical motion vector difference amplitude lists, such as constructing the same motion vector difference amplitude list 1 and the same motion vector difference amplitude list 2. The encoder first selects a target motion vector difference amplitude list from all the motion vector difference amplitude lists based on the indication information in the motion vector difference amplitude lists; the encoder determines the amplitude index of the first motion vector difference in the target motion vector difference amplitude list, and the encoded bitstream includes the amplitude index of the first motion vector difference.

[0450] The encoding end can also determine the amplitude index of the second motion vector difference in the target motion vector difference amplitude list, and the encoded bitstream can include the amplitude index of the second motion vector difference. The decoding end can parse the amplitude index of the second motion vector difference from the encoded bitstream of the current block, and select the amplitude information corresponding to the amplitude index from the target motion vector difference amplitude list. This amplitude information is the amplitude information of the second motion vector difference.

[0451] For example, the indication information of the motion vector difference value list can be indication information at any level. For instance, it can be the indication information of the sequence-level motion vector difference value list, the frame-level motion vector difference value list, the slice-level motion vector difference value list, the tile-level motion vector difference value list, the patch-level motion vector difference value list, the CTU-level motion vector difference value list, the LCU-level motion vector difference value list, the block-level motion vector difference value list, the CU-level motion vector difference value list, and the PU-level motion vector difference value list. There are no restrictions on this. For ease of description, we take the indication information of the frame-level motion vector difference value list as an example. The indication information of the frame-level motion vector difference value list can be awp_umve_offset_list_flag, and the switching of the motion vector difference value list is controlled by awp_umve_offset_list_flag.

[0452] For example, the encoder and decoder can construct motion vector difference amplitude value list 1 and motion vector difference amplitude value list 2, as shown in Tables 3 and 4. Binarization can be performed on both motion vector difference amplitude value list 1 and list 2; the processing method is not limited. For example, truncated unary codes can be used for both list 1 and list 2, or truncated unary codes can be used for both list 1 and list 2, or fixed-length codes can be used for both list 1 and list 2, or fixed-length codes can be used for both list 1 and list 2; these are not limited, as shown in Tables 5 and 6.

[0453] Table 3

[0454] MVD amplitude (pixels) 1 / 4 1 / 2 124

[0455] Table 4

[0456] MVD amplitude (pixels) 1 / 4 1 / 2 1248 1632

[0457] Table 5

[0458] MVD amplitude (pixels) 1 / 4 1 / 2 124 Binarization 10 100 1000 10000

[0459] Table 6

[0460] MVD amplitude (pixels) 1 / 4 1 / 2 1248 1632 Binarization 00000 1011010101110111101111

[0461] In the above application scenarios, the `awp_umve_offset_list_flag` controls the switching of the motion vector difference value list, specifically controlling whether to use the motion vector difference value list shown in Table 3 or the one shown in Table 4. For example, if the value of `awp_umve_offset_list_flag` is the first value, then the motion vector difference value list shown in Table 3 is the target motion vector difference value list; if the value of `awp_umve_offset_list_flag` is the second value, then the motion vector difference value list shown in Table 4 is the target motion vector difference value list. Alternatively, if the value of `awp_umve_offset_list_flag` is the second value, then the motion vector difference value list shown in Table 3 is the target motion vector difference value list; if the value of `awp_umve_offset_list_flag` is the first value, then the motion vector difference value list shown in Table 4 is the target motion vector difference value list.

[0462] When the target motion vector difference amplitude value list is in Table 3, the encoding end uses the binarization method shown in Table 5 for encoding, and the decoding end uses the binarization method shown in Table 5 for decoding. When the target motion vector difference amplitude value list is in Table 4, the encoding end uses the binarization method shown in Table 6 for encoding, and the decoding end uses the binarization method shown in Table 6 for decoding.

[0463] Example 17: Based on Example 15 or Example 16, and considering the first motion vector difference and the second motion vector difference, the following explains the relevant syntax of unidirectional motion information superposition motion vector difference AWP_MVR in conjunction with specific application scenarios:

[0464] Application Scenario 1: See Table 7 for examples of related syntax. 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.

[0465] awp_idx (Angle-Weighted Prediction Mode Index): The angle-weighted prediction mode index value in skip mode or direct mode. The value of AwpIdx can 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.

[0466] awp_cand_idx0 (First Motion Information Index of Angle-Weighted Prediction Mode): The first motion information index value of the angle-weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx0 is equal to the value of awp_cand_idx0. If awp_cand_idx0 does not exist in the bitstream, the value of AwpCandIdx0 is equal to 0.

[0467] awp_cand_idx1 (Angle-weighted prediction mode second motion information index): The second motion information index value of the angle-weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx1 is equal to the value of awp_cand_idx1. If awp_cand_idx1 does not exist in the bitstream, the value of AwpCandIdx1 is equal to 0.

[0468] `awp_mvd_flag` (Enhanced Angle-Weighted Prediction Mode Flag) is a binary variable. When `awp_mvd_flag` is the first value (e.g., 1), it indicates that the current block uses enhanced angle-weighted prediction mode. When `awp_mvd_flag` is the second value (e.g., 0), it indicates that the current block uses non-enhanced angle-weighted prediction mode. For example, the value of `AwpMvdFlag` can be equal to the value of `awp_mvd_flag`. If `awp_mvd_flag` does not exist in the bitstream, then the value of `AwpMvdFlag` is equal to 0.

[0469] `awp_mvd_sub_flag0` (flag for the first sub-mode of the enhanced angle-weighted prediction mode) can be a binary variable. When `awp_mvd_sub_flag0` has the first value, it indicates that the first motion information in the angle-weighted prediction mode needs to be superimposed with the motion information difference; when `awp_mvd_sub_flag0` has the second value, it indicates that the first motion information in the angle-weighted prediction mode does not need to be superimposed with the motion information difference. For example, the value of `AwpMvdSubFlag0` can be equal to the value of `awp_mvd_sub_flag0`. If `awp_mvd_sub_flag0` does not exist in the bitstream, then the value of `AwpMvdSubFlag0` is equal to 0.

[0470] `awp_mvd_sub_flag1` (the flag for the second sub-mode of the enhanced angle-weighted prediction mode) can be a binary variable. When `awp_mvd_sub_flag1` has the first value, it indicates that the second motion information of the angle-weighted prediction mode needs to be superimposed with the motion information difference; when `awp_mvd_sub_flag1` has the second value, it indicates that the second motion information of the angle-weighted prediction mode does not need to be superimposed with the motion information difference. For example, the value of `AwpMvdSubFlag1` can be equal to the value of `awp_mvd_sub_flag1`. If `awp_mvd_sub_flag1` does not exist in the bitstream, the following can also occur: if `AwpMvdFlag` equals 1, then the value of `AwpMvdSubFlag1` equals 1; otherwise, the value of `AwpMvdSubFlag1` can equal 0.

[0471] `awp_mvd_dir0` (Index value of the direction of the motion vector difference for the first motion information) is the index value of the direction of the motion vector difference for the first motion information in the angle-weighted prediction mode. For example, the value of `AwpMvdDir0` can be equal to the value of `awp_mvd_dir0`. If `awp_mvd_dir0` does not exist in the bitstream, the value of `AwpMvdDir0` can be equal to 0.

[0472] `awp_mvd_step0` (index value of the first motion information motion vector difference step size) is the index value of the first motion information motion vector difference step size in the angle-weighted prediction mode. For example, the value of `AwpMvdStep0` can be equal to the value of `awp_mvd_step0`. If `awp_mvd_step0` does not exist in the bitstream, then the value of `AwpMvdStep0` can be equal to 0.

[0473] `awp_mvd_dir1` (second motion information motion vector difference direction index value) is the motion vector difference direction index value of the second motion information in the angle-weighted prediction mode. For example, the value of `AwpMvdIdx1` can be equal to the value of `awp_mvd_dir1`. If `awp_mvd_dir1` does not exist in the bitstream, the value of `AwpMvdDir1` can be equal to 0.

[0474] `awp_mvd_step1` (index value of the second motion information motion vector difference step size), the index value of the second motion information motion vector difference step size in the angle-weighted prediction mode. For example, the value of `AwpMvdStep1` can be equal to the value of `awp_mvd_step1`. If `awp_mvd_step1` does not exist in the bitstream, the value of `AwpMvdStep1` can be equal to 0.

[0475] Table 7

[0476]

[0477]

[0478] Application Scenario 2: See Table 8 for examples of the relevant syntax. 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.

[0479] For information on awp_idx, awp_cand_idx0, and awp_cand_idx1, please refer to Application Scenario 1, which will not be elaborated upon here.

[0480] `awp_mvd_sub_flag0` (flag for the first sub-mode of the enhanced angle-weighted prediction mode) can be a binary variable. When `awp_mvd_sub_flag0` has the first value, it indicates that the first motion information in the angle-weighted prediction mode needs to be superimposed with the motion information difference; when `awp_mvd_sub_flag0` has the second value, it indicates that the first motion information in the angle-weighted prediction mode does not need to be superimposed with the motion information difference. For example, the value of `AwpMvdSubFlag0` can be equal to the value of `awp_mvd_sub_flag0`. If `awp_mvd_sub_flag0` does not exist in the bitstream, then the value of `AwpMvdSubFlag0` is equal to 0.

[0481] `awp_mvd_sub_flag1` (the flag for the second sub-mode of the enhanced angle-weighted prediction mode) can be a binary variable. When `awp_mvd_sub_flag1` has the first value, it indicates that the second motion information in the angle-weighted prediction mode needs to be superimposed with the motion information difference; when `awp_mvd_sub_flag1` has the second value, it indicates that the second motion information in the angle-weighted prediction mode does not need to be superimposed with the motion information difference. For example, the value of `AwpMvdSubFlag1` can be equal to the value of `awp_mvd_sub_flag1`. If `awp_mvd_sub_flag1` does not exist in the bitstream, then the value of `AwpMvdSubFlag1` can be equal to 0.

[0482] For information on awp_mvd_dir0, awp_mvd_step0, awp_mvd_dir1, and awp_mvd_step1, please refer to Application Scenario 1.

[0483] Table 8

[0484]

[0485]

[0486] For example, the difference between application scenario 1 and application scenario 2 is that application scenario 1 has the syntax `awp_mvd_flag`, while application scenario 2 does not. In application scenario 1, the enhanced angle-weighted prediction mode can be controlled through `awp_mvd_flag`, that is, the enhanced angle-weighted prediction mode is controlled through a master switch.

[0487] Application Scenario 3: Application Scenario 1 and Application Scenario 2 can be derived by merging the AWP mode with the AWP_MVR mode. This involves adding a 0-span option to the span, eliminating the need to encode an enable / disable flag. For example, motion vector difference supports directions such as up, down, left, and right, and supports the following step size configurations: 0-pel, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 4-pel, i.e., adding a 0-pel step size configuration. Based on this, Tables 7 / 8 can be updated to Table 9; see Table 7 for the relevant syntax.

[0488] Table 9

[0489] Coding unit definition descriptor... if((SkipFlag||DirectFlag)&&AwpFlag){ awp_idxae(v)awp_cand_idx0ae(v)awp_cand_idx1ae(v)awp_mvd_step0ae(v)if(AwpMvdStep0!=0) awp_mvd_dir0ae(v)awp_mvd_step1ae(v)if(AwpMvdStep1!=0) awp_mvd_dir1ae(v)}

[0490] ...

[0491] For example, the order of grammatical elements in the relevant grammar can be adjusted accordingly for different application scenarios. For instance, for the relevant grammar shown in Table 8, the order of grammatical elements can be adjusted accordingly to obtain the relevant grammar shown in Table 10.

[0492] Table 10

[0493]

[0494] As can be seen from Tables 8 and 10, the order of awp_cand_idx0 and awp_cand_idx1 can be adjusted. For example, in Table 10, the parsing methods of awp_cand_idx0 and awp_cand_idx1 can be adjusted based on one or more values ​​of AwpMvdSubFlag0, AwpMvdSubFlag1, AwpMvdDir0, AwpMvdStep0, AwpMvdDir1, and AwpMvdStep1. For instance, when at least one of AwpMvdSubFlag0 and AwpMvdSubFlag1 is 1, the parsing methods of awp_cand_idx0 and awp_cand_idx1 are completely consistent; otherwise, the parsing methods are inconsistent.

[0495] For example, AwpMvdSubFlag0 indicates whether to superimpose MVD on the first original motion information. If superimposed, the MVD value corresponding to the first original motion information is determined based on AwpMvdDir0 and AwpMvdStep0. AwpMvdSubFlag1 indicates whether to superimpose MVD on the second original motion information. If superimposed, the MVD value corresponding to the second original motion information is determined based on AwpMvdDir1 and AwpMvdStep1. Obviously, if one original motion information is superimposed with MVD and the other original motion information is not superimposed with MVD, or if the MVD values ​​of the two original motion information superimposed are different, then the first original motion information and the second original motion information are allowed to be the same. awp_cand_idx0 represents the index value of the first original motion information, and awp_cand_idx1 represents the index value of the second original motion information. Therefore, the parsing methods of awp_cand_idx0 and awp_cand_idx1 are completely consistent, that is, the first original motion information corresponding to awp_cand_idx0 is parsed from the complete list of motion information candidates, and the second original motion information corresponding to awp_cand_idx1 is parsed from the complete list of motion information candidates.

[0496] If neither of the two original motion information sets has a superimposed MVD, or if the superimposed MVD values ​​of the two original motion information sets are the same, then the first and second original motion information sets are different. Based on this, the parsing methods for awp_cand_idx0 and awp_cand_idx1 are different. The first original motion information corresponding to awp_cand_idx0 is parsed from the complete motion information candidate list. Since the second original motion information is different from the first original motion information, the second original motion information corresponding to awp_cand_idx1 is not parsed from the complete motion information candidate list, but rather, after excluding the first original motion information, the second original motion information corresponding to awp_cand_idx1 is parsed from the incomplete motion information candidate list.

[0497] Based on the motion information candidate list AwpUniArray, two candidate motion information are selected from AwpUniArray. Based on these two candidate motion information, the first target motion information and the second target motion information of the current block are determined. For example, the decoder parses AwpCandIdx0 and AwpCandIdx1 from the encoded bitstream, assigns the (AwpCandIdx0+1)th motion information in AwpUniArray to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1. The (AwpCandIdx1+1)th motion information in AwpUniArray is assigned to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1. Alternatively, the motion information of the (0+1)th AwpCandIdx in AwpUniArray can be assigned to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1, and the motion information of the (1+1)th AwpCandIdx in AwpUniArray can be assigned to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1.

[0498] AwpCandIdx0 represents the index value of the first target motion information. Therefore, the (AwpCandIdx0+1)th motion information in AwpUniArray can be assigned to the first target motion information. For example, if AwpCandIdx0 is 0, then the first motion information in AwpUniArray is assigned to the first target motion information, and so on.

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

[0500] If the (0+1)th motion information in AwpUniArray is a unidirectional motion information pointing to List0, then the first target motion information includes the unidirectional motion information pointing to List0, and the unidirectional motion information pointing to List1 is empty.

[0501] If the (0+1)th motion information in AwpUniArray is a unidirectional motion information pointing to List1, then the first target motion information includes the unidirectional motion information pointing to List1, and the unidirectional motion information pointing to List0 is empty.

[0502] For example, mvAwp0L0 and RefIdxAwp0L0 represent unidirectional motion information pointing to List0 in the first target motion information, and mvAwp0L1 and RefIdxAwp0L1 represent unidirectional motion information pointing to List1 in the first target motion information.

[0503] If RefIdxAwp0L0 is valid, it indicates that the unidirectional motion information pointing to List0 is valid. Therefore, the prediction mode for the first target motion information is PRED_List0. If RefIdxAwp0L1 is valid, it indicates that the unidirectional motion information pointing to List1 is valid. Therefore, the prediction mode for the first target motion information is PRED_List1.

[0504] For example, AwpCandIdx1 represents the index value of the second target motion information. Therefore, the (AwpCandIdx1+1)th motion information in AwpUniArray can be assigned to the second target motion information. For instance, if AwpCandIdx1 is 0, then the first motion information in AwpUniArray is assigned to the second target motion information, and so on.

[0505] The combination of mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1 serves as the 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.

[0506] If the (1+1)th motion information in AwpUniArray is a unidirectional motion information pointing to List0, then the second target motion information includes the unidirectional motion information pointing to List0, and the unidirectional motion information pointing to List1 is empty.

[0507] If the (1+1)th motion information in AwpCandIdx is a unidirectional motion information pointing to List1, then the second target motion information includes the unidirectional motion information pointing to List1, and the unidirectional motion information pointing to List0 is empty.

[0508] For example, mvAwp1L0 and RefIdxAwp1L0 represent unidirectional motion information pointing to List0 in the second target motion information, and mvAwp1L1 and RefIdxAwp1L1 represent unidirectional motion information pointing to List1 in the second target motion information.

[0509] If RefIdxAwp1L0 is valid, it indicates that the unidirectional motion information pointing to List0 is valid. Therefore, the prediction mode for the second target motion information is PRED_List0. If RefIdxAwp1L1 is valid, it indicates that the unidirectional motion information pointing to List1 is valid. Therefore, the prediction mode for the second target motion information is PRED_List1.

[0510] In some applications, due to the limited storage space of reference frames, if the current frame is a B-frame, but the POCs of the reference frames in List0 and List1 are the same (i.e., they are the same frame), then to maximize the performance of AWP mode, the syntax elements of the two motion information transmitted can be redesigned, i.e., the motion information can be transmitted in the manner described in this embodiment. On the other hand, for P-frames, if the two motion vectors pointing to the same frame are limited to a certain range without increasing the bandwidth limitation of the P-frame, then AWP mode can be applied to P-frames.

[0511] In response to the above findings, in this embodiment, when the reference frame pointed to by the first target motion information and the reference frame pointed to by the second target motion information are the same frame, that is, the two motion vectors of the AWP mode point to the same frame, the motion vector of the second target motion information can be derived from the motion vector of the first target motion information. That is, the first motion information transmits the index value, and the second motion information is MVD superimposed on the first motion information. The encoding method of MVD is described in Embodiment 15 or 16.

[0512] Referring to Table 11, which provides an example of a syntax element, `awp_mvd_dir0` represents the direction index value of the motion vector difference of the first motion information in the constrained angle-weighted prediction mode. The value of `AwpMvdDir0` is equal to the value of `awp_mvd_dir0`. If `awp_mvd_dir0` does not exist in the bitstream, then the value of `AwpMvdDir0` is equal to 0. `awp_mvd_step0` represents the step size index value of the motion vector difference of the first motion information in the constrained angle-weighted prediction mode. The value of `AwpMvdStep0` is equal to the value of `awp_mvd_step0`. If `awp_mvd_step0` does not exist in the bitstream, then the value of `AwpMvdStep0` is equal to 0. `awp_mvd_dir1` represents the direction index value of the motion vector difference of the second motion information in the constrained angle-weighted prediction mode. The value of `AwpMvdIdx1` is equal to the value of `awp_mvd_dir1`. If `awp_mvd_dir1` does not exist in the bitstream, then the value of `AwpMvdDir1` is equal to 0. awp_mvd_step1 represents the step size index of the motion vector difference of the second motion information in the constrained angle weighted prediction mode. The value of AwpMvdStep1 is equal to the value of awp_mvd_step1. If awp_mvd_step1 does not exist in the bit stream, then the value of AwpMvdStep1 is equal to 0.

[0513] Table 11

[0514] Encoding unit definition descriptor... if((SkipFlag||DirectFlag)&&AwpFlag&&Limited){ awp_idxae(v)awp_cand_idxae(v)awp_mvd_dir0ae(v)awp_mvd_step0ae(v)awp_mvd_dir1ae(v)awp_mvd_step1ae(v)} ...

[0515] In summary, the original motion information (including the original motion vector) can be determined based on `awp_cand_idx`. The first motion vector difference `MVD0` and the second motion vector difference `MVD1` are determined based on `awp_mvd_dir0` and `awp_mvd_step0`. Based on this, the first target motion vector is determined using the original motion vector and the first motion vector difference `MVD0`, such as original motion vector + `MVD0`. The second target motion vector is determined using the first target motion vector and the second motion vector difference `MVD1`, such as first target motion vector + `MVD1`. After obtaining the first target motion vector, the first target motion information is obtained based on it; the first target motion information includes the first target motion vector. After obtaining the second target motion vector, the second target motion information is obtained based on it; the second target motion information includes the second target motion vector.

[0516] For example, the first target motion vector is determined based on the difference MVD0 between the original motion vector and the first motion vector, such as original motion vector + MVD0. The second target motion vector is determined based on the difference MVD1 between the original motion vector and the second motion vector, such as original motion vector + MVD1. After obtaining the first target motion vector, first target motion information is obtained based on the first target motion vector, and the first target motion information includes the first target motion vector. After obtaining the second target motion vector, second target motion information is obtained based on the second target motion vector, and the second target motion information includes the second target motion vector.

[0517] Referring to Table 12, another example of the syntax elements is shown. `awp_mvd_dir` and `awp_mvd_step` constitute the syntactic expression of the second motion information (i.e., the second target motion information) on the first motion information (i.e., the first target motion information). `awp_mvd_dir` represents the direction index value of the constrained angle-weighted prediction mode motion vector difference. The value of `AwpMvdDir` is equal to the value of `awp_mvd_dir`. If `awp_mvd_dir` does not exist in the bitstream, the value of `AwpMvdDir` is equal to 0. `awp_mvd_step` represents the step size index value of the constrained angle-weighted prediction mode motion vector difference. The value of `AwpMvdStep` is equal to the value of `awp_mvd_step`. If `awp_mvd_step` does not exist in the bitstream, the value of `AwpMvdStep` is equal to 0.

[0518] Table 12

[0519] Encoding unit definition descriptor... if((SkipFlag||DirectFlag)&&AwpFlag&&Limited){ awp_idxae(v)awp_cand_idxae(v)awp_mvd_dirae(v)awp_mvd_stepae(v)} ...

[0520] In summary, the original motion information (including the original motion vector) can be determined based on awp_cand_idx, and the motion vector difference (MVD) can be determined based on awp_mvd_dir and awp_mvd_step.

[0521] Based on this, the first target motion vector is determined according to the original motion vector, such as the first target motion vector being the original motion vector. The second target motion vector is determined according to the first target motion vector and the motion vector difference (MVD), such as the first target motion vector plus the MVD. After obtaining the first target motion vector, first target motion information is obtained based on it, and the first target motion information includes the first target motion vector. After obtaining the second target motion vector, second target motion information is obtained based on it, and the second target motion information includes the second target motion vector.

[0522] For example, the first target motion vector is determined based on the original motion vector and the motion vector difference (MVD), such as original motion vector + MVD. The second target motion vector is determined based on the original motion vector and the motion vector difference (MVD), such as original motion vector - MVD. Alternatively, the first target motion vector is determined based on the original motion vector and the motion vector difference (MVD), such as original motion vector - MVD. The second target motion vector is determined based on the original motion vector and the motion vector difference (MVD), such as original motion vector + MVD. After obtaining the first target motion vector, first target motion information is obtained based on the first target motion vector, and the first target motion information includes the first target motion vector. After obtaining the second target motion vector, second target motion information is obtained based on the second target motion vector, and the second target motion information includes the second target motion vector. In summary, it can be seen that MVD acts simultaneously in two opposite directions, enabling the original motion information to derive two target motion information.

[0523] In one possible implementation, the syntax of MVD can also be expressed separately for the horizontal and vertical components, as shown in Table 13, which provides an example of this separate expression. `awp_mv_diff_x_abs` represents the absolute value of the difference between the horizontal components of the motion vectors in the constrained angle-weighted prediction mode, and `awp_mv_diff_y_abs` represents the absolute value of the difference between the vertical components of the motion vectors in the constrained angle-weighted prediction mode. `awp_mv_diff_x_sign` represents the sign value of the difference between the horizontal components of the motion vectors in the constrained angle-weighted prediction mode, and `awp_mv_diff_y_sign` represents the sign value of the difference between the vertical components of the motion vectors in the constrained angle-weighted prediction mode.

[0524] For example, the absolute values ​​of the motion vector differences in the constrained angle-weighted prediction mode, AwpMvDiffXAbs, are equal to the values ​​of awp_mv_diff_x_abs, and AwpMvDiffYAbs are equal to the values ​​of awp_mv_diff_y_abs.

[0525] For example, in the constrained angle-weighted prediction mode, the sign bit of the motion vector difference, AwpMvDiffXSign, is equal to the value of awp_mv_diff_x_sign, and the value of AwpMvDiffYSign is equal to awp_mv_diff_y_sign0. If awp_mv_diff_x_sign or awp_mv_diff_y_sign does not exist in the bit stream, then the value of AwpMvDiffXSign or AwpMvDiffYSign is 0. If the value of AwpMvDiffXSign is 0, AwpMvDiffX is equal to AwpMvDiffXAbs; if the value of AwpMvDiffXSign is 1, AwpMvDiffX is equal to -AwpMvDiffXAbs. If the value of AwpMvDiffYSign is 0, AwpMvDiffY equals AwpMvDiffYAbs; if the value of AwpMvDiffYSign is 1, AwpMvDiffY equals -AwpMvDiffYAbs. The range of values ​​for AwpMvDiffX and AwpMvDiffY is -32768 to 32767.

[0526] Table 13

[0527] The encoding unit defines the descriptor awp_mv_diff_x_absae(v) if (AwpMvDiffXAbs) awp_mv_diff_x_signae(v) awp_mv_diff_y_absae(v) if (AwpMvDiffYAbs) awp_mv_diff_y_signae(v)

[0528] In another possible im...

Claims

1. A coding and decoding method, It is characterized in that The method comprises: When determining to start weighted prediction for the current block, obtaining a weight prediction angle and a weight configuration parameter of the current block; configuring reference weight values ​​for peripheral locations outside the current block according to the weight configuration parameters; For each pixel position of the current block, determine a peripheral matching position pointed to by the pixel position from peripheral positions outside the current block according to the weight prediction angle; determine a target weight value of the pixel position according to a reference weight value associated with the peripheral matching position, and determine an associated weight value of the pixel position according to the target weight value of the pixel position; Acquire a motion information candidate list, the motion information candidate list including at least one candidate motion information; acquire first target motion information and second target motion information of the current block based on the motion information candidate list; Determine a first prediction value of the pixel position according to the first target motion information of the current block, and determine a second prediction value of the pixel position according to the second target motion information of the current block; determine a weighted prediction value of the pixel position according to the first prediction value, the target weight value, the second prediction value and the associated weight value; A weighted prediction value of the current block is determined according to the weighted prediction values ​​of all pixel positions of the current block.

2. The method according to claim 1, It is characterized in that The step of obtaining a motion information candidate list includes: Acquire at least one available motion information to be added to the motion information candidate list; Based on the at least one available motion information, obtaining the motion information candidate list; The available motion information includes at least one of the following motion information: Spatial motion information; temporal motion information; preset motion information.

3. The method according to claim 2, It is characterized in that The obtaining of at least one available motion information to be added to the motion information candidate list includes: For the spatial neighboring block of the current block, if the spatial neighboring block exists and the spatial neighboring block adopts the inter-frame prediction mode, the motion information of the spatial neighboring block is determined as the available motion information.

4. The method according to claim 2, It is characterized in that The obtaining of at least one available motion information to be added to the motion information candidate list includes: Based on the preset position of the current block, a time-domain neighboring block corresponding to the preset position is selected from a reference frame of the current block, and motion information of the time-domain neighboring block is determined as available motion information.

5. The method according to claim 2, It is characterized in that The obtaining of at least one available motion information to be added to the motion information candidate list includes: Determine preset motion information as available motion information, where the preset motion information includes: The default motion information is derived based on the candidate motion information already in the motion information candidate list.

6. The method according to claim 2, It is characterized in that The acquiring the motion information candidate list based on the at least one available motion information includes: For the available motion information currently to be added to the motion information candidate list, If the available motion information is unidirectional motion information, and the unidirectional motion information is not repeated with candidate motion information already in the motion information candidate list, adding the unidirectional motion information to the motion information candidate list; If the available motion information is bidirectional motion information, the bidirectional motion information is cut into first unidirectional motion information and second unidirectional motion information; if the first unidirectional motion information does not overlap with the candidate motion information already in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list.

7. The method according to claim 2, It is characterized in that The acquiring the motion information candidate list based on the at least one available motion information includes: for the available motion information currently to be added to the motion information candidate list, adding the available motion information to the motion information candidate list.

8. The method according to claim 6, It is characterized in that The first unidirectional motion information is unidirectional motion information pointing to a reference frame in the first reference frame list; The second unidirectional motion information is unidirectional motion information pointing to a reference frame in a second reference frame list; The first reference frame list is List0, and the second reference frame list is List1; or, The first reference frame list is List1, and the second reference frame list is List0.

9. The method according to claim 6, It is characterized in that The duplication checking operation for the unidirectional motion information and the candidate motion information already existing in the motion information candidate list includes: If the display order POC of the reference frame pointed to by the unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the unidirectional motion information is the same as the motion vector of the candidate motion information, then it is determined that the unidirectional motion information is repeated with the candidate motion information; otherwise, it is determined that the unidirectional motion information is not repeated with the candidate motion information.

10. The method according to claim 1, It is characterized in that The acquiring the first target motion information and the second target motion information of the current block based on the motion information candidate list includes: Selecting candidate motion information from the motion information candidate list as first original motion information of the current block, and selecting candidate motion information from the motion information candidate list as second original motion information of the current block; Determine first target motion information of the current block according to the first original motion information; The second target motion information of the current block is determined according to the second original motion information.

11. The method according to claim 10, It is characterized in that The first original motion information includes a first original motion vector, the first target motion information includes a first target motion vector, and determining the first target motion information of the current block according to the first original motion information includes: Acquire a first motion vector difference corresponding to the first original motion vector; determine the first target motion vector according to the first motion vector difference and the first original motion vector; or, Determining the first original motion vector as the first target motion vector; The second original motion information includes a second original motion vector, the second target motion information includes a second target motion vector, and determining the second target motion information of the current block according to the second original motion information includes: Acquire a second motion vector difference corresponding to the second original motion vector; determine the second target motion vector according to the second motion vector difference and the second original motion vector; or, The second original motion vector is determined as the second target motion vector.

12. The method according to claim 11, It is characterized in that The obtaining a first motion vector difference corresponding to the first original motion vector includes: Acquiring direction information and amplitude information of the first motion vector difference; determining the first motion vector difference according to the direction information and the amplitude information of the first motion vector difference; The obtaining a second motion vector difference corresponding to the second original motion vector includes: Acquire direction information and amplitude information of the second motion vector difference; The second motion vector difference is determined according to the direction information and the magnitude information of the second motion vector difference.

13. The method according to claim 12, It is characterized in that If the method is applied to the decoding end, then: The acquiring the direction information of the first motion vector difference includes: Parsing the direction information of the first motion vector difference from the coded bit stream of the current block; or, Derivation of direction information of the first motion vector difference according to the weighted prediction angle of the current block; The acquiring the direction information of the second motion vector difference includes: Parsing the direction information of the second motion vector difference from the coded bit stream of the current block; or, Direction information of the second motion vector difference is derived according to the weighted prediction angle of the current block.

14. The method according to claim 12, It is characterized in that If the method is applied to the decoding end, then: The acquiring the amplitude information of the first motion vector difference includes: Parsing the amplitude information of the first motion vector difference from the coded bit stream of the current block; The acquiring the amplitude information of the second motion vector difference includes: The amplitude information of the second motion vector difference is parsed from the coded bit stream of the current block.

15. The method according to any one of claims 12 to 14, It is characterized in that If the direction information of the first motion vector difference indicates that the direction is rightward, and the amplitude information of the first motion vector difference is Ar1, then the first motion vector difference is (Ar1, 0); if the direction information of the first motion vector difference indicates that the direction is downward, and the amplitude information of the first motion vector difference is Ad1, then the first motion vector difference is (0, -Ad1); If the direction information of the first motion vector difference indicates that the direction is leftward, and the amplitude information of the first motion vector difference is Al1, then the first motion vector difference is (-Al1, 0); if the direction information of the first motion vector difference indicates that the direction is upward, and the amplitude information of the first motion vector difference is Au1, then the first motion vector difference is (0, Au1); If the direction information of the second motion vector difference indicates that the direction is right, and the amplitude information of the second motion vector difference is Ar2, then the second motion vector difference is (Ar2, 0); if the direction information of the second motion vector difference indicates that the direction is downward, and the amplitude information of the second motion vector difference is Ad2, then the second motion vector difference is (0, -Ad2); if the direction information of the second motion vector difference indicates that the direction is left, and the amplitude information of the second motion vector difference is Al2, then the second motion vector difference is (-Al2, 0); if the direction information of the second motion vector difference indicates that the direction is upward, and the amplitude information of the second motion vector difference is Au2, then the second motion vector difference is (0, Au2).

16. A coding and decoding device, It is characterized in that The device comprises: An acquisition module, used for acquiring a weight prediction angle and a weight configuration parameter of the current block when determining to start weighted prediction for the current block; A configuration module, configured to configure reference weight values ​​for peripheral locations outside the current block according to the weight configuration parameters; a determination module, configured to determine, for each pixel position of the current block, from peripheral positions outside the current block according to the weight prediction angle, a peripheral matching position pointed to by the pixel position; determine a target weight value of the pixel position according to a reference weight value associated with the peripheral matching position, and determine an associated weight value of the pixel position according to the target weight value of the pixel position; The acquisition module is further used to acquire a motion information candidate list, wherein the motion information candidate list includes at least one candidate motion information; and acquire the first target motion information and the second target motion information of the current block based on the motion information candidate list; The determination module is further used to determine the first prediction value of the pixel position according to the first target motion information of the current block, and determine the second prediction value of the pixel position according to the second target motion information of the current block; determine the weighted prediction value of the pixel position according to the first prediction value, the target weight value, the second prediction value and the associated weight value; and determine the weighted prediction value of the current block according to the weighted prediction values ​​of all pixel positions of the current block.

17. A decoding terminal device, It is characterized in that include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the following steps: When determining to start weighted prediction for the current block, obtaining a weight prediction angle and a weight configuration parameter of the current block; configuring reference weight values ​​for peripheral locations outside the current block according to the weight configuration parameters; For each pixel position of the current block, determining a peripheral matching position pointed to by the pixel position from peripheral positions outside the current block according to the weight prediction angle; Determine a target weight value of the pixel position according to a reference weight value associated with the peripheral matching position, and determine an associated weight value of the pixel position according to the target weight value of the pixel position; Acquire a motion information candidate list, wherein the motion information candidate list includes at least one candidate motion information; Acquire first target motion information and second target motion information of the current block based on the motion information candidate list; Determine a first prediction value of the pixel position according to first target motion information of the current block, and determine a second prediction value of the pixel position according to second target motion information of the current block; Determining a weighted prediction value of the pixel position according to the first prediction value, the target weight value, the second prediction value and the associated weight value; A weighted prediction value of the current block is determined according to the weighted prediction values ​​of all pixel positions of the current block.

18. A coding terminal device, It is characterized in that include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the following steps: When determining to start weighted prediction for the current block, obtaining a weight prediction angle and a weight configuration parameter of the current block; configuring reference weight values ​​for peripheral locations outside the current block according to the weight configuration parameters; For each pixel position of the current block, determining a peripheral matching position pointed to by the pixel position from peripheral positions outside the current block according to the weight prediction angle; Determine a target weight value of the pixel position according to a reference weight value associated with the peripheral matching position, and determine an associated weight value of the pixel position according to the target weight value of the pixel position; Acquire a motion information candidate list, wherein the motion information candidate list includes at least one candidate motion information; Acquire first target motion information and second target motion information of the current block based on the motion information candidate list; Determine a first prediction value of the pixel position according to first target motion information of the current block, and determine a second prediction value of the pixel position according to second target motion information of the current block; Determining a weighted prediction value of the pixel position according to the first prediction value, the target weight value, the second prediction value and the associated weight value; A weighted prediction value of the current block is determined according to the weighted prediction values ​​of all pixel positions of the current block.