Methods and sets of encryption and decryption systems, and equipment for that.

TH2201007803APending Publication Date: 2026-08-31หางโจว ฮิควิชั่น ดิจิทัล เทคโนโลยี โค แอลทีดี
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
TH2201007803
Authority / Receiving Office
TH · TH
Patent Type
Applications
Current Assignee / Owner
Filing Date
2021-05-31
Publication Date
2026-08-31

AI Technical Summary

Technical Problem

In existing video coding technology, it is difficult to effectively improve the accuracy of prediction during the prediction process, resulting in poor coding performance.

Method used

By obtaining the weight prediction angle and weight configuration parameters during weighted prediction, configuring the reference weight value, determining the target weight value of the pixel position, and calculating the weighted prediction value by combining the first and second prediction values ​​and the associated weight value to improve the accuracy of prediction. sex.

Benefits of technology

Improved prediction accuracy and encoding performance allow video encoding to be closer to the original pixel values, reducing encoding errors and bitstream requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000001_0000
    Figure 00000001_0000
  • Figure 00000136_0000
    Figure 00000136_0000
  • Figure 00000137_0000
    Figure 00000137_0000
Patent Text Reader

Abstract

Invention details;
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus and device for encoding and decoding Technical Field

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

[0002] To save space, video images are encoded before transmission. Complete video encoding includes processes such as prediction, transform, quantization, entropy coding, and filtering. The prediction process includes intra-frame prediction and inter-frame prediction. Inter-frame prediction utilizes temporal correlation to predict the current pixel using pixels from neighboring encoded images, effectively reducing temporal redundancy. Intra-frame prediction utilizes spatial correlation to predict the current pixel using pixels from the encoded blocks of the current frame, reducing spatial redundancy.

[0003] Summary of the Invention

[0004] In view of this, this application provides an encoding / decoding method, apparatus, encoding end device, and decoding end device, which improves the accuracy of prediction.

[0005] This application provides an encoding / decoding method, the method comprising: upon determining to initiate weighted prediction for a current block, obtaining a weighted prediction angle and weight configuration parameters for the current block, wherein the weight configuration parameters include a weight transformation rate and a starting position of the weight transformation; configuring reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weighted prediction angle; determining a target weight value for the pixel position according to the reference weight value associated with the surrounding matching position; determining an associated weight value for the pixel position according to the target weight value; determining a first prediction value for the pixel position according to a first prediction mode of the current block; determining a second prediction value for the pixel position according to a second prediction mode of the current block; determining a weighted prediction value for the pixel position according to the first prediction value, the target weight value, the second prediction value, and the associated weight value; and determining a weighted prediction value for the current block according to the weighted prediction values ​​of all pixel positions of the current block.

[0006] 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 determining to initiate weighted prediction for the current block, wherein the weight configuration parameters include a weight transformation rate and a weight transformation start position; 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; determine an associated weight value of the pixel position according to the target weight value of the pixel position; determine a first prediction value of the pixel position according to a first prediction mode of the current block; determine a second prediction value of the pixel position according to a second prediction mode 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; and determine a weighted prediction value of the current block according to the weighted prediction values ​​of all pixel positions of the current block.

[0007] This application provides a decoding end device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to implement the following steps: upon determining to initiate weighted prediction for the current block, obtaining the weight prediction angle and weight configuration parameters of the current block, wherein the weight configuration parameters include a weight transformation rate and a weight transformation start position; configuring reference weight values ​​for the peripheral positions outside the current block according to the weight configuration parameters; and for each pixel position of the current block, calculating reference weight values ​​from the peripheral positions outside the current block according to the weight prediction angle. The process involves: determining the surrounding matching position pointed to by the pixel position; determining the target weight value of the pixel position based on the reference weight value associated with the surrounding matching position; determining the associated weight value of the pixel position based on the target weight value; determining a first predicted value of the pixel position based on a first prediction mode of the current block; determining a second predicted value of the pixel position based on a second prediction mode of the current block; determining 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 determining a weighted predicted value of the current block based on the weighted predicted values ​​of all pixel positions in the current block.

[0008] This application provides an encoding end device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to implement the following steps: when determining to initiate weighted prediction for the current block, obtaining the weight prediction angle and weight configuration parameters of the current block, wherein the weight configuration parameters include a weight transformation rate and a weight transformation start position; configuring reference weight values ​​for the peripheral positions outside the current block according to the weight configuration parameters; for each pixel position of the current block, calculating reference weight values ​​from the peripheral positions outside the current block according to the weight prediction angle. The process involves: determining the surrounding matching position pointed to by the pixel position; determining the target weight value of the pixel position based on the reference weight value associated with the surrounding matching position; determining the associated weight value of the pixel position based on the target weight value; determining a first predicted value of the pixel position based on a first prediction mode of the current block; determining a second predicted value of the pixel position based on a second prediction mode of the current block; determining 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 determining a weighted predicted value of the current block based on the weighted predicted values ​​of all pixel positions in the current block.

[0009] 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, making the predicted value of the current block closer to the original pixel, thereby improving the accuracy of prediction, improving prediction performance, and improving coding performance. Attached Figure Description

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

[0011] Figures 2A-2C are schematic diagrams of weighted prediction;

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

[0013] Figure 4A is a flowchart of an encoding method in one embodiment of this application;

[0014] Figures 4B-4E are schematic diagrams of the surrounding positions outside the current block;

[0015] Figure 4F is a flowchart of a decoding method in one embodiment of this application;

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

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

[0018] Figure 7A is a flowchart of the derived weight array in one embodiment of this application;

[0019] Figures 7B-7D are schematic diagrams of weight prediction angle and angle partitioning in one embodiment of this application;

[0020] Figures 8A and 8B are schematic diagrams of the SCC sequence and the natural sequence, respectively;

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

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

[0023] Figure 10B is a hardware structure diagram of a decoding device in one embodiment of this application;

[0024] Figure 10C is a hardware structure diagram of the encoding end device in another embodiment of this application. Detailed Implementation

[0025] 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…”.

[0026] This application proposes an encoding / decoding method, apparatus, and device, which may involve the following concepts: intra prediction, inter prediction, and IBC (Intra Block Copy) prediction, etc.

[0027] Intra-frame prediction is based on the correlation in the video spatial domain. It uses the pixels of the already coded blocks of the current image to predict the pixels of the current block, thereby reducing video spatial redundancy. Intra-frame prediction specifies a variety of prediction modes, each corresponding to a texture direction (except for the DC (Direct Current) mode). For example, if the image texture is arranged horizontally, the horizontal prediction mode can better predict image information.

[0028] Inter-frame prediction is based on the temporal correlation of video. Since video sequences contain strong temporal correlations, using the pixels of neighboring encoded images to predict the pixels of the current image can effectively reduce temporal redundancy in video.

[0029] Intra-block copy allows for intra-frame reference, where the reference data for the current block comes from the same frame. In intra-block copy 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 there are a large number of recurring textures in the same frame of screen content, the compression efficiency of the screen content sequence can be improved when using block vectors to obtain the predicted value of the current block.

[0030] A predicted pixel is a pixel value derived from the encoded / decoded pixels. It is obtained by subtracting the original pixel from the predicted pixel to obtain a residual, which is then used for residual transform quantization and coefficient encoding. Inter-frame predicted pixels 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 predicted pixel. The closer the predicted pixel is to the original pixel, the higher the residual energy obtained by subtracting the two, and the better the encoding compression performance.

[0031] 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. Then, the difference between the predicted value (MVP, Motion Vector Prediction) and the actual estimated value of the motion vector, i.e., the motion vector difference (MVD), is encoded.

[0032] 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 pointing block, 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 techniques, a list of reference frame images is typically established for the current frame, and the reference frame image index information indicates which reference frame image in the list the current block uses. Furthermore, many coding techniques support multiple lists of reference frame images; therefore, an index value can also be used to indicate which list of reference frame images is used. This index value can be called the reference direction. In summary, in video coding techniques, motion vectors, reference frame image index information, reference direction, and other motion-related information can be collectively referred to as motion information.

[0033] Block vectors (BVs) are used in intra-block copy technology, which employs block vectors for motion compensation, specifically to obtain the predicted value of the current block. Unlike motion vectors, block vectors represent the relative displacement between the current block and the best-matching block in the currently coded blocks of the frame. Due to the presence of numerous repetitive textures within the same frame, using block vectors to obtain the predicted value of the current block can significantly improve compression efficiency.

[0034] Intra-prediction modes: In intra-prediction, motion compensation is performed using intra-prediction modes, which are used to obtain the predicted value of the current block. For example, intra-prediction modes can include, but are not limited to, Planar mode, DC mode, and various angle modes. Planar mode is suitable for regions where pixel values ​​change slowly, using two linear filters in the horizontal and vertical directions to obtain the average value of the pixels in both directions as the predicted value of the current block. DC mode is suitable for large, flat regions, using the average value of the surrounding pixels of the current block as the predicted value of the current block. There are 33 or 65 angle modes.

[0035] Palette Mode. In palette mode, the pixel values ​​of the current block are represented by a small set of pixel values, which is the palette. When a pixel value at a position in the current block is close to a color in the palette, that pixel position is encoded with the index value of the corresponding color in the palette. When a pixel value at a position in the current block is dissimilar to any color in the palette, that pixel position needs to be encoded as an "escape pixel," which is then directly quantized and encoded into the bitstream. For the decoder, a palette is first obtained, for example, a palette storing {color A, color B, color C}. Then, for each pixel position, it is first checked whether it is an escape pixel. If it is not an escape pixel, the index of the pixel position is obtained from the bitstream, and the color is obtained from the palette based on that index and assigned to that pixel position. Otherwise, the escape pixel value is parsed.

[0036] Rate-Distortion Optimization (RDO) principle. Two main metrics for evaluating coding efficiency are bitrate and PSNR (Peak Signal-to-Noise Ratio). A smaller bitrate results in a higher compression ratio, and a higher PSNR results in better reconstructed image quality. In mode selection, the decision formula is essentially a comprehensive evaluation of these two metrics. For example, the cost of a mode is: J(mode) = D + λ*R, where D represents distortion, typically measured using the SSE (Sum of the Squared Errors) metric. SSE refers to the sum of the mean squares of the differences between the reconstructed image patch and the source image; λ is a Lagrange multiplier; and R is the actual number of bits required to encode the image patch in that mode, including the total number of 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.

[0037] A video coding framework. The encoding-side processing flow of this application embodiment can be implemented using the video coding framework shown in Figure 1. The schematic diagram of the video decoding framework is similar to that in Figure 1 and will not be repeated here. The decoding-side processing flow of this application embodiment can be implemented using the video decoding framework. 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-side processing flow can be implemented through the cooperation between these modules; at the decoding end, the decoding-side processing flow can be implemented through the cooperation between these modules.

[0038] For example, 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 an object in the foreground and the background). When the motion of the two objects is inconsistent, rectangular partitioning 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 ​​to perform a weighted operation to obtain the final predicted value. Weighted prediction can include: joint weighted prediction between frames and within frames, joint weighted prediction between frames, joint weighted prediction between intra frames and within frames, etc. For the weighted prediction weights, 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.

[0039] See Figure 2A, which is a schematic diagram of the inter-frame weighted prediction triangular partition mode (TPM).

[0040] The TPM prediction block is obtained by combining inter-frame prediction block 1 (i.e., inter-frame prediction values ​​1 obtained by inter-frame prediction mode 1 for multiple pixel positions) and inter-frame prediction block 2 (i.e., inter-frame prediction values ​​2 obtained by inter-frame prediction mode 2 for multiple pixel positions). The TPM prediction block can be divided into two regions / parts, one region can be inter-frame region 1 and the other region can be inter-frame region 2. The TPM prediction block can be rectangular, or the two inter-frame regions of the TPM prediction block can be non-rectangular. The dividing line between the two inter-frame regions (as shown by the dashed line in Figure 2A) can be the main diagonal or the secondary diagonal of the TPM prediction block.

[0041] For each pixel location in inter-frame region 1, the prediction is primarily based on the inter-frame prediction value 1 of inter-frame prediction block 1. For example, the inter-frame prediction value 1 of inter-frame prediction block 1 at that pixel location is weighted and the inter-frame prediction value 2 of inter-frame prediction block 2 at that pixel location to obtain a joint prediction value for that pixel location. Here, the weight of inter-frame prediction value 1 is larger, and the weight of inter-frame prediction value 2 is smaller (or even 0). For each pixel location in inter-frame region 2, the prediction is primarily based on the inter-frame prediction value 2 of inter-frame prediction block 2. For example, the inter-frame prediction value 1 of inter-frame prediction block 1 at that pixel location is weighted and the inter-frame prediction value 2 of inter-frame prediction block 2 at that pixel location to obtain a joint prediction value for that pixel location. Here, the weight of inter-frame prediction value 2 is larger, and the weight of inter-frame prediction value 1 is smaller (or even 0). Then, the joint prediction values ​​for each pixel location can be used to form a TPM prediction block.

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

[0043] The GEO prediction block is obtained by combining inter-frame prediction block 1 (i.e., inter-frame prediction value 1 obtained by inter-frame prediction mode 1 for multiple pixel positions) and inter-frame prediction block 2 (i.e., inter-frame prediction value 2 obtained by inter-frame prediction mode 2 for multiple pixel positions). The GEO prediction block can be divided into two regions / parts, one region can be inter-frame region 1, and the other region can be inter-frame region 2.

[0044] For each pixel position in inter-frame region 1, the prediction is primarily based on the inter-frame prediction value 1 of inter-frame prediction block 1. For example, when weighting the inter-frame prediction value 1 of inter-frame prediction block 1 at that pixel position with the inter-frame prediction value 2 of inter-frame prediction block 2 at that pixel position, the weight of inter-frame prediction value 1 is larger, and the weight of inter-frame prediction value 2 is smaller. For each pixel position in inter-frame region 2, the prediction is primarily based on the inter-frame prediction value 2 of inter-frame prediction block 2. For example, when weighting the inter-frame prediction value 1 of inter-frame prediction block 1 at that pixel position with the inter-frame prediction value 2 of inter-frame prediction block 2 at that pixel position, the weight of inter-frame prediction value 2 is larger, and the weight of inter-frame prediction value 1 is smaller.

[0045] For example, the weight values ​​of the GEO prediction blocks are configured based on the distance of the pixel position from the dividing line. Referring to Figure 2C, 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 prediction block 2 are ordered as B≥A≥C, and the weight values ​​of inter-frame prediction block 1 are ordered as C≥A≥B. For pixel positions D, E, and F, the weight values ​​of inter-frame prediction block 1 are ordered as D≥F≥E, and the weight values ​​of inter-frame prediction block 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.

[0046] To achieve weighted prediction in all the above scenarios, it is necessary to determine the weight value of the prediction block corresponding to each pixel position in the current block, and then perform weighted prediction based on the weight values ​​corresponding to the pixel positions. However, the setting of the weight values ​​depends on the dividing line; if the weight values ​​are set inappropriately, it may lead to problems such as poor prediction results and poor coding performance.

[0047] In view of this, the proposed method for deriving weight values ​​in this application embodiment can determine the target weight value of 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 more reasonable target weight value for each pixel position, making the predicted value closer to the original pixel, thereby improving prediction accuracy, prediction performance, and coding performance.

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

[0049] Example 1: Referring to Figure 3, which is a flowchart of the encoding and 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). This method can include the following steps.

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

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

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

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

[0054] 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, if the number of surrounding locations outside the current block is determined to be M based on the size of the current block and / or the weight prediction angle of the current block, then reference weight values ​​are configured for the M surrounding locations according to the weight configuration parameters of the current block.

[0055] 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 reference weight values ​​of the surrounding locations outside the current block can be 0 0…0 0 2 4 6 8 8…8 8, or the reference weight values ​​of the surrounding locations outside the current block can be 8 8…8 8 6 4 2 0 0…0 0.

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

[0057] 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. That is, the surrounding locations outside the current block can be divided into the target region, the first neighboring region of the target region, and the second neighboring region of the target region.

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

[0059] For example, the target region includes one 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.

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

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

[0062] 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, the 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 be a fixed preset value. 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.

[0063] Step 304: For each pixel position in the current block, determine the first predicted value of the pixel position according to the first prediction mode of the current block, and determine the second predicted value of the pixel position according to the second prediction mode of the current block; determine the weighted predicted value of the pixel position according to the first predicted value, the target weight value, the second predicted value and the associated weight value.

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

[0065] Alternatively, assuming the target weight value is the weight value corresponding to the second prediction mode and the associated weight value is the weight value corresponding to the first prediction mode, the weighted prediction value of the pixel position can be: (the second prediction value of the pixel position * the target weight value of the pixel position + the first prediction value of the pixel position * the associated weight value of the pixel position) / a fixed preset value.

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

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

[0068] 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, making the predicted value of the current block closer to the original pixel, thereby improving the accuracy of prediction, improving prediction performance, and improving coding performance.

[0069] Example 2: Based on Example 1, this application proposes another encoding and decoding method. As shown in Figure 4A, which is a flowchart of the encoding and decoding method, this method can be applied to the encoding end and may include the following steps.

[0070] Step 401: 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 401 and subsequent steps are executed; otherwise, the processing method is not limited in this application.

[0071] In one possible implementation, if the current block meets the conditions for initiating weighted prediction, the encoder can determine to initiate weighted prediction for the current block. If the current block does not meet the conditions for initiating weighted prediction, it is determined not to initiate weighted prediction for the current block. For example, it is determined whether the feature information of the current block meets specific conditions. If it does, it is determined to initiate weighted prediction for the current block; if it does not, it is determined not to initiate weighted prediction 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 (Sequence Parameter Set), SH (Sequence Header)) switch control information, image-level (PPS (Picture Parameter Set), PH (Picture Header)) switch control information, slice-level (Slice, Tile, Patch) switch control information, maximum coding unit-level (LCU (Largest Coding Unit), CTU (Coding Tree Unit)) switch control information, or block-level (CU (Coding Unit), PU (Prediction Unit), TU (Transform Unit)) switch control information.

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

[0073] 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 of the current block meets specific conditions, including but not limited to: if the width is greater than or equal to a first width value and the height is greater than or equal to a second height value, the size information of the current block meets the specific conditions; or, if the width is greater than or equal to a third width value and the height is greater than or equal to a fourth height value, the width is less than or equal to a fifth width value and the height is less than or equal to a sixth height value, the size information of the current block meets the specific conditions; or, if the product of the width and height is greater than or equal to the product value, the size information of the current block meets the specific conditions. These values ​​can be configured empirically, such as 8, 16, 32, 64, 128, etc. For example, the first width value is 8, the second height value is 8, the third width value is 8, the fourth height value is 8, the fifth width value is 64, the sixth height value is 64, and the product value is 64. 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 meets 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, 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, the current block's size information is determined to meet specific conditions. The above are merely examples and are not intended to impose limitations.

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

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

[0076] For example, if the feature information consists of the frame type and size information of the current block within the current frame, 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 consists of the frame type and on / off control information of the current frame within the current block, then if both the frame type and on / off control information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions. Or, if the feature information consists of the size information and on / off control information of the current block, then if both the size information and on / off control information meet specific conditions, it can be determined that the feature information of the current block meets specific conditions. Or, if the feature information consists of the frame type, size information, and on / off control information of the current frame within the current block, then if the frame type, size information, and on / off control information all meet specific conditions, it can be determined that the feature information of the current block meets specific conditions.

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

[0078] For example, the weight prediction angle represents the angular direction pointed to by the pixel positions within the current block. Referring to Figure 4B, 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 4C, 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.

[0079] 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 (such as 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 4B or Figure 4C.

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

[0081] Referring to Figure 4D, 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.

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

[0083] The value of N can be the same for different weight prediction angles. 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 surrounding positions determined based on weight prediction angle A is divided into 8 equal parts. For weight prediction angle B, the value of N is 8, which means that the range of surrounding positions determined based on weight prediction angle B is divided into 8 equal parts. However, the weight prediction positions for weight prediction angle A are selected from a1 to a5, a total of 5 positions, while the weight prediction positions for weight prediction angle B are selected from b0 to b6, a total of 7 positions.

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

[0085] After dividing all the surrounding positions into 8 equal parts, 7 weight prediction positions can be obtained. In step 401, 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.

[0086] 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, when 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, when 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 0.5, that is, the weight transformation rate is -0.5 or 0.5, it indicates that the rate of change of the reference weight value is 0.5. The reference weight changes from 0 to 8 through the following values: 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8. The reference weight changes from 8 to 0 through the following values: 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0. Of course, the above examples are from 0 to 8; 0 and 8 can be replaced with any numbers.

[0087] Step 402: 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 of the current block.

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

[0089] Step 403: 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.

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

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

[0092] The above are just a few examples of surrounding positions, and are not intended to be restrictive. In practical applications, in addition to using the external surrounding positions of the current block, internal positions of the current block can also be used, that is, the internal positions of the current block can replace the external surrounding positions. For example, the internal position located in row n5 of the current block, where n5 can be 1, 2, 3, etc. Another example is the internal position located in column n6 of the current block, where n6 can be 1, 2, 3, etc. The length of the internal position can exceed the boundaries of the current block; for example, the position in row n7 can extend outwards from both sides of the current block. Furthermore, both internal and external surrounding positions of the current block can be used simultaneously.

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

[0094] For example, the outer perimeter of the current block can be located between pixel positions, i.e., sub-pixel positions. In this case, the position 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.

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

[0096] 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; alternatively, the range of the surrounding positions outside the current block can be determined based on the weighted prediction angle. For instance, the surrounding positions pointed to by each pixel position inside the current block can be determined based on 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.

[0097] The location of the current block's outer perimeter can include integer pixel locations and / or non-integer pixel locations. Non-integer pixel locations can be sub-pixel locations, such as 1 / 2 sub-pixel locations, 1 / 4 sub-pixel locations, 3 / 4 sub-pixel locations, etc., and there are no restrictions on this.

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

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

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

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

[0102] In one possible implementation, the encoder determines the target weight value of the pixel position based on the reference weight values ​​associated with the surrounding matching positions, which may include the following cases.

[0103] Case 1: If the surrounding matching position is an integer pixel position and a reference weight value has been configured for that integer pixel position, then the target weight value of that pixel position is determined based on the reference weight value of that integer pixel position.

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

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

[0106] 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 that pixel position can be determined based on the reference weight values ​​of its neighboring positions. For example, the target weight value of the sub-pixel position can be obtained by rounding up the reference weight values ​​of the neighboring positions; or, the target weight value of the sub-pixel position can be obtained by rounding down the reference weight values ​​of the neighboring positions; or, the target weight value of the sub-pixel position can be determined by interpolation based on the reference weight values ​​of its neighboring positions. There are no restrictions on this approach.

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

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

[0109] 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, if the target weight value of that pixel location is 2, then the associated weight value of that pixel location is 6.

[0110] Step 406: For each pixel position in the current block, the encoder determines the first predicted value of the pixel position according to the first prediction mode of the current block, and determines the second predicted value of the pixel position according to the second prediction mode of the current block.

[0111] For example, the first prediction mode can be any one of the following: intra-block copy prediction mode, intra-frame prediction mode, inter-frame prediction mode, and palette mode; the second prediction mode can be any one of the following: intra-block copy prediction mode, intra-frame prediction mode, inter-frame prediction mode, and palette mode. For instance, the first prediction mode can be the intra-block copy prediction mode, and the second prediction mode can be the intra-block copy prediction mode; or, the first prediction mode can be the intra-block copy prediction mode, and the second prediction mode can be the intra-frame prediction mode; or, the first prediction mode can be the intra-block copy prediction mode, and the second prediction mode can be the inter-frame prediction mode; or, the first prediction mode can be the intra-block copy prediction mode, and the second prediction mode can be the palette mode; and so on. There are no restrictions on either the first or second prediction mode.

[0112] For details on the process of determining the predicted value based on the first and second prediction models, please refer to the following embodiments.

[0113] Step 407: 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.

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

[0115] Step 408: 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.

[0116] 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, making the predicted value of the current block closer to the original pixel, thereby improving the accuracy of prediction, improving prediction performance, and improving coding performance.

[0117] Example 3: Based on Example 1, this application proposes another encoding and decoding method. As shown in Figure 4F, which is a flowchart of the encoding and decoding method, this method can be applied to the decoding end and may include the following steps.

[0118] Step 411: When determining to initiate weighted prediction for the current block, the decoder obtains the weight prediction angle, weight prediction position, and weight transformation rate of the current block. For example, the decoder determines whether to initiate weighted prediction for the current block. If yes, step 411 and subsequent steps are executed; otherwise, the processing method is not limited in this application.

[0119] In one possible implementation, the encoder determines whether the feature information of the current block meets a specific condition. If it does, 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 it does, it determines to initiate weighted prediction for the current block; otherwise, it determines not to initiate weighted prediction for the current block. For details on how the decoder determines whether to initiate weighted prediction for the current block based on the feature information, please refer to step 401, which will not be elaborated here.

[0120] 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 RDO principle. After determining whether to initiate weighted prediction, the encoder, when sending the encoded bitstream of the current block, can include a syntax indicating whether to initiate weighted prediction. The decoder first determines whether the current block supports weighted prediction based on its feature information. If the current block supports weighted prediction, the decoder then parses the syntax from the encoded bitstream to determine whether to initiate weighted prediction and uses this syntax to determine whether to initiate weighted prediction for the current block.

[0121] 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 relevant explanations of the weight prediction angle, the weight prediction position, and the weight transformation rate, please refer to step 401, which will not be repeated here.

[0122] Step 412: 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.

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

[0124] Step 413: For each pixel position of the current block, the decoding end determines 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.

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

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

[0127] Step 416: For each pixel position in the current block, the decoder determines the first prediction value of the pixel position according to the first prediction mode of the current block, and determines the second prediction value of the pixel position according to the second prediction mode of the current block.

[0128] Step 417: 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.

[0129] Step 418: 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.

[0130] For example, the implementation process of steps 412-418 can be found in steps 402-408. The difference is that steps 412-418 are the processing flow of the decoding end, not the processing flow of the encoding end, and will not be described again here.

[0131] 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, making the predicted value of the current block closer to the original pixel, thereby improving the accuracy of prediction, improving prediction performance, and improving encoding and decoding performance.

[0132] Example 4: In Examples 1-3, 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-3 are used to predict the current block to obtain the predicted value of the current block.

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

[0134] In one possible implementation, the weight prediction angle can be a horizontal angle (angle 2 in Figure 7B); or, the weight prediction angle can be a vertical angle (angle 6 in Figure 7B); 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.

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

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

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

[0138] Example 5: In Examples 1-3 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.

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

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

[0141] 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 value 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 value 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 value 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 value. 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.

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

[0143] For example, referring to Figure 4D, after dividing all the surrounding positions into 8 equal parts, 7 weighted prediction positions can be obtained. When the weighted 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 weighted 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.

[0144] Example 6: In Examples 1 - 3, the encoding / decoding end needs to configure reference weight values for the peripheral positions outside the current block according to the weight transformation rate of the current block and the starting position of the weight transformation of the current block. In a possible implementation manner, the following method can be adopted: obtain the weight prediction angle of the current block, the weight transformation rate of the current block, and the weight prediction position of the current block, determine the starting position of the weight transformation of the current block based on the weight prediction position of the current block, determine the weight configuration parameters based on the starting position of the weight transformation and the weight transformation rate, that is, the weight configuration parameters include the starting position of the weight transformation and the weight transformation rate, and then determine the reference weight values of the peripheral positions outside the current block according to the weight configuration parameters.

[0145] The process of configuring reference weight values for the peripheral positions outside the current block will be described below in combination with specific implementation methods.

[0146] First, obtain a valid number of reference weight values, and then configure the reference weight values of the peripheral positions outside the current block according to the valid number of reference weight values.

[0147] Exemplarily, the number of peripheral positions outside the current block is the valid number, and a valid number of reference weight values need to be obtained. The 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 following method is used to determine the valid number ValidLength: ValidLength = (N + (M >> X)) << 1, where N is the height of the current block, M is the width of the current block, X is the base-2 logarithm of the absolute value of the slope of the weight prediction angle of the current block, such as 0 or 1, << represents left shift, and >> represents right shift.

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

[0149] In a possible implementation manner, for the valid number of reference weight values, they can be monotonically increasing, or monotonically decreasing. Or, for the valid number of reference weight values, they can first include multiple first weight values, and then include multiple second weight values, or first include multiple second weight values, and then include multiple first weight values. The following will be described in combination with several specific cases.

[0150] Case 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 [8 8...8 8 7 6 5 4 3 2 1 0 0...0 0], which is monotonically decreasing. Another example is [0 0...0 0 1 2 3 4 5 6 7 8 8...8 8], which is monotonically increasing. Of course, these are just examples and are not considered limitations.

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

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

[0153] 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(x) = Clip3(minimum, maximum, a*(xs)), where x represents the index of the surrounding position, that is, the value range of x is 1 to the effective number value. For example, if x is 1, it represents the first surrounding position. y(x) represents the reference weight value of the x-th surrounding position, a represents the weight transformation rate, s represents the starting position of the weight transformation, and the Clip3 function is used to restrict the reference weight value to be between the minimum and maximum values. The minimum and maximum values ​​can be configured based on experience. For ease of description, the following process will use a minimum value of 0 and a maximum value of 8 as an example.

[0154] '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.

[0155] '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.

[0156] In summary, in y(x) = 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 x outside the current block, the reference weight value y(x) 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, the functional relationship can be y(x) = Clip3(minimum, maximum, 2*(x-2)), and the reference weight value y(x) can be obtained for each surrounding position x outside the current block.

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

[0158] For example, the target region may include one reference weight value or at least two reference weight values. For instance, based on the starting position of the weight transformation, a reference weight value is determined, and the region corresponding to this reference weight value is taken as the target region. Or, based on the starting position of the weight transformation, at least two reference weight values ​​are determined, and the regions corresponding to these at least two reference weight values ​​are taken as the target region.

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

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

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

[0162] 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, wherein the second reference weight value and the third reference weight value are different. For example, the reference weight values ​​of the first neighboring region are all 0, the target region includes at least two reference weight values, whose reference weight values ​​monotonically increase from 1 to 7, and the reference weight values ​​of the second neighboring region are all 8, wherein the reference weight values ​​of the first neighboring region and the second neighboring region are different.

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

[0164] Scenario 2: For a valid number of reference weight values, multiple third values ​​can be included first, followed by multiple fourth values, or vice versa. For example, the valid number of reference weight values ​​can be [8 8...8 8 0 0...0 0] or [0 0...0 0 8 8...8 8]. 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 the s-th reference weight value (excluding the s-th reference weight value) are third values ​​(e.g., 8), and all reference weight values ​​after the s-th reference weight value (including the s-th reference weight value) are fourth values ​​(e.g., 0). Alternatively, all reference weight values ​​before the s-th reference weight value are fourth values, and all reference weight values ​​after the s-th reference weight value are third values.

[0165] After obtaining a valid number of reference weight values, configure the reference weight values ​​of the surrounding positions outside the current block based on the valid number of reference weight values.

[0166] For example, the number of surrounding locations outside the current block is a valid number, and the number of reference weight values ​​is also a valid number. Therefore, the valid number of reference weight values ​​can be configured as reference weight values ​​for the surrounding locations outside the current block. For instance, the first reference weight value can be configured as the reference weight value for the first surrounding location outside the current block, the second reference weight value can be configured as the reference weight value for the second surrounding location outside the current block, and so on.

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

[0168] 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, the Clip3 function 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.

[0169] Application Scenario 1: Determine the effective weight (also known as the reference weight effective length, or ValidLength) based on the current block size and the current block's weight prediction angle, and obtain the starting position FirstPos of the weight transformation. 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 from 0 to ValidLength-1; or from 1 to 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.

[0170] 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)].

[0171] 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)].

[0172] 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)].

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

[0174] 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 6, 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.

[0175] 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 6, 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.

[0176] 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 6, 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.

[0177] 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 6, 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.

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

[0179] For example, for the current block, when weight transformation rate switching is supported and initiated, one of the four types of weight transformation rate reference weight value distribution examples shown in Figure 6 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.

[0180] 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 parameter value, and ValidLength is only related to the size of the current block. FirstPos is related to the weight prediction angle, size, and position of the current block. Alternatively, the weight prediction angle of the current block can be configured to a fixed parameter value, and FirstPos is only related to the size and position of the current block. Or, the weight prediction position of the current block can be configured to a fixed parameter value, and FirstPos is only 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 parameter values, which can be the same or different, and FirstPos is only related to the size of the current block.

[0181] Example 7: In Examples 1-3, 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, respectively. As shown in Figure 7A, the weight array derivation method of the Angle Weighted Prediction Mode (AWP) includes:

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

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

[0184] Table 1

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

[0186] For example, stepIdx represents the weight prediction position (such as 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 index value of the weight prediction position is -3, for the second weight prediction position, the index value of the weight prediction position is -2, and so on, with the index value of the seventh weight prediction position being 3.

[0187] `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 7B, 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.

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

[0189] For example, modAngNum (angle number) can be determined first according to the following formula: modAngNum = AwpIdx % 8; then 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.

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

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

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

[0193] Table 2

[0194]

[0195] Step a2: Configure reference weight values ​​for the external perimeter positions of the current block based on stepIdx, angleIdx, and subAngleIdx. Step a2 can have the following cases.

[0196] 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 minimum reference weight value being 0, the maximum reference weight value being 8, and the weight transformation rate being 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, and the value of x ranges from 0 to ValidLength_H - 1. a represents the weight transformation rate.

[0197] 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 position outside the current block pointed to by the weight prediction angle can be the surrounding position 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 left shift is because the formula uses 1 / 2-pel precision. If it is 1-pel precision, then ValidLength_H = (N + (M >> angleIdx)); if it is 1 / 4-pel precision, then ValidLength_H = (N + (M >> angleIdx)) << 2; if it is 2-pel precision, then ValidLength_H = (N + (M >> angleIdx)) >> 1, and so on for other pixel precisions. In the subsequent formulas, the >>1 operations may change due to differences in pixel precision.

[0198] 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).

[0199] 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 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_H-1.

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

[0201] 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 ​​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_W-1.

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

[0203] 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).

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

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

[0206] 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`.

[0207] 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 7C, 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.

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

[0209] 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 of x ranges from 0 to M-1, and the value of y ranges from 0 to N-1.

[0210] 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 to M-1; the value range of y is 0 to N-1.

[0211] 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) and (y<<1)+((x<<1)>>angleIdx) represent the surrounding positions 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 to M-1; the value range of y is 0 to N-1.

[0212] 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 to M-1; the value range of y is 0 to N-1.

[0213] Steps a2 and a3 above can be combined into one step, that is, step a2 (configuring reference weight values ​​for the surrounding positions outside the current block based on stepIdx, angleIdx, and subAngleIdx) and step a3 (obtaining the brightness weight value based on angleIdx and the reference weight value ReferenceWeight[x]) are combined into: obtaining the brightness weight value of the pixel position based on stepIdx, angleIdx, and subAngleIdx, that is, determining it based on the coordinate values ​​of the surrounding positions and the coordinate values ​​of the starting position of the weight transformation.

[0214] Taking case one as an example: If subAngleIdx is 0, meaning the weight prediction angle is located in angle partition 0, and the weight prediction angle is either weight prediction angle 0 or weight prediction angle 1, then the starting position FirstPos of the weight transformation is determined using the following formula: FirstPos = (ValidLength_H>>1) - 6 + DeltaPos_H. Then, the brightness weight value of pixel position (x, y) is determined using 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). Other cases are similar.

[0215] Step a4: 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.

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

[0217] Another way to implement step a4 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].

[0218] 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)].

[0219] 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)].

[0220] 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)].

[0221] 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)].

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

[0223] The difference in the formulas for each case in steps a3 and a4 is shown in Figure 7D, 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 is similar to that of angle partition 1, except that the positions of (x,y) are swapped.

[0224] Example 8: In Examples 1-3, the encoding / decoding end 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 in the following way: First weight transformation rate indication information of the current block is obtained, and the weight transformation rate of the current block is determined based on this first weight transformation rate indication information. For example, if the first weight transformation rate indication information is a first indication information, then the weight transformation rate of the current block is the first weight transformation rate; if the first weight transformation rate indication information is a second indication information, then 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, then a preset weight transformation rate is determined as the weight transformation rate of the current block. The first weight transformation rate indication information can be obtained from the LCU, frame, image, sequence, etc., where the current block is located. For example, the first weight transformation rate indication information can be image-level indication information, such as PPS or PH-level indication information.

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

[0226] For example, if the handover control information allows the current block to enable the weight transformation rate handover mode, then the current block supports the weight transformation rate handover mode; if the handover control information does not allow the current block to enable the weight transformation rate handover mode, then the current block does not support the weight transformation rate handover mode. This handover control information may include, but is not limited to: sequence-level handover control information, frame-level handover control information, slice-level handover control information, tile-level handover control information, patch-level handover control information, CTU-level handover control information, LCU-level handover control information, block-level handover control information, CU-level handover control information, PU-level handover control information, etc.

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

[0228] 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 weight transformation rate switching mode, thus allowing the current block to enable 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 weight transformation rate switching mode, thus disallowing the current block to enable 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.

[0229] In one possible implementation, the first weight transformation rate indication information for the current block can be the SCC (Screen Content Coding) identifier corresponding to the current block. The first indication information indicates that the current block belongs to screen content coding, and the 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 the 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 the second weight transformation rate.

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

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

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

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

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

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

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

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

[0238] For example, Figure 8A shows a schematic diagram of an SCC sequence (i.e., a sequence belonging to screen content encoding), and Figure 8B shows a schematic diagram of a natural sequence (i.e., a sequence belonging to non-screen content encoding). For an SCC sequence, the color change is completed after one pixel, while for a natural sequence, the color change requires a transition of several pixels. In summary, SCC sequences often exhibit characteristics such as consistent color over large areas and color abrupt changes. Weighted prediction for SCC sequences should also adapt to these characteristics. Therefore, the weight values ​​in the AWP mode should reduce the smooth transition feature, i.e., increase the weight transformation rate to adapt to the characteristics of SCC sequences. 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. Furthermore, 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, i.e., the transformation speed increases. For example, as shown in Table 3, the actual performance gains (such as BD-rate performance gains) for SCC sequences are represented by the performance gain when the weight transformation rate is switched from 1 to 4. Table 3 shows that for the Y channel component of SCC sequence 1, switching the weight transformation rate from 1 to 4 results in a -1.83% BD-rate performance gain, equivalent to reducing the bitrate by 1.83% under the same objective quality conditions. For the U channel component of SCC sequence 1, switching the weight transformation rate from 1 to 4 reduces the bitrate by 1.19%, and for the V channel component, it reduces the bitrate by 1.05%. Switching the weight transformation rate from 1 to 4 keeps the encoding complexity unchanged, while increasing the decoding complexity by 101%. Switching the weight transformation rate from 1 to 4 also reduces the bitrate for other SCC sequences, thus increasing the performance gain.

[0239] Table 3

[0240]

[0241] In another possible implementation, the first weight transformation rate indication information for the current block can be a weight transformation rate switching identifier corresponding to the current block. The first indication information indicates that the current block does not need to undergo weight transformation rate switching, and the second indication information indicates that the current block needs to undergo weight transformation rate switching. 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 the weight transformation rate switching identifier. For example, if the weight transformation rate switching identifier indicates that the current block does not need to undergo weight transformation rate switching, then the weight transformation rate of the current block can be the first weight transformation rate; if the weight transformation rate switching identifier indicates that the current block needs to undergo weight transformation rate switching, then the weight transformation rate of the current block can be the 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. For example, the absolute value of the first weight transformation rate can be greater than the absolute value of the second weight transformation rate, such as the absolute value of the first weight transformation rate being 4, and the absolute value of the second weight transformation rate being 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 is 1. Alternatively, 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. For 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.

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

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

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

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

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

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

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

[0249] For example, a certain level of `refine_flag` refers to: sequence-level: indicating the `refine_flag` of the current sequence, serving as the `refine_flag` of all blocks belonging to the current sequence; frame-level: indicating the `refine_flag` of the current frame, serving as the `refine_flag` of all blocks belonging to the current frame; slice-level: indicating the `refine_flag` of the current slice, serving as the `refine_flag` of all blocks belonging to the current slice; tile-level: indicating the `refine_flag` of the current tile, serving as the `refine_flag` of all blocks belonging to the current tile; patch-level: indicating the `refine_flag` of the current patch, serving as... The `refine_flag` is defined for all blocks belonging to the current patch; at the CTU level, it indicates the `refine_flag` of the current CTU, which is used as the `refine_flag` for all blocks belonging to the current CTU; at the LCU level, it indicates the `refine_flag` of the current LCU, which is used as the `refine_flag` for all blocks belonging to the current LCU; at the block level, it indicates the `refine_flag` of the current block, which is used as the `refine_flag` for the current block; at the CU level, it indicates the `refine_flag` of the current CU, which is used as the `refine_flag` for the current CU; at the PU level, it indicates the `refine_flag` of the current PU, which is used as the `refine_flag` for the current PU. Of course, the above are just a few examples and are not considered a limitation.

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

[0251] Example 9: In Examples 1-3, the encoder / decoder needs to obtain the weight prediction angle and weight prediction position of the current block. In Example 8, 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.

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

[0253] 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 number 6. The encoding end sequentially traverses each weight prediction angle in the weight prediction angle list and each weight prediction position in the weight prediction position list, i.e., it traverses each combination of weight prediction angle and weight prediction position. For each combination of weight prediction angle and weight prediction position, using it as the weight prediction angle and weight prediction position obtained in step 401, steps 402-408 are executed based on this weight prediction angle, this weight prediction position, and the weight transformation rate (obtained in Example 8) to obtain the weighted prediction value of the current block.

[0254] For example, when the encoder iterates to weight prediction angle A and weight prediction position 0, it executes steps 402-408 based on weight prediction angle A and weight prediction position 0 to obtain the weighted prediction value A-0 for the current block. When the encoder iterates to weight prediction angle A and weight prediction position 1, it executes steps 402-408 based on weight prediction angle A and weight prediction position 1 to obtain the weighted prediction value A-1 for the current block. When the encoder iterates to weight prediction angle B and weight prediction position 0, it executes steps 402-408 based on weight prediction angle B and weight prediction position 0 to obtain the weighted prediction value B-0 for the current block, and so on. The encoder can obtain the corresponding weighted prediction value based on each combination (the combination of weight prediction angle and weight prediction position).

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

[0256] Then, the encoder combines the weight prediction angle and weight prediction position corresponding to the minimum RDO cost value as the target weight prediction angle and target weight prediction position, respectively. 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.

[0257] Of course, the above method is just an example and is not limited to it. As long as the weight prediction angle and weight prediction position of the current block can be obtained, it is acceptable. For example, a weight prediction angle can be randomly selected from the list of weight prediction angles as the weight prediction angle of the current block, and a weight prediction position can be randomly selected from the list of weight prediction positions as the weight prediction position of the current block.

[0258] For the decoding end, it constructs a weight prediction angle list, which is the same as the weight prediction angle list of the encoding end. This weight prediction angle list includes at least one weight prediction angle, such as weight prediction angle A and weight prediction angle B. The decoding end also constructs a weight prediction position list, which is the same as the weight prediction position list of the encoding end. This weight prediction position list includes at least one weight prediction position, such as weight prediction position 0 through weight prediction position number 6. After 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 of the current block based on the indication information, and selects a weight prediction position from the weight prediction position list as the weight prediction position of the current block based on the indication information.

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

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

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

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

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

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

[0265] 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 only include indication information 4 and 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.

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

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

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

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

[0270] Example 10: In Examples 1-3, 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 second weight transformation rate indication information of the current block; select the weight transformation rate corresponding to the second 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.

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

[0272] 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 8.

[0273] In one possible implementation, the preset lookup table may include at least two weight transformation rates, and the second weight transformation rate indication information may include weight transformation rate index information (used to indicate a certain 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.

[0274] For the encoder, if there is only one lookup table, for each weight transformation rate in the lookup table, the encoder can determine the RDO cost corresponding to that weight transformation rate, and take the weight transformation rate corresponding to the smallest RDO 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.

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

[0276] In another possible implementation, the preset lookup table may include at least two lookup tables, each of which may include at least one weight transformation rate. The second weight transformation rate indication information may include lookup table index information (used to indicate a specific lookup table among all lookup tables) and 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, a target lookup table corresponding to the lookup table index information can be selected from at least two lookup tables, and a weight transformation rate corresponding to the weight transformation rate index information can be selected from the target lookup table.

[0277] For example, the preset lookup table may include a first lookup table and a second lookup table. The maximum absolute value of the weight transformation rate included in the second lookup table is greater than the maximum absolute value of the weight transformation rate included in the first lookup table. For instance, if the absolute values ​​of the weight transformation rates included in the second lookup table are 4 and 8, and the absolute values ​​of the weight transformation rates included in the first lookup table are 5 and 7, then the maximum absolute value of the weight transformation rate included in the second lookup table is 8, and the maximum absolute value of the weight transformation rate included in the first lookup table is 7. The absolute values ​​of the weight transformation rates included in the second lookup table are not entirely the same as those included in the first lookup table. For instance, if the absolute values ​​of the weight transformation rates included in the second lookup table are 4 and 8, and the absolute values ​​of the weight transformation rates included in the first lookup table are 1, 2, and 4, then the absolute values ​​of the weight transformation rates included in the two lookup tables are not entirely the same. Alternatively, the absolute values ​​of the weight transformation rates included in the second lookup table are completely different from the absolute values ​​of the weight transformation rates included in the first lookup table. For example, the absolute values ​​of the weight transformation rates included in the second lookup table are 4 and 8, while the absolute values ​​of the weight transformation rates included in the first lookup table are 1 and 2. The absolute values ​​of the weight transformation rates included in the two lookup tables are completely different.

[0278] For example, the second weight transformation rate indication information includes lookup table index information and weight transformation rate index information. The lookup table index information can be the SCC identifier corresponding to the current block, and the SCC identifier is used to indicate that the current block belongs to screen content encoding, or the SCC identifier is used to indicate that the current block belongs to non-screen content encoding. If the SCC identifier is used to indicate that the current block belongs to non-screen content encoding, then the target lookup table corresponding to the SCC identifier is the first lookup table. If the SCC identifier is used to indicate that the current block belongs to screen content encoding, then the target lookup table corresponding to the SCC identifier is the second lookup table.

[0279] In summary, we can obtain the SCC identifier (i.e., lookup table index information) and weight transformation rate index information corresponding to the current block. If the SCC identifier indicates that the current block belongs to non-screen content encoding, the target lookup table is determined to be the first lookup table, and the weight transformation rate corresponding to the weight transformation rate index information is selected from the first lookup table. The selected weight transformation rate is then determined as the weight transformation rate of the current block. If the SCC identifier indicates that the current block belongs to screen content encoding, the target lookup table is determined to be the second lookup table, and the weight transformation rate corresponding to the weight transformation rate index information is selected from the second lookup table. The selected weight transformation rate is then determined as the weight transformation rate of the current block. Thus, the weight transformation rate of the current block is successfully obtained.

[0280] For the encoding end, the process of obtaining the SCC identifier can be found in Example 8, and will not be repeated here.

[0281] If the SCC identifier is used to indicate that the current block belongs to non-screen content encoding, the target lookup table can be a first lookup table. For each weight transformation rate in the first lookup table, the encoder determines the RDO cost corresponding to that weight transformation rate, and uses the weight transformation rate corresponding to the smallest RDO cost as the target weight transformation rate for the current block. The index information of the target weight transformation rate in the first lookup table is then determined, i.e., the weight transformation rate index information. If the SCC identifier is used to indicate that the current block belongs to screen content encoding, the target lookup table can be a second lookup table. For each weight transformation rate in the second lookup table, the encoder determines the RDO cost corresponding to that weight transformation rate, and uses the weight transformation rate corresponding to the smallest RDO cost as the target weight transformation rate for the current block. The index information of the target weight transformation rate in the second lookup table is then determined, i.e., the weight transformation rate index information. This weight transformation rate index information indicates which weight transformation rate in the second lookup table.

[0282] For the decoding end, the process of obtaining the SCC identifier can be found in Example 8, and will not be repeated here.

[0283] When the encoder sends the encoded bitstream of the current block to the decoder, the encoded bitstream may carry weight transformation rate index information. This index information indicates the index of the target weight transformation rate in a first lookup table or a second lookup table. If the SCC identifier indicates that the current block belongs to non-screen content encoding, the target lookup table can be the first lookup table. The decoder selects the weight transformation rate corresponding to the weight transformation rate index information (which indicates the nth weight transformation rate in the first lookup table) from the first lookup table, and this weight transformation rate is used as the weight transformation rate of the current block. If the SCC identifier indicates that the current block belongs to screen content encoding, the target lookup table can be the second lookup table. The decoder selects the weight transformation rate corresponding to the weight transformation rate index information (which indicates the nth weight transformation rate in the second lookup table) from the second lookup table, and this weight transformation rate is used as the weight transformation rate of the current block.

[0284] Example 11: In Examples 1-3, the encoder / decoder needs to obtain the weight prediction angle, weight prediction position, and weight transformation rate of the current block. In Example 10, 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:

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

[0286] 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 to weight prediction position number 6. 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 10, 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; that is, it traverses a combination of each weight prediction angle, each weight prediction position, and each weight transformation rate. For each combination of weight prediction angle, weight prediction position and weight transformation rate, as the weight prediction angle, weight prediction position and weight transformation rate obtained in step 401, steps 402-408 are executed based on the weight prediction angle, weight prediction position and weight transformation rate to obtain the weighted prediction value of the current block.

[0287] In summary, the encoder can obtain the weighted prediction value for the current block based on each combination (i.e., the combination of weight prediction angle, weight prediction position, and weight transformation rate). After obtaining the weighted prediction values ​​for each block, the encoder can determine the corresponding RDO cost value based on the weighted prediction value for each block. There are no restrictions on how this RDO cost value is determined. The encoder can obtain the RDO cost value for each combination and select the minimum RDO cost value from all RDO cost values.

[0288] Then, the encoder uses the weight prediction angle, weight prediction position, and weight transformation rate corresponding to the minimum RDO 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.

[0289] 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. Finally, the decoding end constructs a lookup table, which is the same as the 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 the 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 9 and will not be repeated here. After receiving the encoded bitstream of the current block, the decoding end can determine the target lookup table (such as the first lookup table and 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 10 and will not be repeated here.

[0290] Example 12: In Examples 1-3 above, it is necessary to determine the first predicted value of the pixel position according to the first prediction mode, and to determine the second predicted value of the pixel position according to the second prediction mode.

[0291] In this embodiment, the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode, as an example for explanation.

[0292] Case 1: Both the first and second prediction modes are inter-frame prediction modes. A motion information candidate list is obtained, containing at least two candidate motion information items. One candidate motion information item is selected from the list as the first target motion information for the current block, and the other is selected as the second target motion information for the current block. For each pixel position in the current block, a first predicted value is determined based on the first target motion information, and a second predicted value is determined based on the second target motion information.

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

[0294] For example, the candidate motion information in the motion information candidate list is all single-hypothetical motion information. For instance, the candidate motion information in the motion information candidate list is only unidirectional motion information, not bidirectional motion information. Clearly, since the candidate motion information is all single-hypothetical motion information, the motion information candidate list can be a unidirectional motion information candidate list.

[0295] The process of obtaining the candidate list of motion information can be found in subsequent embodiments, and will not be repeated here.

[0296] For the encoding end, based on the RDO 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.

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

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

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

[0300] 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 obtains the difference between index value 2 and index value 1, and then determines index value 2 based on this difference and index value 1. Finally, 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.

[0301] Regarding the process by which the encoder / decoder determines the first predicted value of the pixel position based on the first target motion information and the second predicted value of the pixel position based on the second target motion information, please refer to the inter-frame prediction process; no restrictions are imposed on this process.

[0302] For example, when determining the first predicted value of a pixel position based on the motion information of the first target, an inter-frame weighted prediction mode can be used to obtain the first predicted value of the pixel position. For instance, firstly, an initial predicted value of the pixel position is determined using the motion information of the first target, and then this initial predicted value is multiplied by a preset factor to obtain an adjusted predicted value. If the adjusted predicted value is greater than the maximum predicted value, the maximum predicted value is used as the first predicted value of the current block; if the adjusted predicted value is less than the minimum predicted value, the minimum predicted value is used as the first predicted value of the current block; if the adjusted predicted value is not less than the minimum predicted value and not greater than the maximum predicted value, the adjusted predicted value is used as the first predicted value of the current block. Of course, the above method is just an example and is not intended to limit the scope of the prediction.

[0303] Similarly, when determining the second predicted value of the pixel position based on the motion information of the second target, the second predicted value of the pixel position can also be obtained by using the inter-frame weighted prediction mode. For the specific implementation method, please refer to the example above, which will not be repeated here.

[0304] Scenario 2: Both the first and second prediction modes are inter-frame prediction modes. A first motion information candidate list and a second motion information candidate list are obtained. The first and second motion information candidate lists each include at least one candidate motion information. A candidate motion information is selected from the first motion information candidate list as the first target motion information for the current block, and a candidate motion information is selected from the second motion information candidate list as the second target motion information for the current block. For each pixel position in the current block, a first predicted value is determined based on the first target motion information; a second predicted value is determined based on the second target motion information.

[0305] For example, both the encoding end and the decoding end can obtain a first motion information candidate list and a second motion information candidate list, and the first motion information candidate list of the encoding end is the same as the first motion information candidate list of the decoding end, and the second motion information candidate list of the encoding end is the same as the second motion information candidate list of the decoding end.

[0306] The candidate motion information in the first motion information candidate list is all single-hypothetical motion information; that is, the candidate motion information in the first motion information candidate list is only unidirectional motion information, not bidirectional motion information. Clearly, since the candidate motion information is all single-hypothetical motion information, the first motion information candidate list can be a unidirectional motion information candidate list.

[0307] The candidate motion information in the second motion information candidate list is all single-hypothesis motion information; that is, the candidate motion information in the second motion information candidate list is only unidirectional motion information, not bidirectional motion information. Clearly, since the candidate motion information is all single-hypothesis motion information, the second motion information candidate list can be a unidirectional motion information candidate list.

[0308] For the process of obtaining the first motion information candidate list and the second motion information candidate list, please refer to the following embodiments.

[0309] For the encoding end, based on the RDO principle, a candidate motion information can be selected from the first motion information candidate list as the first target motion information of the current block, and a candidate motion information can be selected from the second 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.

[0310] When the encoding end sends the encoded bitstream to the decoding end, the encoded bitstream carries 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 in the first motion information candidate list it is. 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 in the second motion information candidate list it is. After receiving the encoded bitstream, the decoding end parses the indication information 'a' and indication information 'b' from it. Based on indication information 'a', it selects the candidate motion information corresponding to index value 1 from the first motion information candidate list, and this candidate motion information is used as the first target motion information in the current block. Based on indication information 'b', it selects the candidate motion information corresponding to index value 2 from the second motion information candidate list, and this candidate motion information is used as the second target motion information in the current block.

[0311] In the above scenario, the indication information of the prediction information of the first prediction mode and the second prediction mode can be interchanged, as long as the encoding and decoding ends are consistent. This interchange of indication information does not affect the parsing process, meaning there is no parsing dependency. However, when using the same prediction mode candidate list, the indication information of the first prediction mode and the second prediction mode cannot be equal. For example, assuming two index values ​​are encoded, index a is 1 and index b is 3. If index a is encoded first, index b can be encoded as 2 (3-1). If index b is encoded first, then index b needs to be encoded as 3. In summary, encoding the indication information of the smaller index value first can reduce the encoding cost of the larger index value. Given the prediction mode candidate list construction method, the first prediction mode is highly likely to come from the left. Adjusting the encoding and decoding ends based on this prior allows us to encode the indication information of the prediction information adjacent to the left region first.

[0312] The following explanation focuses on Case 1; other cases are similar. In Case 1, the prediction mode candidate list can be a motion information candidate list. The prediction information of the first prediction mode can be the first target motion information, and the prediction information of the second prediction mode can be the second target motion information. In the encoded bitstream, the indication information of the first target motion information, such as index value a, is 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, index value a is encoded first, followed by index value b. Or, for another example, assuming index value b is 1 and index value a is 3, index value b is encoded first, followed by index value a.

[0313] Example 13: In Examples 1-3 above, it is necessary to determine a first predicted value for the pixel position according to a first prediction mode, and a second predicted value for the pixel position according to a second prediction mode. For example, the first prediction mode can be any one of the following: intra-block copy prediction mode, intra-frame prediction mode, inter-frame prediction mode, and palette mode; the second prediction mode can be any one of the following: intra-block copy prediction mode, intra-frame prediction mode, inter-frame prediction mode, and palette mode.

[0314] In this embodiment, the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode, as an example for explanation. Since the first prediction mode is an inter-frame prediction mode, determining the first predicted value of the pixel position based on the first prediction mode of the current block may include: obtaining a motion information candidate list, which includes at least one candidate motion information; selecting a candidate motion information from the motion information candidate list as the original motion information of the current block; determining the target motion information of the current block based on the original motion information; and determining the first predicted value of the pixel position based on the target motion information.

[0315] Scenario 1: Both the first and second prediction modes are inter-frame prediction modes. A motion information candidate list is obtained, which may include at least two candidate motion information pieces. One candidate motion information is selected from this list as the first original motion information for the current block, and another candidate motion information is selected as the second original motion information for the current block. The first and second original motion information are different. Then, the first target motion information for the current block is determined based on the first original motion information, and the second target motion information for the current block is determined based on the second original motion information. For each pixel position in the current block, a first predicted value for that pixel position is determined based on the first target motion information, and a second predicted value for that pixel position is determined based on the second target motion information.

[0316] The process of obtaining the motion information candidate list can be found in subsequent embodiments and will not be repeated here. The process of determining the first predicted value based on the first target motion information and the second predicted value based on the second target motion information can be found in Embodiment 12 and will not be repeated here. Unlike Embodiment 12, in Embodiment 13, the candidate motion information selected from the motion information candidate list is used as the original motion information, rather than as the target motion information. After obtaining the original motion information, the target motion information can also be obtained based on the original motion information; the specific acquisition process can be found in subsequent embodiments.

[0317] Case 2: The first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode. A first motion information candidate list and a second motion information candidate list are obtained. The first motion information candidate list includes at least one candidate motion information, and the second motion information candidate list includes at least one candidate motion information. A candidate motion information is selected from the first motion information candidate list as the first original motion information of the current block. The first target motion information of the current block is determined based on the first original motion information. A candidate motion information is selected from the second motion information candidate list as the second original motion information of the current block. The second target motion information of the current block is determined based on the second original motion information. For each pixel position of the current block, a first predicted value for that pixel position is determined based on the first target motion information; a second predicted value for that pixel position is determined based on the second target motion information. Unlike Example 12, in Example 13, the candidate motion information selected from the motion information candidate list is used as the original motion information, rather than as the target motion information. After obtaining the original motion information, the target motion information can also be obtained based on the original motion information; the specific acquisition process is described in subsequent examples.

[0318] In summary, regarding the above situation, when the prediction mode is inter-frame prediction mode, a motion information candidate list can be obtained, which includes at least one candidate motion information. Then, a candidate motion information can be selected from this list as the original motion information for the current block, and a first target motion information is determined based on the first original motion information, and a second target motion information is determined based on the second original motion information. Finally, the predicted value of the pixel position is determined based on the target motion information.

[0319] Regarding how to determine the target motion information based on the original motion information, this embodiment provides a scheme of superimposing unidirectional motion information with motion vector refinement. For example, the original motion information includes the original motion vector, and the target motion information includes the target motion vector. In order to determine the target motion vector of the current block based on the original motion vector, the motion vector difference (MVD) corresponding to the original motion vector can be obtained, and the target motion vector can be determined based on the motion vector difference and the original motion vector. That is, the sum of the motion vector difference and the original motion vector is used as the target motion vector.

[0320] Example 14: Based on Example 13, the direction and amplitude information of the motion vector difference are defined. If the direction information indicates a rightward direction and the amplitude information indicates an amplitude of Ar, then the motion vector difference is (Ar, 0); if the direction information indicates a downward direction and the amplitude information indicates an amplitude of Ad, then the motion vector difference is (0, -Ad); if the direction information indicates a leftward direction and the amplitude information indicates an amplitude of Al, then the motion vector difference is (-Al, 0); if the direction information indicates an upward direction and the amplitude information indicates an amplitude of Au, then the motion vector difference is... (0, Au); if the direction information indicates the direction is to the upper right and the amplitude information indicates the amplitude is Aru, then the motion vector difference is (Aru, Aru); if the direction information indicates the direction is to the upper left and the amplitude information indicates the amplitude is Alu, then the motion vector difference is (-Alu, Alu); if the direction information indicates the direction is to the lower left and the amplitude information indicates the amplitude is Ald, then the motion vector difference is (-Ald, -Ald); if the direction information indicates the direction is to the lower right and the amplitude information indicates the amplitude is Ard, then the motion vector difference is (Ard, -Ard).

[0321] It should be noted that the above amplitude values ​​Ar, Ad, Al, Au, Aru, Alu, Ald, and Ard each represent a set of values. The values ​​in the amplitude sets in different directions can be completely the same, partially the same, or completely different.

[0322] For example, the motion vector difference can support some or all of the above-mentioned directional information. The range of values ​​for the amplitude supported by the motion vector difference can be configured based on experience, and there can be at least one value, without limitation.

[0323] For example, the motion vector difference supports four directions: up, down, left, and right. It supports five step size configurations: 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, meaning the amplitude 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), or (-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).

[0324] For example, the motion vector difference supports four directions: up, down, left, and right. It supports six step size configurations: 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, meaning the amplitude can be 1, 2, 4, 8, 12, or 16. In summary, when the direction is upward, the motion vector difference can be (0, 1), (0, 2), (0, 4), (0, 8), (0, 12), or (0, 16). The implementation of motion vector differences in other directions is similar to that for "up," and will not be elaborated further here.

[0325] 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 three step size configurations: 1 / 4-pel, 1 / 2-pel, and 1-pel, meaning the amplitude can be 1, 2, or 4. In summary, when the direction is upper left, the motion vector difference can be (-1, 1), (-2, 2), or (-4, 4); when the direction is upper right, the motion vector difference can be (1, 1), (2, 2), or (4, 4). The implementation of motion vector differences in other directions is similar to that of "upper left" and "upper right," and the values ​​of the motion vector difference are as specified above and will not be repeated here.

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

[0327] Of course, the above are just a few examples and are not intended to be restrictive. For example, the directions supported by motion vector interpolation can be arbitrarily selected, such as supporting six directions: up, down, left, right, upper left, and lower left, or two directions: up and down. Another example is that the step size configuration supported by motion vector interpolation 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 the quantization parameter (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.

[0328] 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).

[0329] For the encoding end, after obtaining the candidate list of motion information, each candidate motion vector in the list is traversed sequentially. When candidate motion vector 1 is encountered, the sum of candidate motion vector 1 and the difference between the two motion vectors (0, 4) is taken as candidate motion vector 1-1, and the RDO value 1-1 corresponding to candidate motion vector 1-1 is determined. This determination process is not restricted. The sum of candidate motion vector 1 and the difference between the two motion vectors (0, 8) is taken as candidate motion vector 1-2, and the RDO value 1-2 corresponding to candidate motion vector 1-2 is determined. The sum of candidate motion vector 1 and the difference between the two motion vectors (0, -4) is taken as candidate motion vector 1-3, and the RDO value 1-3 corresponding to candidate motion vector 1-3 is determined. The sum of candidate motion vector 1 and the difference between the two motion vectors (0, -8) is taken as candidate motion vector 1-4, and the RDO value 1-4 corresponding to candidate motion vector 1-4 is determined.

[0330] Similarly, for each candidate motion vector encountered, the above method can be used to obtain the RDO value. After traversing all candidate motion vectors, the smallest RDO value is selected from all RDO values. Assuming RDO value 1-1 is the smallest, the encoder can encode the following in the encoded bitstream: the index of candidate motion vector 1 in the motion information candidate list, the direction information and magnitude information of the motion vector difference (0, 4). The direction information indicates that the direction of the motion vector difference (0, 4) is upward, and the magnitude information indicates that the magnitude of the motion vector difference (0, 4) is 4. For example, the direction information could be 0, indicating the first direction in the direction list (up, down), and the magnitude information could be 4, indicating the first step size configuration in the step size configuration list (1-pel, 2-pel). Of course, the above process is just a simplified example and is not limited thereto, as long as the direction and magnitude information can be represented.

[0331] For example, when 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), 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.

[0332] For example, when 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), 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.

[0333] For example, when 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), 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.

[0334] For example, when the motion vector difference supports four directions (up, down, left, right) and four step size configurations (1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel), 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).

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

[0336] In summary, from the encoding perspective, the optimal motion vector can be searched within a certain region. The difference between the optimal motion vector and the candidate motion vectors is then used as the motion vector difference. The magnitude and direction information of this motion vector difference are encoded into the bitstream, along with the index value of the candidate motion vector in the motion information candidate list. When searching for the optimal motion vector within a certain region, the encoding end needs to define the direction and magnitude of the motion vector difference. Specifically, the optimal motion vector is searched within the defined range of motion vector differences such as (Ar, 0), (0, -Ad), (-Al, 0), (0, Au), (Aru, Aru), (-Alu, Alu), (-Ald, -Ald), and (Ard, -Ard), rather than searching for the optimal motion vector within an arbitrary range of motion vector differences.

[0337] For the decoding end, after receiving the encoded bitstream of the current block, it can parse the index value of the candidate motion vector in the motion information candidate list from the encoded bitstream, and select the candidate motion vector corresponding to that index value from the motion information candidate list, using this candidate motion vector as the original motion vector of the current block. The decoding end can also parse the direction information and amplitude information of the motion vector difference from the encoded bitstream, and determine the motion vector difference based on this direction information and amplitude information.

[0338] Then, the decoding end can determine the target motion vector of the current block based on the motion vector difference and the original motion vector. For example, the sum of the motion vector difference and the original motion vector can be used as the target motion vector of the current block.

[0339] Referring to the above embodiments, when determining the motion vector difference based on direction information and amplitude information, if the direction information indicates a direction to the right and the amplitude information indicates an amplitude of Ar, then the motion vector difference is (Ar, 0); if the direction information indicates a direction downward and the amplitude information indicates an amplitude of Ad, then the motion vector difference is (0, -Ad); if the direction information indicates a direction to the left and the amplitude information indicates an amplitude of Al, then the motion vector difference is (-Al, 0); if the direction information indicates a direction upward and the amplitude information indicates an amplitude of Au, then the motion vector difference is (0, -Ad). If the direction information indicates the direction is to the upper right and the amplitude information indicates the amplitude is Aru, then the motion vector difference is (Aru, Aru); if the direction information indicates the direction is to the upper left and the amplitude information indicates the amplitude is Alu, then the motion vector difference is (-Alu, Alu); if the direction information indicates the direction is to the lower left and the amplitude information indicates the amplitude is Ald, then the motion vector difference is (-Ald, -Ald); if the direction information indicates the direction is to the lower right and the amplitude information indicates the amplitude is Ard, then the motion vector difference is (Ard, -Ard).

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

[0341] 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 amplitude value 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.

[0342] In summary, the decoding end can parse the direction and magnitude information of the motion vector difference from the encoded bitstream. After parsing the direction and magnitude information, the motion vector difference can be determined based on the direction and magnitude information.

[0343] In one possible implementation, the encoder may also encode flag information in the encoded bitstream, indicating whether to superimpose the motion vector difference on the original motion vector or not. This flag information may be a sub-mode flag for the Enhanced Angle Weighted Prediction (AWP) mode; furthermore, the AWP mode may also be referred to as the AWP with Motion Vector Refinement (AWP-MVR) mode. Upon receiving the encoded bitstream of the current block, the decoder first parses this flag information from the encoded bitstream of the current block. If the flag information indicates that the motion vector difference is superimposed on the original motion vector, the decoder parses the direction and magnitude information of the motion vector difference from the encoded bitstream of the current block, determines the motion vector difference based on this direction and magnitude information, and then determines the target motion vector of the current block based on the original motion vector and the motion vector difference. If the flag information indicates that the motion vector difference is not superimposed on the original motion vector, the decoder does not parse the direction and magnitude information of the motion vector difference and directly uses the original motion vector as the target motion vector of the current block.

[0344] For example, when the sub-mode flag of the enhanced angle-weighted prediction mode is the first sub-mode value, it indicates that the motion vector difference is superimposed on the original motion vector; when the sub-mode flag of the enhanced angle-weighted prediction mode is the second sub-mode value, it indicates that the motion vector difference is not superimposed on the original motion vector. The first and second sub-mode values ​​can be configured empirically, such as the first sub-mode value being 1 and the second sub-mode value being 0, or the first sub-mode value being 0 and the second sub-mode value being 1. Of course, the above are just two examples and are not intended to be restrictive.

[0345] In one possible implementation, for case 1 or case 2 of embodiment 13, the first original motion information includes a first original motion vector, the first target motion information includes a first target motion vector, the second original motion information includes a second original motion vector, and the second target motion information includes a second target motion vector. Based on this, a first motion vector difference corresponding to the first original motion vector can be obtained, and the first target motion vector can be determined according to the first motion vector difference and the first original motion vector, that is, the sum of the first motion vector difference and the first original motion vector is used as the first target motion vector. Similarly, a second motion vector difference corresponding to the second original motion vector can be obtained, and the second target motion vector can be determined according to the second motion vector difference and the second original motion vector, that is, the sum of the second motion vector difference and the second original motion vector is used as the second target motion vector.

[0346] For the encoding end, the RDO principle can be used to determine the first motion vector difference corresponding to the first original motion vector, and the second motion vector difference corresponding to the second original motion vector. The determination process will not be elaborated here.

[0347] When the encoder sends the encoded bit stream of the current block to the decoder, the encoded bit stream can carry the direction and amplitude information of the first motion vector difference, as well as the direction and amplitude information of the second motion vector difference.

[0348] For the decoding end, after receiving the encoded bitstream of the current block, the decoding end can 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 of the first motion vector difference. It can also 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 of the second motion vector difference. Then, the decoding end can determine the first target motion vector of the current block based on the first motion vector difference and the first original motion vector, and determine the second target motion vector of the current block based on the second motion vector difference and the second original motion vector.

[0349] 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 whether the motion vector difference is superimposed on the first original motion vector, or whether the motion vector difference is not superimposed on the first original motion vector. The second sub-mode flag indicates whether the motion vector difference is superimposed on the second original motion vector, or whether the motion vector difference is not superimposed on the second original motion vector.

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

[0351] 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 the motion vector difference is superimposed on the first original motion vector, 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 of the first motion vector difference. Then, the first target motion vector of the current block is determined based on the first original motion vector and the first motion vector difference. If the first sub-mode flag indicates that the motion vector difference is not superimposed on the first original motion vector, then the direction information and amplitude information of the first motion vector difference are not parsed, and the first original motion vector can be directly used as the first target motion vector of the current block. If the second sub-mode flag indicates that the motion vector difference is superimposed on the second original motion vector, 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 of the second motion vector difference. Then, the second target motion vector of the current block is determined based on the second original motion vector and the second motion vector difference. If the second submode flag indicates that the motion vector difference is not superimposed on the second original motion vector, then the direction and magnitude information of the second motion vector difference will not be parsed, and the second original motion vector can be directly used as the second target motion vector of the current block.

[0352] Example 15: Based on Examples 13 and 14, for the case of two motion vector differences, the following describes the relevant syntax of superimposing unidirectional motion information into motion vector differences in conjunction with several specific application scenarios.

[0353] Application Scenario 1: See Table 4 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.

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

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

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

[0357] `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.

[0358] `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.

[0359] `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.

[0360] `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.

[0361] `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.

[0362] `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.

[0363] `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.

[0364] Table 4

[0365]

[0366]

[0367] Application Scenario 2: See Table 5 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.

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

[0369] `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.

[0370] `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.

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

[0372] Table 5

[0373]

[0374]

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

[0376] Application Scenario 3: Application Scenario 1 and Application Scenario 2 can be derived to fully integrate AWP 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 four directions: up, down, left, and right. It also supports six step size configurations: 0-pel, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, effectively adding a 0-pel step size configuration. Based on this, Tables 4 and 5 can be updated to Table 6. The meanings of the relevant syntax in Table 6 can be found in Table 4 and will not be repeated here.

[0377] Table 6

[0378]

[0379] For example, in the above embodiments, target motion information can be obtained based on the original motion information. After obtaining the target motion information, the target motion information of the current block can also be stored, and there are no restrictions on this storage method.

[0380] Example 16: In Examples 12 and 13, it is necessary to obtain a candidate list of motion information. During the process of obtaining the candidate list, at least one available motion information to be added to the candidate list can be obtained. Based on at least one available motion information, the candidate list of motion information is obtained. For example, for the available motion information to be added to the candidate list, if the available motion information is unidirectional motion information, and the unidirectional motion information does not overlap with any existing candidate motion information in the candidate list, then the unidirectional motion information is added to the candidate list. If the available motion information is bidirectional motion information, and the first unidirectional motion information in the bidirectional motion information does not overlap with any existing candidate motion information in the candidate list, then the first unidirectional motion information is added to the candidate list. If the available motion information is bidirectional motion information, and the first unidirectional motion information in the bidirectional motion information overlaps with any existing candidate motion information in the candidate list, and the second unidirectional motion information in the bidirectional motion information does not overlap with any existing candidate motion information in the candidate list, then the second unidirectional motion information is added to the candidate list.

[0381] For example, the first unidirectional motion information is unidirectional motion information pointing to a reference frame in the first reference frame list, and the second unidirectional motion information is unidirectional motion information pointing to a reference frame in the second reference frame list.

[0382] In one possible implementation, if the total number of existing candidate motion information in the motion information candidate list (i.e., the total number of existing candidate motion information for the current block) is even, then the first reference frame list is reference frame list List0, and the second reference frame list is reference frame list List1; if the total number of existing candidate motion information in the motion information candidate list is odd, then the first reference frame list is reference frame list List0, and the second reference frame list is reference frame list List1. Alternatively, if the total number of existing candidate motion information in the motion information candidate list is odd, then the first reference frame list is reference frame list List0, and the second reference frame list is reference frame list List1; if the total number of existing candidate motion information in the motion information candidate list is even, then the first reference frame list is reference frame list List0, and the second reference frame list is reference frame list List1.

[0383] In another possible implementation, the first reference frame list is reference frame list List0, and the second reference frame list is reference frame list List1; or, the first reference frame list is reference frame list List1, and the second reference frame list is reference frame list List0.

[0384] In the above embodiments, at least one available motion information to be added to the motion information candidate list may include, 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.

[0385] For example, the aforementioned motion information candidate list can be a unidirectional motion information candidate list. Referring to Figure 9, which is a schematic diagram of the current block and its neighboring blocks, the process of obtaining the motion information candidate list involves adding unidirectional spatial motion information to the list and checking for duplicates based on the order F, G, C, A, B, D. Similarly, adding unidirectional temporal motion information to the list and checking for duplicates is also performed. Finally, if the motion information candidate list is not full, a duplicate filling operation is performed. Of course, the order F, G, C, A, B, D is just an example; other orders can be used, and there are no restrictions on this.

[0386] The so-called deduplication process involves comparing the motion information to be added to the motion information candidate list with each existing candidate motion information in the motion information candidate list. If it does not overlap with any of the existing candidate motion information in the motion information candidate list, it is considered non-duplicate; if it overlaps with any existing candidate motion information in the motion information candidate list, it is considered duplicate.

[0387] The following section explains the process of obtaining the candidate list of motion information using several specific application scenarios.

[0388] Application Scenario 1: Spatial motion information and temporal motion information are added together to the motion information candidate list.

[0389] The first step, referring to Figure 9, involves determining the "availability" of motion information for the current block E, where F, G, C, A, B, and D are the neighboring prediction blocks of the current block E. For example, if F exists and uses inter-frame prediction mode, then the motion information of F is available; otherwise, it is unavailable. Similarly, if G exists and uses inter-frame prediction mode, then the motion information of G is available; otherwise, it is unavailable. If C exists and uses inter-frame prediction mode, then the motion information of C is available; otherwise, it is unavailable. If A exists and uses inter-frame prediction mode, then the motion information of A is available; otherwise, it is unavailable. If B exists and uses inter-frame prediction mode, then the motion information of B is available; otherwise, it is unavailable. If D exists and uses inter-frame prediction mode, then the motion information of D is available; otherwise, it is unavailable.

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

[0391] Scenario 1: For available motion information to be added to the motion information candidate list, if the available motion information is bidirectional motion information (i.e., includes unidirectional motion information pointing to reference frame list List0 and unidirectional motion information pointing to reference frame list List1), determine how to add the available motion information to the motion information candidate list AwpUniArray based on the parity of the total number of existing candidate motion information in the motion information candidate list (i.e., the current length of the motion information candidate list AwpUniArray). For simplicity, this available motion information can be referred to as the first available motion information.

[0392] Method 1: If the total number of existing candidate motion information in the motion information candidate list AwpUniArray is even, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0393] Alternatively, if the total number of existing candidate motion information in the motion information candidate list AwpUniArray is odd, then the unidirectional motion information pointing to the reference frame list List1 in the first available motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If duplicates are found, then the unidirectional motion information pointing to the reference frame list List0 in the first available motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0394] Method 2: If the total number of existing candidate motion information in the motion information candidate list AwpUniArray is odd, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the first available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0395] Alternatively, if the total number of existing candidate motion information in the motion information candidate list AwpUniArray is even, then the unidirectional motion information pointing to the reference frame list List1 in the first available motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If duplicates are found, then the unidirectional motion information pointing to the reference frame list List0 in the first available motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0396] Scenario 2: For available motion information to be added to the motion information candidate list, if the available motion information is unidirectional, then perform a duplicate check on the unidirectional motion information in the motion information candidate list AwpUniArray. If there are no duplicates, then add the unidirectional motion information to the motion information candidate list AwpUniArray.

[0397] The third step is to repeatedly fill the last unidirectional motion information in the motion information candidate list AwpUniArray if the length is less than X, until the list length is X.

[0398] For example, in application scenario 1, the temporal motion information can be unidirectional or bidirectional. For instance, in a P-frame, the temporal motion information is unidirectional, while in a B-frame, it is bidirectional.

[0399] Application Scenario 2: After adding spatial motion information to the motion information candidate list, Y positions are reserved for temporal motion information, and the temporal motion information is bidirectional motion information, that is, the motion information candidate list includes Y temporal motion information.

[0400] The first step is to determine the "availability" of motion information for F, G, C, A, B, and D, see Application Scenario 1.

[0401] The second step is to add the available motion information (available motion information in each airspace) to the motion information candidate list AwpUniArray in the order of available motion information in F, G, C, A, B, D (this order is variable and only includes available motion information) until the length of the motion information candidate list AwpUniArray is XY, or the traversal of available motion information ends.

[0402] The second step of application scenario 2 can be found in the second step of application scenario 1, and will not be repeated here.

[0403] The third step is to add the time-domain motion information (such as bidirectional time-domain motion information, and which is available motion information) to the motion information candidate list AwpUniArray according to the parity of the total number of candidate motion information already existing in the motion information candidate list (i.e., the current length of the motion information candidate list).

[0404] Method 1: If the total number of existing candidate motion information in the motion information candidate list AwpUniArray is even, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0405] Alternatively, if the total number of existing candidate motion information in the motion information candidate list AwpUniArray is odd, then the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If duplicates are found, then the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0406] Method 2: If the total number of existing candidate motion information in the motion information candidate list AwpUniArray is odd, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, then perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, then add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0407] Alternatively, if the total number of existing candidate motion information in the motion information candidate list AwpUniArray is even, then the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List1 is added to the motion information candidate list AwpUniArray. If duplicates are found, then the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information is checked for duplicates with the unidirectional motion information in the motion information candidate list AwpUniArray. If no duplicates are found, the unidirectional motion information pointing to the reference frame list List0 is added to the motion information candidate list AwpUniArray.

[0408] Fourth step: If the length of the motion information candidate list AwpUniArray is less than X, then the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled until the list length is X.

[0409] Application Scenario 3: After adding spatial motion information to the motion information candidate list, reserve Y positions for temporal motion information, and the temporal motion information is unidirectional motion information, that is, the motion information candidate list includes Y temporal motion information.

[0410] The first step is to determine the "availability" of motion information for F, G, C, A, B, and D, see Application Scenario 1.

[0411] The second step is to add the available motion information (available motion information in each airspace) to the motion information candidate list AwpUniArray in the order of available motion information in F, G, C, A, B, D (this order is variable and only includes available motion information) until the length of the motion information candidate list AwpUniArray is XY, or the traversal of available motion information ends.

[0412] The second step of application scenario 3 can be found in the second step of application scenario 1, and will not be repeated here.

[0413] The third step involves checking for duplicates between the temporal motion information (such as unidirectional temporal motion information, and which is available) to be added to the motion information candidate list AwpUniArray. If no duplicates are found, the temporal motion information is added to the motion information candidate list AwpUniArray.

[0414] Fourth step: If the length of the motion information candidate list AwpUniArray is less than X, then the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled until the list length is X.

[0415] Application Scenario 4: Spatial motion information and temporal motion information are added together to the motion information candidate list.

[0416] The first step is to determine the "availability" of motion information for F, G, C, A, B, and D, see Application Scenario 1.

[0417] The second step involves adding the available motion information to the motion information candidate list AwpUniArray according to the order of available motion information in F, G, C, A, B, and D (this order is variable and only includes available motion information), and the order of temporal motion information (including available motion information), until the length of AwpUniArray reaches X or the traversal ends:

[0418] Scenario 1: For the available motion information to be added to the motion information candidate list, if the available motion information is bidirectional motion information (i.e., it includes unidirectional motion information pointing to reference frame list List0 and unidirectional motion information pointing to reference frame list List1), add the available motion information to the motion information candidate list AwpUniArray. For simplicity, this available motion information can be referred to as the second available motion information.

[0419] Method 1: Perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0420] Method 2: Perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray. If there is a duplicate, perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the second available motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray.

[0421] Scenario 2: For available motion information to be added to the motion information candidate list, if the available motion information is unidirectional, then perform a duplicate check on the unidirectional motion information in the motion information candidate list AwpUniArray. If there are no duplicates, then add the unidirectional motion information to the motion information candidate list AwpUniArray.

[0422] The third step is to repeatedly fill the last unidirectional motion information in the motion information candidate list AwpUniArray if the length is less than X, until the list length is X.

[0423] For example, in application scenario 4, the temporal motion information can be unidirectional or bidirectional. For instance, in a P-frame, the temporal motion information is unidirectional, while in a B-frame, it is bidirectional.

[0424] Application Scenario 5: After adding spatial motion information to the motion information candidate list, reserve Y positions for temporal motion information. The temporal motion information is bidirectional, meaning the motion information candidate list includes Y temporal motion information.

[0425] The first step is to determine the "availability" of motion information for F, G, C, A, B, and D, see Application Scenario 1.

[0426] The second step is to add the available motion information (i.e., the available motion information in each airspace) to the motion information candidate list AwpUniArray in the order of available motion information in F, G, C, A, B, D (this order is variable and only includes available motion information) until the length of the motion information candidate list AwpUniArray is XY, or the traversal of available motion information ends.

[0427] The second step of application scenario 5 can be found in the second step of application scenario 1, and will not be repeated here.

[0428] The third step is to add the time-domain motion information (such as bidirectional time-domain motion information, and which is available motion information) to the motion information candidate list AwpUniArray.

[0429] Method 1: Perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray. If there is a duplicate, perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray.

[0430] Method 2: Perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List1 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List1 to the motion information candidate list AwpUniArray. If there is a duplicate, perform a deduplication operation between the unidirectional motion information pointing to the reference frame list List0 in the time-domain motion information and the unidirectional motion information in the motion information candidate list AwpUniArray. If there is no duplicate, add the unidirectional motion information pointing to the reference frame list List0 to the motion information candidate list AwpUniArray.

[0431] Fourth step: If the length of the motion information candidate list AwpUniArray is less than X, then the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled until the list length is X.

[0432] After spatial motion information is added to the motion information candidate list, Y positions are reserved for temporal motion information. The temporal motion information is unidirectional, meaning that the motion information candidate list includes Y temporal motion information.

[0433] The first step is to determine the "availability" of motion information for F, G, C, A, B, and D, see Application Scenario 1.

[0434] The second step can be found in the second step of application scenario 4, and will not be repeated here.

[0435] The third step involves checking for duplicates between the temporal motion information (such as unidirectional temporal motion information, and which is available) to be added to the motion information candidate list AwpUniArray. If no duplicates are found, the temporal motion information is added to the motion information candidate list AwpUniArray.

[0436] Fourth step: If the length of the motion information candidate list AwpUniArray is less than X, then the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled until the list length is X.

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

[0438] In the above application scenarios, if the length of the motion information candidate list AwpUniArray is less than X, the last unidirectional motion information in the motion information candidate list AwpUniArray is repeatedly filled until the list length is X. In practical applications, before repeatedly filling the last unidirectional motion information, effective motion information can be added by derived motion information. For example, based on any effective motion information (x, y, ref_idx, ListX) in the motion information candidate list, where ref_idx and ListX are the reference frame index and reference frame list, respectively, and 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 the motion vector; (k2*x, k2*y, ref_idx_new2, ListY), where k2 is any non-zero positive integer, i.e., scaling the motion vector. Alternatively, zero-padding can be performed, meaning the motion information can be (0, 0, ref_idx3, ListZ). When adding this motion information to the motion information candidate list, deduplication can be performed or not. If the length of the motion information candidate list AwpUniArray is still less than X, the aforementioned padding operation can be repeated.

[0439] In the above application scenarios, in addition to spatial motion information and temporal motion information, HMVP motion information can also be added to the motion information candidate list AwpUniArray. There are no restrictions on the process of adding this HMVP motion information.

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

[0441] In one possible implementation, two candidate motion information can be selected from AwpUniArray and used as the first and second target motion information for the current block. Based on this, the decoder can parse AwpCandIdx0 and AwpCandIdx1 from the encoded bitstream and assign the (AwpCandIdx0+1)th motion information in AwpUniArray to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1. Similarly, the (AwpCandIdx1+1)th motion information in AwpUniArray can be assigned to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1. Of course, the motion information of the (0+1)th AwpCandIdx in AwpUniArray can also be assigned to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, RefIdxAwp1L1, and the motion information of the (1+1)th AwpCandIdx in AwpUniArray can be assigned to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, RefIdxAwp0L1. There are no restrictions on this.

[0442] For example, 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 instance, if AwpCandIdx0 is 0, the first motion information in AwpUniArray is assigned to the first target motion information; if AwpCandIdx0 is 1, the second motion information in AwpUniArray is assigned to the first target motion information, and so on.

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

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

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

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

[0447] If RefIdxAwp0L0 is valid, it means that the unidirectional motion information pointing to List0 is valid. Therefore, the prediction mode of the first target motion information is PRED_List0, which means that the predicted value of the pixel position of the unidirectional motion information pointing to List0 can be used.

[0448] If RefIdxAwp0L1 is valid, it means that the unidirectional motion information pointing to List1 is valid. Therefore, the prediction mode of the first target motion information is PRED_List1, which means that the predicted value of the pixel position of the unidirectional motion information pointing to List1 can be used.

[0449] 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, the first motion information in AwpUniArray is assigned to the second target motion information; if AwpCandIdx1 is 1, the second motion information in AwpUniArray is assigned to the second target motion information, and so on.

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

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

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

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

[0454] If RefIdxAwp1L0 is valid, it means that the unidirectional motion information pointing to List0 is valid. Therefore, the prediction mode of the second target motion information is PRED_List0, which means that the predicted value of the pixel position of the unidirectional motion information pointing to List0 can be used.

[0455] If RefIdxAwp1L1 is valid, it means that the unidirectional motion information pointing to List1 is valid. Therefore, the prediction mode of the second target motion information is PRED_List1, which means that the predicted value of the pixel position of the unidirectional motion information pointing to List1 can be used.

[0456] In another possible implementation, a candidate motion information can be selected from AwpUniArray as the target motion information for the current block. The decoder can parse AwpCandIdx from the encoded bitstream and assign the (AwpCandIdx+1)th motion information in AwpUniArray to mvAwpL0, mvAwpL1, RefIdxAwpL0, and RefIdxAwpL1. AwpCandIdx represents the index value of the target motion information, mvAwpL0, mvAwpL1, RefIdxAwpL0, and RefIdxAwpL1 together constitute the target motion information, mvAwpL0 and RefIdxAwpL0 represent unidirectional motion information pointing to List0 in the target motion information, and mvAwpL1 and RefIdxAwpL1 represent unidirectional motion information pointing to List1 in the target motion information.

[0457] For example, embodiments 1-16 can be implemented individually or in combination. For instance, embodiments 1 and 2 can be implemented together; embodiments 1 and 3 can be implemented together; embodiments 1, 2, and 3 can be implemented together; embodiment 4 can be implemented in combination with one or more of embodiments 1-3; embodiment 5 can be implemented in combination with...

[0458] Embodiment 1 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 6 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 7 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 8 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 9 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 10 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 11 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 12 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 13 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 14 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 15 can be implemented in combination with one or more of Embodiments 1-3; Embodiment 16 can be implemented in combination with one or more of Embodiments 1-3; Of course, the above are just a few examples, and there is no limitation on the combination methods between embodiments.

[0459] It should be noted that in the above embodiments, the methods used at the encoding end and the methods used at the decoding end can refer to each other.

[0460] Example 17: Based on the same application concept as the above method, this application embodiment also proposes an encoding and decoding device, which is applied to the encoding end or the decoding end. Referring to Figure 10A, which is a structural diagram of the device, it includes an acquisition module 111, a configuration module 112 and a determination module 113.

[0461] The acquisition module 111 is used to acquire the weight prediction angle and weight configuration parameters of the current block when it is determined to start weighted prediction for the current block, wherein the weight configuration parameters include the weight transformation rate and the starting position of the weight transformation.

[0462] Configuration module 112 is used to configure reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters.

[0463] The determining module 113 is 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 weighted prediction angle; determine a target weight value of the pixel position according to a reference weight value associated with the surrounding matching position; determine an associated weight value of the pixel position according to the target weight value of the pixel position; determine a first predicted value of the pixel position according to a first prediction mode of the current block; determine a second predicted value of the pixel position according to a second prediction mode of the current block; determine a weighted predicted value of the pixel position according to 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 according to the weighted predicted values ​​of all pixel positions of the current block.

[0464] If the current block supports a weight transformation rate switching mode, the acquisition module 111 acquires the weight transformation rate of the current block in the following manner: acquires the first weight transformation rate indication information of the current block; determines the weight transformation rate of the current block based on the first weight transformation rate indication information, wherein if the first weight transformation rate indication information is a first indication information, the weight transformation rate of the current block is the first weight transformation rate, and if the first weight transformation rate indication information is a second indication information, the weight transformation rate of the current block is the second weight transformation rate.

[0465] The first weight transformation rate indication information is image-level indication information. The first weight transformation rate indication information of the current block represents the weight transformation rate switching identifier corresponding to the current block. The first indication information is used to indicate that the current block does not need to perform a weight transformation rate switching, and the second indication information is used to indicate that the current block needs to perform a weight transformation rate switching. The absolute value of the first weight transformation rate is not equal to the absolute value of the second weight transformation rate.

[0466] If the current block supports a weight transformation rate switching mode, the acquisition module 111 acquires the weight transformation rate of the current block in the following manner: acquires the second weight transformation rate indication information of the current block; selects the weight transformation rate corresponding to the second weight transformation rate indication information from a preset lookup table; wherein the preset lookup table includes at least two weight transformation rates; and determines the selected weight transformation rate as the weight transformation rate of the current block.

[0467] For example, when the configuration module 112 configures reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters, it is specifically used to: for each surrounding position outside the current block, configure the reference weight value of the surrounding position according to the coordinate value of the surrounding position, the coordinate value of the starting position of the weight transformation, and the weight transformation rate.

[0468] For example, the starting position of the weight transformation is determined by at least one of the following parameters: the weight prediction angle, the weight prediction position of the current block, and the size of the current block. The number of peripheral positions outside the current block is determined based on the size of the current block and / or the weight prediction angle of the current block. The reference weight values ​​of the peripheral positions outside the current block monotonically increase. The peripheral positions outside the current block include at least one of the following: integer pixel positions or subpixel positions. The peripheral positions outside the current block include at least one of the following: the peripheral position of the row above the current block, or the peripheral position of the column to the left of the current block.

[0469] The reference weight values ​​for 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. Specifically, the reference weight values ​​of the first neighboring regions are all second reference weight values, and the reference weight values ​​of the second neighboring regions are all third reference weight values, wherein the second reference weight value and the third reference weight value are different. The target region includes one reference weight value or at least two reference weight values, wherein if the target region includes at least two reference weight values, the at least two reference weight values ​​of the target region monotonically increase.

[0470] The weight prediction angle is a horizontal angle; or, the weight prediction angle is a vertical angle; or, the absolute value of the slope of the weight prediction angle is a power of 2, where n is an integer.

[0471] For example, the determining module 113 is further configured to: if the surrounding matching position is an integer pixel position and the integer pixel position has been configured with a reference weight value, then determine the target weight value of the pixel position based on the reference weight value of the integer pixel position; or, if the surrounding matching position is a sub-pixel position and the sub-pixel position has been configured with a reference weight value, then determine the target weight value of the pixel position based on the reference weight value of the sub-pixel position.

[0472] If the first prediction mode is an inter-frame prediction mode, the determining module 113 is further configured to: obtain a motion information candidate list, the motion information candidate list including at least one candidate motion information; select a candidate motion information from the motion information candidate list as the original motion information of the current block; determine the target motion information of the current block according to the original motion information; and determine a first prediction value of the pixel position according to the target motion information.

[0473] The original motion information includes an original motion vector, the target motion information includes a target motion vector, and the determining module 113 is further configured to: obtain the motion vector difference corresponding to the original motion vector; and determine the target motion vector based on the motion vector difference and the original motion vector.

[0474] At the decoding end, the determining module 113 is further configured to: parse the direction information and amplitude information of the motion vector difference from the encoded bit stream of the current block; and determine the motion vector difference based on the direction information and amplitude information of the motion vector difference.

[0475] If the direction information indicates the direction is to the right and the amplitude information indicates the amplitude is Ar, then the motion vector difference is (Ar, 0); if the direction information indicates the direction is downward and the amplitude information indicates the amplitude is Ad, then the motion vector difference is (0, -Ad); if the direction information indicates the direction is to the left and the amplitude information indicates the amplitude is Al, then the motion vector difference is (-Al, 0); if the direction information indicates the direction is upward and the amplitude information indicates the amplitude is Au, then the motion vector difference is (0, Au).

[0476] At the decoding end, the determining module 113 is further configured to: parse out flag information from the encoded bitstream of the current block; if the flag information indicates that the motion vector difference is superimposed on the original motion vector, then parse out the direction information and amplitude information of the motion vector difference from the encoded bitstream of the current block.

[0477] The determining module 113 is further configured to: obtain at least one available motion information to be added to the motion information candidate list; and construct the motion information candidate list based on the at least one available motion information.

[0478] The at least one available motion information includes at least one of the following motion information: spatial motion information; temporal motion information; preset motion information.

[0479] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0480] Based on the same application concept as the methods described above, the decoding end device (also referred to as a video decoder) provided in this application embodiment, from a hardware perspective, its hardware architecture schematic diagram can be specifically referred to as Figure 10B. It includes: a processor 121 and a machine-readable storage medium 122, wherein: the machine-readable storage medium 122 stores machine-executable instructions that can be executed by the processor 121; the processor 121 is used to execute the machine-executable instructions to implement the methods disclosed in the above examples of this application. For example, the processor 121 is configured to execute machine-executable instructions to perform the following steps: upon determining that weighted prediction should be initiated for the current block, obtaining the weighted prediction angle and weight configuration parameters of the current block; wherein the weight configuration parameters include a weight transformation rate and a weight transformation start position; configuring reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weighted prediction angle; determining a target weight value for the pixel position according to the reference weight value associated with the surrounding matching position, and determining an associated weight value for the pixel position according to the target weight value; determining a first prediction value for the pixel position according to a first prediction mode of the current block, and determining a second prediction value for the pixel position according to a second prediction mode of the current block; determining a weighted prediction value for the pixel position according to the first prediction value, the target weight value, the second prediction value, and the associated weight value; and determining a weighted prediction value for the current block according to the weighted prediction values ​​of all pixel positions of the current block.

[0481] Based on the same application concept as the methods described above, the encoding end device (also referred to as a video encoder) provided in this application embodiment, from a hardware perspective, its hardware architecture schematic diagram can be specifically referred to as Figure 10C. It includes: a processor 131 and a machine-readable storage medium 132, wherein: the machine-readable storage medium 132 stores machine-executable instructions that can be executed by the processor 131; the processor 131 is used to execute the machine-executable instructions to implement the methods disclosed in the above examples of this application. For example, the processor 131 is configured to execute machine-executable instructions to perform the following steps: upon determining that a weighted prediction is to be initiated for the current block, obtaining the weighted prediction angle and weight configuration parameters of the current block; wherein the weight configuration parameters include a weight transformation rate and a weight transformation start position; configuring reference weight values ​​for the surrounding positions outside the current block according to the weight configuration parameters; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from the surrounding positions outside the current block according to the weighted prediction angle; determining a target weight value for the pixel position according to the reference weight value associated with the surrounding matching position, and determining an associated weight value for the pixel position according to the target weight value; determining a first prediction value for the pixel position according to a first prediction mode of the current block, and determining a second prediction value for the pixel position according to a second prediction mode of the current block; determining a weighted prediction value for the pixel position according to the first prediction value, the target weight value, the second prediction value, and the associated weight value; and determining a weighted prediction value for the current block according to the weighted prediction values ​​of all pixel positions of the current block.

[0482] Based on the same application concept as the above method, this application embodiment also provides a camera device, which may include the encoding and decoding device in any of the above embodiments, and the camera device may be processed using the above process.

[0483] Based on the same application concept as the above methods, embodiments of this application also provide a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the methods disclosed in the above examples of this application, such as the encoding and decoding methods in the above embodiments.

[0484] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices. For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0485] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. This application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0486] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.