Encoding / Decoding Method, Apparatus and Device

By setting the weight prediction angle and calculating the weight prediction value in video encoding, the problem of insufficient prediction accuracy in the existing video encoding methods is solved, and the prediction accuracy and encoding efficiency of video encoding are improved.

JP7625054B2Active Publication Date: 2025-01-31HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2023182712
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2020-03-25
Filing Date
2023-10-24
Publication Date
2025-01-31
Estimated Expiration
2041-03-23

AI Technical Summary

Technical Problem

When the existing video encoding methods remove spatial and temporal redundancy within and between video frames, the prediction accuracy is insufficient, resulting in poor encoding performance.

Method used

By setting the weight prediction angle, the matching position around the current block is determined, and the weight prediction value of each pixel position is calculated based on the reference weight value and the target weight value, and the prediction accuracy is improved in combination with multiple prediction modes.

Benefits of technology

It improves the prediction accuracy and encoding performance of video encoding, is closer to the original pixel value, and improves the encoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007625054000011
    Figure 0007625054000011
  • Figure 0007625054000012
    Figure 0007625054000012
  • Figure 0007625054000013
    Figure 0007625054000013
Patent Text Reader

Abstract

To provide encoding and decoding methods, apparatuses and devices therefor for effectively removing spatial redundancy of a moving image.SOLUTION: An encoding method comprises the steps of: obtaining a weighted prediction angle of a current block; determining a surrounding matching position pointed by a pixel position from surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value of the pixel position based on a reference weight value associated with the surrounding matching position; determining an association weight value of the pixel position based on the target weight value of the pixel position; determining a first prediction value of the pixel position based on a first prediction mode of the current block; determining a second prediction value of the pixel position based on a second prediction mode of the current block; and based on the first prediction value, the target weight value, the second prediction value and the association weight value, determining a weighted prediction value of the pixel position; and determining weighted prediction values of the current block based on the weighted prediction values of all pixel positions of the current block.SELECTED DRAWING: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to an encoding / decoding method, an apparatus, and a device thereof. [Background technology]

[0002] In order to save space, video images are coded before transmission, and a complete video coding method may include processes such as prediction, transformation, quantization, entropy coding, and filtering. Among them, predictive coding may include intraframe coding and interframe coding. Furthermore, interframe coding utilizes the temporal correlation of video to predict a current pixel of an image of a current frame using pixels of adjacent coded images, thereby achieving the purpose of effectively removing temporal redundancy of video. Intraframe coding utilizes the spatial correlation of video to predict a current pixel using pixels of coded blocks of an image of a current frame, thereby achieving the purpose of effectively removing spatial redundancy of video. Summary of the Invention

[0003] The present application provides an encoding / decoding method, an apparatus, and a device thereof.

[0004] The present application provides an encoding / decoding method, and when it is determined to start weighted prediction for a current block, the method includes the steps of: obtaining a weighted prediction angle for the current block; for each pixel position of the current block, determining a peripheral matching position indicated by the pixel position from among peripheral positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value for the pixel position based on a reference weight value associated with the peripheral matching position and determining an associated weight value for the pixel position based on the target weight value for the pixel position; for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0005] The present application provides an encoding apparatus, the apparatus including: a module for executing, when it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle of the current block for the current block; a module for executing, for each pixel position of the current block, determining a peripheral matching position pointed to by the pixel position from among peripheral positions outside the current block based on the weighted prediction angle of the current block; a module for executing, based on a reference weight value associated with the peripheral matching position, determining a target weight value for the pixel position based on a reference weight value associated with the peripheral matching position, and determining an associated weight value for the pixel position based on the target weight value for the pixel position; a module for executing, for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block, determining a second predicted value for the pixel position based on a second prediction mode of the current block, and determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and a module for executing, based on the weighted prediction values ​​of all pixel positions of the current block, determining a weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0006] The present application provides a decoding device, the device including: a module for executing, when it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle of the current block for the current block; a module for executing, for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block; a module for executing, based on a reference weight value associated with the surrounding matching position, determining a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position, and determining an associated weight value for the pixel position based on the target weight value for the pixel position; a module for executing, based on each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block, determining a second predicted value for the pixel position based on a second prediction mode of the current block, and determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and a module for executing, based on the weighted prediction values ​​of all pixel positions of the current block, determining a weighted prediction value of the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0007] The present application provides a decoding device including a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor. The processor is adapted to perform, when it is determined to start weighted prediction for a current block by executing the machine-executable instructions, for the current block: obtaining a weighted prediction angle for the current block; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position and determining an associated weight value for the pixel position based on the target weight value for the pixel position; for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0008] The present application provides a coding device including a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor. The processor is adapted to perform, when it is determined to start weighted prediction for a current block by executing the machine-executable instructions, for the current block: obtaining a weighted prediction angle for the current block; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position and determining an associated weight value for the pixel position based on the target weight value for the pixel position; for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0009] As can be seen from the above, the embodiment of the present application proposes an effective method for setting weight values, and a reasonable target weight value can be set for each pixel position of the current block, so that the predicted value of the current block is closer to the original pixel, thereby improving prediction accuracy, improving prediction performance, and improving coding performance. [Brief description of the drawings]

[0010] [Figure 1] 1 is a schematic diagram of a video coding framework. [Figure 2A] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2B] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2C]FIG. 1 is a schematic diagram of weighted prediction. [Diagram 3] 1 is a flowchart of an encoding / decoding method according to an embodiment of the present application. [Figure 4A] 1 is a flowchart of an encoding method according to an embodiment of the present application; [Figure 4B] FIG. 2 is a schematic diagram of peripheral locations outside the current block. [Figure 4C] FIG. 2 is a schematic diagram of peripheral locations outside the current block. [Figure 4D] FIG. 2 is a schematic diagram of peripheral locations outside the current block. [Figure 4E] FIG. 2 is a schematic diagram of peripheral locations outside the current block. [Figure 4F] 2 is a flowchart of a decoding method according to an embodiment of the present application; [Figure 5A] FIG. 2 is a schematic diagram of a weighted prediction angle according to an embodiment of the present application; [Figure 5B] FIG. 2 is a schematic diagram of a weighted prediction angle according to an embodiment of the present application; [Figure 6A] 4 is a flow chart of determining reference weight values ​​of peripheral positions according to an embodiment of the present application; [Figure 6B] 1 is a flowchart of a method for deriving a weight array according to an embodiment of the present application; [Figure 6C] FIG. 2 is a schematic diagram of different angle areas of a current block according to an embodiment of the present application; [Figure 6D] FIG. 2 is a schematic diagram of different angle areas of a current block according to an embodiment of the present application; [Figure 7] FIG. 2 is a schematic diagram of neighboring blocks of a current block according to an embodiment of the present application; [Figure 8A] 1 is a structural schematic diagram of an encoding / decoding device according to an embodiment of the present application; [Figure 8B] FIG. 2 is a hardware structural diagram of a decoding device according to an embodiment of the present application; [Figure 8C] FIG. 2 is a hardware structural diagram of an encoding device according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0011] The terms used in the examples of the present application are intended to describe particular examples, not to limit the present application. In the examples and claims of the present application, the terms "a," "said," and "the" used in the singular form are intended to include the plural, unless the context clearly indicates otherwise. In addition, the term "and / or" used herein should be understood to refer to including any or all possible combinations of one or more of the associated listed items. Although the examples of the present application may use terms such as first, second, and third to describe various information, it should be understood that such information is not limited by such terms. Such terms are used only to distinguish between information of the same type. For example, the first information may be referred to as the second information, and similarly, the second information may be referred to as the first information, without departing from the scope of the examples of the present application. Depending on the context, when the term "if" is used, it may be interpreted as "when ...", or "in the case ...", or "depending on the decision", etc.

[0012] In the embodiments of the present application, an encoding / decoding method, an apparatus, and a device thereof are proposed, and the concepts of intra-frame prediction, inter-frame prediction, and IBC (Intra Block Copy) prediction are involved.

[0013] Intraframe prediction utilizes the spatial correlation of video to predict the current pixel using the pixels of the coded blocks of the current image, thereby achieving the purpose of removing spatial redundancy in the video. Intraframe prediction defines various prediction modes, each of which corresponds to one texture direction (except for DC (Direct Current) mode), for example, if the image texture is arranged horizontally, the horizontal prediction mode can predict the image information better.

[0014] Inter-frame prediction is based on the temporal correlation of video, and since video sequences contain strong temporal correlation, predicting the pixels of a current image using the pixels of adjacent encoded images can achieve the purpose of effectively removing the temporal redundancy of video. In the inter-frame prediction part of video coding standards, a block-based motion compensation technique is adopted, and the main principle is to find the best matching block in the previous encoded image for each pixel block of the current image, and this process is called motion estimation (ME).

[0015] Intra block copy allows same frame reference, and the reference data of the current block is obtained from the same frame. In the intra block copy technique, the block vector of the current block can be used to obtain the predicted value of the current block. For example, due to the characteristic that there are a large number of repeated textures in the same frame of the screen content, when the block vector is used to obtain the predicted value of the current block, the compression efficiency of the screen content sequence can be improved.

[0016] Prediction Pixel: This refers to a pixel value derived from encoded / decoded pixels. The residual is obtained from the difference between the original pixel and the predicted pixel, and then residual conversion, quantization, and coefficient coding are performed. Interframe predicted pixels refer to pixel values ​​derived from a reference frame for the current block, and since the pixel positions are discrete, the final predicted pixel must be obtained by an interpolation operation. The closer the predicted pixel is to the original pixel, the smaller the energy of the residual obtained by subtracting the two, and the higher the coding compression performance.

[0017] Motion Vector (MV): In inter-frame coding, a motion vector can be used to represent the relative displacement between a current block of a current frame image and a reference block of a reference frame image. A corresponding motion vector is transmitted to the decoding side for each divided block, and if the motion vector of each block is coded and transmitted independently, many bits will be consumed, especially when there are many small-sized blocks. In order to reduce the number of bits used for coding the motion vector, the motion vector of the current coding target block may be predicted based on the motion vector of an adjacent coded block by utilizing the spatial correlation between adjacent blocks, and then the prediction difference may be coded, thereby effectively reducing the number of bits for representing the motion vector. Based on this, when coding the motion vector of the current block, the motion vector of the current block may be predicted using the motion vector of an adjacent coded block, and then the difference between the predicted value of the motion vector (MVP, Motion Vector Prediction) and the actual estimated value of the motion vector, i.e., the differential motion vector (MVD, Motion Vector Difference), may be coded.

[0018] Motion Information: Since a motion vector represents a position offset between a current block and a specific reference block, in order to accurately obtain information of a directional block, in addition to the motion vector, it is necessary to represent which reference frame image the current block uses in the index information of the reference frame image. In a video coding technique, a reference frame image list may generally be established for a current frame image, and the reference frame image index information represents which reference frame image in the reference frame image list the current block adopts. In addition, since there are many coding techniques that support multiple reference frame image lists, one index value may be used to represent which reference frame image list is used, and the index value may be called a reference direction. As can be seen above, in a video coding technique, information related to motion, such as a motion vector, reference frame image index information, and reference direction, may be collectively called motion information.

[0019] Block Vector (BV): Block vectors are used in intra block copy technology, which uses block vectors to perform motion compensation, that is, 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 among the coded blocks of the current frame. Due to the characteristics that there are a large number of repeated textures in the same frame, using block vectors to obtain the predicted value of the current block can obviously improve the compression efficiency.

[0020] Intraframe prediction mode: In intraframe coding, motion compensation is performed using an intraframe prediction mode, that is, an intraframe prediction mode is adopted to obtain a predicted value of a current block. For example, the intraframe prediction mode may include, but is not limited to, a planar mode, a DC mode, and 33 angle modes. Table 1 shows examples of intraframe prediction modes, where the planar mode corresponds to mode 0, the DC mode corresponds to mode 1, and the remaining 33 angle modes correspond to modes 2 to 34. The planar mode is applied to an area where pixel values ​​change slowly, and two linear filters, one horizontal and one vertical, are used to obtain the average value of pixels in the two directions as the predicted value of the current block pixel. The DC mode is applied to a wide and flat area, and the average value of the surrounding pixels of the current block is obtained as the predicted value of the current block pixel. There are 33 angle modes, and the new generation encoding and decoding standard VVC (Versatile Video Coding) adopts more detailed angle modes, for example, 65 angle modes. [Table 1]

[0021] Palette Mode: In palette mode, the pixel values ​​of the current block are represented by a small set of pixel values, i.e., a palette. If the pixel value of a pixel location in the current block is close to a particular color in the palette, the pixel location is coded with the index value of the corresponding color in the palette. If the pixel value of a pixel location in the current block is not similar to any color in the palette, the pixel location needs to be coded as an "escape pixel" and directly quantized before being incorporated into the bitstream. On the decoding side, the palette is first obtained, e.g., {color A, color B, color C} is stored, then each pixel location is checked to see if it is an escape pixel, if not, the index of the pixel location is obtained from the bitstream, and the color is obtained from the palette based on the index of the pixel location and given to the pixel location, otherwise, the escape pixel is analyzed.

[0022] Rate-Distortion Optimization (RDO) Method: There are two main indices for evaluating the coding efficiency: bit rate and PSNR (Peak Signal to Noise Ratio). The smaller the bit stream, the higher the compression rate, and the higher the PSNR, the better the quality of the reconstructed image. When selecting a mode, the discriminant is essentially a comprehensive evaluation of both. For example, the cost corresponding to a mode is J(mode)=D+λ*R, where D represents distortion, and can generally be evaluated using the SSE (Sum of the Squared Errors) index, where SSE refers to the mean square sum of the difference between the reconstructed image block and the source image, λ is the Lagrange multiplier, and R is the actual number of bits required to code an image block in the mode, including the total number of bits required for coding mode information, motion information, residuals, etc. When selecting a mode, using the RDO method to make a comparative decision on the coding mode can generally ensure optimal coding performance.

[0023] Video coding framework: The process flow of the encoding side of the embodiment of the present application can be realized using the video coding framework shown in FIG. 1, and since the schematic diagram of the video decoding framework is similar to FIG. 1, the description is omitted here, and the process flow of the decoding side of the embodiment of the present application can be realized using the video decoding framework. Exemplarily, the video coding framework and the video decoding framework may include modules such as intra-frame prediction, motion estimation / motion compensation, reference image buffer, in-loop filtering, reconstruction, transform, quantization, inverse transform, inverse quantization, and entropy encoder, but are not limited thereto. On the encoding side, the process flow of the encoding side can be realized by the cooperation between those modules, and on the decoding side, the process flow of the decoding side can be realized by the cooperation between those modules.

[0024] Exemplarily, the current block may be rectangular, and since the edges of most real objects are not rectangular, it is common for two different objects (e.g., an object in the foreground and a background) to exist at the edge of the object. When the movements of two objects are inconsistent, rectangular division cannot effectively divide the two objects, so the current block may be divided into two non-rectangular sub-blocks, and weighted prediction may be performed on the two non-rectangular sub-blocks. Exemplarily, the weighted prediction is to obtain a final predicted value by performing a weighting operation using multiple predicted values, and the weighted prediction may include weighted prediction that combines inter-frame and intra-frame, weighted prediction that combines inter-frame and inter-frame, weighted prediction that combines intra-frame and intra-frame, etc. Regarding the weight value of the weighted prediction, the same weight value may be set to all pixel positions of the current block, or different weight values ​​may be set to all pixel positions of the current block.

[0025] Shown in FIG. 2A is a schematic diagram of the Triangular Partition Mode (TPM) of inter-frame weighted prediction.

[0026] The TPM prediction block is obtained by combining an inter prediction block 1 (i.e., adopting an inter prediction mode to obtain an inter prediction value 1 of multiple pixel positions) and an inter prediction block 2 (i.e., adopting an inter prediction mode to obtain an inter prediction value 2 of multiple pixel positions). The TPM prediction block can be divided into two regions / parts, one region can be the inter region 1 and the other region can be the inter region 2, the TPM prediction block can be distributed as a rectangle, the two inter regions of the TPM prediction block can be distributed as a non-rectangle, and the boundary line between the two inter regions (e.g., the dotted line in FIG. 2A) can be the main diagonal or sub-diagonal of the TPM prediction block.

[0027] Exemplarily, each pixel position in the inter-frame region 1 is determined mainly based on the inter-frame prediction value of the inter-frame prediction block 1, for example, the inter-frame prediction value of the inter-frame prediction block 1 at the pixel position and the inter-frame prediction value of the inter-frame prediction block 2 at the pixel position are weighted to obtain a combined prediction value of the pixel position, where the weight value of the inter-frame prediction value of the inter-frame prediction block 1 is larger and the weight value of the inter-frame prediction value of the inter-frame prediction block 2 is smaller (may be 0). Each pixel position in the inter-frame region 2 is determined mainly based on the inter-frame prediction value of the inter-frame prediction block 2, for example, the inter-frame prediction value of the inter-frame prediction block 1 at the pixel position and the inter-frame prediction value of the inter-frame prediction block 2 at the pixel position are weighted to obtain a combined prediction value of the pixel position, where the weight value of the inter-frame prediction value of the inter-frame prediction block 2 is larger and the weight value of the inter-frame prediction value of the inter-frame prediction block 1 is smaller (may be 0). Finally, the combined prediction value of each pixel position may constitute a TPM prediction block.

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

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

[0030] Exemplarily, each pixel position in the inter-frame region 1 is determined mainly based on the inter-frame prediction value of the inter-frame prediction block 1, for example, the inter-frame prediction value of the inter-frame prediction block 1 at the pixel position and the inter-frame prediction value of the inter-frame prediction block 2 at the pixel position are weighted to obtain a combined prediction value of the pixel position, where the weight value of the inter-frame prediction value of the inter-frame prediction block 1 is larger and the weight value of the inter-frame prediction value of the inter-frame prediction block 2 is smaller (may be 0). Each pixel position in the inter-frame region 2 is determined mainly based on the inter-frame prediction value of the inter-frame prediction block 2, for example, the inter-frame prediction value of the inter-frame prediction block 1 at the pixel position and the inter-frame prediction value of the inter-frame prediction block 2 at the pixel position are weighted to obtain a combined prediction value of the pixel position, where the weight value of the inter-frame prediction value of the inter-frame prediction block 2 is larger and the weight value of the inter-frame prediction value of the inter-frame prediction block 1 is smaller (may be 0). Finally, a GEO prediction block may be formed by the combined prediction value of each pixel position.

[0031] Illustratively, the weight value setting of the GEO prediction block is related to the distance of the pixel position to the division line, and as shown in FIG. 2C, pixel position A, pixel position B, and pixel position C are located at the lower right of the division line, and pixel position D, pixel position E, and pixel position F are located at the upper left of the division line. For pixel position A, pixel position B, and pixel position C, the weight value relationship of the inter-frame prediction block 2 is B≧A≧C, and the weight value relationship of the inter-frame prediction block 1 is C≧A≧B. For pixel position D, pixel position E, and pixel position F, the weight value relationship of the inter-frame prediction block 1 is D≧F≧E, and the weight value relationship of the inter-frame prediction block 2 is E≧F≧D. In the above method, the distance of the pixel position to the division line needs to be calculated, and then the weight value of the pixel position is determined.

[0032] In the above various cases, in order to realize weighted prediction, it is necessary to determine the weight value of the predicted block corresponding to each pixel position of the current block, and perform weighted prediction based on the weight value corresponding to each pixel position. However, the setting of the weight value depends on the dividing line, and if the weight value is set unreasonably, the prediction effect is not good, and there is a possibility that the coding performance is deteriorated.

[0033] In view of this, in the weight value derivation method proposed in the embodiments of the present application, the target weight value of each pixel position of the current block may be determined based on the reference weight values ​​of the surrounding positions outside the current block, and a more reasonable target weight value can be set for each pixel position, so that the predicted value of the current block is closer to the original pixel, thereby improving the prediction accuracy, improving the prediction performance, and improving the encoding performance.

[0034] Next, the encoding / decoding method according to the embodiments of the present application will be described in detail with reference to some specific embodiments.

[0035] Example 1: FIG. 3 shows a flowchart of an encoding-decoding method proposed in an embodiment of the present application, which can be applied to the decoding side or the encoding side, and the encoding-decoding method may include the following steps 301 to 304.

[0036] In step 301, when it is determined to start weighted prediction for the current block, a weighted prediction angle of the current block is obtained for the current block.

[0037] For example, the current block may include one sub-block, that is, the sub-block is the current block itself, and obtaining the weighted prediction angle of the sub-block is obtaining the weighted prediction angle of the current block.

[0038] For example, when predicting a current block, the decoding side or the encoding side may first determine whether to start weighted prediction for the current block. If weighted prediction is started for the current block, the encoding and decoding method of the embodiment of the present application is adopted, that is, the weighted prediction angle of the current block is obtained. If weighted prediction is not started for the current block, the embodiment of the present application does not limit the implementation form.

[0039] For example, when it is determined to start weighted prediction for a current block, it is necessary to obtain a weighted prediction angle of the current block, and the weighted prediction angle represents an angular direction of a pixel position inside the current block. For example, based on a specific weighted prediction angle, it is determined that an angular direction of a pixel position inside the current block points, and the angular direction points to a specific peripheral position outside the current block.

[0040] In step 302, for each pixel position of the current block, determine a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on a weighted prediction angle of the current block, determine a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position, and determine an associated weight value for the pixel position based on the target weight value for the pixel position.

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

[0042] For each pixel position of the current block, after determining the surrounding matching position pointed to by the pixel position, a reference weight value associated with the surrounding matching position may be determined, and the reference weight value associated with the surrounding matching position may be preset or may be determined by adopting a specific method, and there is no limitation in this regard, as long as the surrounding matching position has an associated reference weight value.

[0043] A target weight value for the pixel position may then be determined based on the reference weight values ​​associated with the surrounding matching positions, for example, the reference weight values ​​associated with the surrounding matching positions may be determined as the target weight value for the pixel position.

[0044] After obtaining the target weight value for the pixel position, the associated weight value for the pixel position may be determined based on the target weight value for the pixel position. For example, the sum of the target weight value and the associated weight value for each pixel position may be a fixed preset value, and thus the associated weight value may be the difference between the preset value and the target weight value. If the preset value is 8 and the target weight value for the pixel position is 0, the associated weight value for the pixel position is 8. If the target weight value for the pixel position is 1, the associated weight value for the pixel position is 7. In this way, the sum of the target weight value and the associated weight value may be 8.

[0045] In step 303, for each pixel position of the current block, a first predicted value for the pixel position is determined based on a first prediction mode of the current block, a second predicted value for the pixel position is determined based on a second prediction mode of the current block, and a weighted predicted value for the pixel position is determined based on the first predicted value, the target weight value, the second predicted value and an associated weight value for the pixel position.

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

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

[0048] In step 304, a weighted prediction value for the current block is determined based on the weighted prediction values ​​of all pixel locations in each current block.

[0049] For example, for a current block, the weighted predictions of all pixel positions in the current block constitute a weighted prediction for the current block.

[0050] As can be seen from the above, the embodiment of the present application proposes an effective method for setting weight values, and a reasonable target weight value can be set for each pixel position of the current block, so that the predicted value of the current block is closer to the original pixel, thereby improving prediction accuracy, improving prediction performance, and improving coding performance.

[0051] Example 2: In Example 1, the current block may include one sub-block, that is, the sub-block is the current block itself, and for the current block, what is shown in FIG. 4A is a flowchart of an encoding method, which can be applied to the encoding side, and the method may include steps 401 to 407.

[0052] In step 401, when it is determined to start weighted prediction for the current block, the encoding side obtains the weighted prediction angle and weighted prediction position of the current block.

[0053] For example, the encoding side needs to decide whether to allow weighted prediction to be started for the current block. If allowed, obtain the weighted prediction angle and weighted prediction position of the current block and execute the subsequent steps; if not allowed, the present application does not limit the processing method.

[0054] In one possible embodiment, if the current block satisfies the condition for starting weighted prediction, the encoding side may determine that it is necessary to start weighted prediction for the current block. If the current block does not satisfy the condition for starting weighted prediction, the encoding side may determine that it is not necessary to start weighted prediction for the current block. For example, the encoding side may determine whether the feature information of the current block satisfies a certain condition, and if so, decide to start weighted prediction for the current block, and if not, decide not to start weighted prediction for the current block.

[0055] Exemplarily, the feature information includes, but is not limited to, any one or any combination of a frame type of a current frame in which the current block is located, size information of the current block, and switch control information. The switch control information may include, but is not limited to, sequence level (SPS (Sequence Parameter Set), SH (Sequence Header)) switch control information, picture level (PPS (Picture Parameter Set), PH (Picture Header)) switch control information, slice level (Slice, Tile, Patch) switch control information, or largest coding unit level (LCU (Largest Coding Unit), CTU (Coding Tree Unit)) switch control information.

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

[0057] For example, if the feature information is the size information of the current block, such as the width and height of the current block, determining that the size information of the current block meets the specific condition may include, but is not limited to, determining that the size information of the current block meets the specific condition if the width is greater than or equal to a first value and the height is greater than or equal to a second value, or determining that the size information of the current block meets the specific condition if the width is greater than or equal to a third value, the height is greater than or equal to a fourth value, the width is less than or equal to a fifth value, and the height is less than or equal to a sixth value, or determining that the size information of the current block meets the specific condition if the product of the width and height is greater than or equal to a seventh value. The value may be set based on experience, such as, but not limited to, 8, 16, 32, 64, 128, etc. For example, the first value is 8, the second value is 8, the third value is 8, the fourth value is 8, the fifth value is 64, the sixth value is 64, and the seventh value is 64. In this case, if the width is greater than or equal to 8 and the height is greater than or equal to 8, it is determined that the size information of the current block meets the specific condition. Or, if the width is greater than or equal to 8, the height is greater than or equal to 8, the width is less than or equal to 64, and the height is less than or equal to 64, it is determined that the size information of the current block meets the specific condition. Or, if the product of the width and height is greater than or equal to 64, it is determined that the size information of the current block meets the specific condition. Of course, the above are merely examples and are not limiting in this regard.

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

[0059] For example, if the feature information is switch control information, determining that the switch control information satisfies a particular condition may include, but is not limited to, if the switch control information is to allow starting weighted prediction for the current block, determining that the switch control information satisfies the particular condition.

[0060] For example, if the characteristic information is the frame type of the current frame in which the current block is located and the size information of the current block, it may be determined that the characteristic information of the current block satisfies a specific condition when the frame type meets a specific condition and the size information meets a specific condition. If the characteristic information is the frame type of the current frame in which the current block is located and the switch control information, it may be determined that the characteristic information of the current block meets a specific condition when the frame type meets a specific condition and the switch control information meets a specific condition. If the characteristic information is the size information and switch control information of the current block, it may be determined that the characteristic information of the current block meets a specific condition when the size information meets a specific condition and the switch control information meets a specific condition. If the characteristic information is the frame type of the current frame in which the current block is located, the size information and switch control information of the current block, it may be determined that the characteristic information of the current block meets a specific condition when the frame type meets a specific condition, the size information meets a specific condition and the switch control information meets a specific condition.

[0061] In one possible embodiment, when it is determined to start weighted prediction for the current block, the encoding side obtains a weighted prediction angle and a weighted prediction position of the current block. Figure 4B shows the angular direction of pixel positions (e.g., pixel positions 1, 2, and 3) inside the current block based on a specific weighted prediction angle, and the angular direction points to a specific peripheral position outside the current block. Figure 4C shows the angular direction of pixel positions (e.g., pixel positions 2, 3, and 4) inside the current block based on another weighted prediction angle, and the angular direction points to a specific peripheral position outside the current block.

[0062] The weighted prediction position (also called distance parameter) is used to set the reference weight value of the peripheral position outside the current block. For example, the range of the peripheral positions outside the current block may be determined based on parameters such as the weighted prediction angle, the size of the current block, etc. (see FIG. 4B and FIG. 4C). Then, the range of the peripheral positions is divided into N equal parts, and the value of N can be arbitrarily set, for example, 4, 6, 8, etc., and the weighted prediction position is used to indicate which peripheral position is to be the starting position of the weighted transformation of the current block, thereby setting the reference weight value of the peripheral position outside the current block based on the starting position of the weighted transformation.

[0063] Take N=8 as an example, as shown in FIG. 4D, after dividing all the surrounding positions into 8 equal parts, 7 weighted predicted positions can be obtained. When the weighted predicted position is 0, the surrounding position a 0 (That is, the peripheral position indicated by dotted line 0. In actual application, dotted line 0 does not exist, dotted line 0 is merely an example shown for ease of understanding, and dotted lines 0 to 6 are used to divide all peripheral positions into 8 equal parts.) represents the start position of the weight conversion of the current block. When the weight prediction position is 1, the peripheral position a 1 represents the starting position of the weight transformation of the current block. In this way, when the weight prediction position is 6, the surrounding position a 6 represents the start position of the weight transformation of the current block.

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

[0065] For different weighted prediction angles, the value of N may be the same, and when the value of N is the same, a different number of weighted prediction positions can be selected. For example, for weighted prediction angle A, the value of N is 8, which means that the range of the peripheral positions determined based on weighted prediction angle A is divided into 8 equal parts, and for weighted prediction angle B, the value of N is 8, which means that the range of the peripheral positions determined based on weighted prediction angle B is divided into 8 equal parts, and the weighted prediction positions corresponding to weighted prediction angle A are a 1 From a 5 A total of five positions can be selected, and b is the weighted prediction position corresponding to the weighted prediction angle B. 0 From b 6 A total of seven positions can be selected.

[0066] For illustrative purposes, the above example takes the peripheral position range to be divided into N equal parts, but in actual application, an unequal division method may be adopted, and instead of dividing into N equal parts, the peripheral position range may be divided into N parts, and this is not a limitation.

[0067] For example, after all the surrounding positions are divided into eight equal parts, seven weighted prediction positions can be obtained, and in step 401, the encoding side may obtain one weighted prediction position from the seven weighted prediction positions, or may select some weighted prediction positions (e.g., five weighted prediction positions) from the seven weighted prediction positions, and further obtain one weighted prediction position from the five weighted prediction positions.

[0068] For example, the encoding side obtains the weighted prediction angle and weighted prediction position of the current block by adopting the following method.

[0069] Method 1: The encoding side and the decoding side decide on the same weighted prediction angle as the weighted prediction angle of the current block, and decide on the same weighted prediction position as the weighted prediction position of the current block. For example, the encoding side and the decoding side decide on the weighted prediction angle A as the weighted prediction angle of the current block, and the encoding side and the decoding side decide on the weighted prediction position a 4 Let be the weighted prediction position of the current block.

[0070] Method 2: The encoding side constructs a weighted prediction angle list, and the weighted prediction angle list may include at least one weighted prediction angle, for example, weighted prediction angle A and weighted prediction angle B. The encoding side constructs a weighted prediction position list, and the weighted prediction position list may include at least one weighted prediction position, for example, weighted prediction position a 0 ~a 6 , weight prediction position b 0 ~b 6 The encoding side sequentially traverses each weighted prediction angle in the weighted prediction angle list, and traverses each weighted prediction position in the weighted prediction position list, that is, traverses each combination of weighted prediction angle and weighted prediction position. For each combination of weighted prediction angle and weighted prediction position, the weighted prediction angle and weighted prediction position in the combination are set as the weighted prediction angle and weighted prediction position of the current block obtained in step 401, and steps 402 to 407 are executed based on the weighted prediction angle and weighted prediction position to obtain a weighted prediction value of the current block.

[0071] For example, the coding side has weighted prediction angle A and weighted prediction position a 0 When traversing to, the weighted predicted angle A and the weighted predicted position a 0 Steps 402 to 407 are executed based on the weighted prediction value A-1 of the current block. 1 When traversing to, the weighted predicted angle A and the weighted predicted position a 1 Steps 402 to 407 are executed based on the weighted prediction value A-2 of the current block. 0When traversing to, the weighted prediction angle B and the weighted prediction position b 0 Steps 402 to 407 are executed based on the weighted prediction value B-1 of the current block, and the process is repeated in this manner. The encoding side can obtain a corresponding weighted prediction value based on each combination (combination of weighted prediction angle and weighted prediction position).

[0072] The encoding side obtains all weighted prediction values ​​based on a combination of weighted prediction angles and weighted prediction positions, and then determines an RDO cost value based on each weighted prediction value. There is no limitation on the determination method, and the encoding side may obtain the RDO cost value of each combination and select the smallest RDO cost value from all the RDO cost values.

[0073] Next, the encoding side takes the weighted prediction angle and weighted prediction position of the combination corresponding to the smallest RDO cost value as the target weighted prediction angle and target weighted prediction position of the current block, and finally incorporates the index value of the target weighted prediction angle in the weighted prediction angle list and the index value of the target weighted prediction position in the weighted prediction position list into the bitstream.For a specific implementation method of incorporating the index value into the bitstream, refer to the application scenario of the method 2 in the following embodiment.

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

[0075] In step 402, the encoding side determines, for each pixel position of the current block, a peripheral matching position indicated by the pixel position from among peripheral positions outside the current block based on the weighted prediction angle of the current block. In this embodiment, for ease of distinction, the peripheral positions indicated by the pixel position outside the current block may be called the peripheral matching positions of the pixel position.

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

[0077] For example, the peripheral position outside the current block may include a peripheral position in one row on the top outside the current block, for example, a peripheral position in the n1th row on the top outside the current block, where n1 may be 1, 2, 3, etc., and is not limited in this respect; or may include a peripheral position in one column on the left outside the current block, for example, a peripheral position in the n2th column on the left outside the current block, where n2 may be 1, 2, 3, etc., and is not limited in this respect; or may include a peripheral position in one row on the bottom outside the current block, for example, a peripheral position in the n3th row on the bottom outside the current block, where n3 may be 1, 2, 3, etc., and is not limited in this respect; or may include a peripheral position in one column on the right outside the current block, for example, a peripheral position in the n4th column on the right outside the current block, where n4 may be 1, 2, 3, etc., and is not limited in this respect.

[0078] Of course, the above are only some examples of peripheral positions, and are not limited thereto, and in practical application, in addition to using the peripheral positions outside the current block, the internal positions of the current block may be used, that is, the internal positions of the current block may replace the peripheral positions outside the current block, for example, the internal position of the n5th row inside the current block, where n5 may be 1, 2, 3, etc., or the internal position of the n6th column inside the current block, where n6 may be 1, 2, 3, etc. Of course, the length of the internal position may exceed the scope of the current block, for example, the position of the n7th row may exceed the scope of the current block, that is, extend outward from both sides of the current block.

[0079] Of course, it is also possible to use positions inside the current block and positions outside the current block on the periphery at the same time.

[0080] When using the internal position of the current block, or when using the internal position of the current block and an external peripheral position of the current block at the same time, the current block can be divided into two sub-blocks, upper and lower, according to the row in which the internal position is located, or into two sub-blocks, left and right, according to the column in which the internal position is located, and in this case, the two sub-blocks have the same weighted prediction angle and the same weighted prediction position.

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

[0082] For ease of explanation, the following embodiments take the peripheral position in the first row on the top outside the current block, or the peripheral position in the first column on the left outside the current block, as examples, and the implementation forms for other peripheral positions are similar.

[0083] For example, regarding the range of peripheral positions outside the current block, a specific range may be specified in advance as the range of peripheral positions outside the current block, or the range of peripheral positions outside the current block may be determined based on a weighted prediction angle. For example, the peripheral positions indicated by each pixel position inside the current block may be determined based on a weighted prediction angle, and the range of peripheral positions outside the current block may be determined based on the boundaries of the peripheral positions indicated by all pixel positions, and the range of peripheral positions outside the current block may be determined without limiting the range of the peripheral positions.

[0084] The peripheral locations outside the current block may include integer pixel locations, or the peripheral locations outside the current block may include non-integer pixel locations, which may be sub-pixel locations, such as ½ sub-pixel locations, ¼ sub-pixel locations, ¾ sub-pixel locations, etc., without limitation in this regard, or the peripheral locations outside the current block may include integer pixel locations and sub-pixel locations.

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

[0086] Figures 4B and 4C show that one surrounding position corresponds to one integer pixel position, and Figure 4E shows that two surrounding positions correspond to one integer pixel position, and other cases will not be described in this embodiment.

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

[0088] For example, for each pixel position of the current block, after determining the surrounding matching position indicated by the pixel position, the encoding side may determine a reference weight value associated with the surrounding matching position, where the reference weight value associated with the surrounding matching position may be preset or may be determined by adopting a specific method, and the specific determination method may refer to the subsequent embodiments.

[0089] Next, the encoding side may determine a target weight value for the pixel position based on the reference weight values ​​associated with the surrounding matching positions, for example, determining the reference weight values ​​associated with the surrounding matching positions as the target weight value for the pixel position.

[0090] For example, a reference weight value may be set at a peripheral position outside the current block, and the specific process may refer to the subsequent embodiment, and the peripheral position outside the current block may be an integer pixel position or a sub-pixel position, for example, a reference weight value may be set at an integer pixel position outside the current block, and / or a reference weight value may be set at a sub-pixel position outside the current block.

[0091] In one possible embodiment, determining the target weight value of the pixel position based on the reference weight value associated with the neighboring matching positions may include the following five cases: Case 1: If the neighboring matching positions are integer pixel positions and a reference weight value has already been set for the integer pixel positions, the target weight value of the pixel position is determined based on the reference weight value of the integer pixel position. Case 2: If the neighboring matching positions are integer pixel positions and a reference weight value has not been set for the integer pixel positions, the target weight value of the pixel position may be determined based on the reference weight value of the neighboring positions of the integer pixel position, for example, the reference weight value of the neighboring positions may be rounded up to obtain the target weight value of the pixel position, or the reference weight value of the neighboring positions may be rounded down to obtain the target weight value of the pixel position, or the target weight value of the pixel position may be determined based on the reference weight value of the neighboring positions of the integer pixel position, and this is not limited thereto. Case 3: If the neighboring matching positions are sub-pixel positions and a reference weight value has already been set for the sub-pixel positions, the target weight value of the pixel position is determined based on the reference weight value of the sub-pixel position. Case 4: If the surrounding matching position is a sub-pixel position and a reference weight value is not set for the sub-pixel position, the target weight value of the pixel position can be determined based on the reference weight values ​​of the neighboring positions of the sub-pixel position, for example, the reference weight value of the neighboring position can be rounded up to obtain the target weight value of the pixel position, or the reference weight value of the neighboring position can be rounded down to obtain the target weight value of the pixel position, or the target weight value of the pixel position can be determined based on the reference weight values ​​of the neighboring positions of the sub-pixel position, and this is not limited thereto.Case 5: The target weight value of the pixel position can be determined based on multiple reference weight values ​​associated with the surrounding matching positions, for example, the reference weight values ​​of multiple neighboring positions of the surrounding matching position can be obtained regardless of whether the surrounding matching position is an integer pixel position or a sub-pixel position.If a reference weight value has already been set at the peripheral matching position, a weighting operation is performed on the reference weight value of the peripheral matching position and the reference weight values ​​of the multiple adjacent positions to obtain a target weight value for the pixel position; if a reference weight value has not been set at the peripheral matching position, a weighting operation is performed on the reference weight values ​​of the multiple adjacent positions to obtain a target weight value for the pixel position.

[0092] Of course, the above cases 1 to 5 are merely examples, and are not limiting to the method of determining the target weight value.

[0093] In step 404, the encoding side determines an associated weight value for the pixel position based on the target weight value for that pixel position.

[0094] In step 405, for each pixel position of the current block, the encoding side determines a first predicted value for that pixel position based on a first prediction mode of the current block, and determines a second predicted value for that pixel position based on a second prediction mode of the current block.

[0095] Exemplarily, the first prediction mode may be any one of an intra block copy prediction mode, an intra frame prediction mode, an inter frame prediction mode, and a palette mode, and the second prediction mode may be any one of an intra block copy prediction mode, an intra frame prediction mode, an inter frame prediction mode, and a palette mode. For example, the first prediction mode may be an intra block copy prediction mode and the second prediction mode may be an intra block copy prediction mode, or the first prediction mode may be an inter frame prediction mode and the second prediction mode may be an inter frame prediction mode, etc.

[0096] For the process of determining the predicted value based on the first prediction mode and the second prediction mode, please refer to the subsequent examples.

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

[0098] In step 407, the encoding side determines a weighted prediction value for the current block based on the weighted prediction value for each pixel position of the current block.

[0099] As can be seen from the above, the embodiment of the present application proposes an effective method for setting weight values, and a reasonable target weight value can be set for each pixel position of the current block, so that the predicted value of the current block is closer to the original pixel, thereby improving prediction accuracy, improving prediction performance, and improving coding performance.

[0100] Example 3: In Example 1, the current block may include one sub-block, that is, the sub-block is the current block itself, and for the current block, what is shown in FIG. 4F is a flowchart of a decoding method, which can be applied to the decoding side, and the method may include steps 411 to 417.

[0101] When it is determined in step 411 that weighted prediction is to be started for the current block, the decoding side obtains the weighted prediction angle and weighted prediction position of the current block.

[0102] For example, the decoding side also needs to decide whether to allow weighted prediction to be started for the current block. If allowed, obtain the weighted prediction angle and weighted prediction position of the current block and execute the subsequent steps; if not allowed, the present application does not limit the processing method.

[0103] In one possible embodiment, the encoding side judges whether the feature information of the current block meets a certain condition, and if so, decides to start weighted prediction for the current block. The decoding side also judges whether the feature information of the current block meets a certain condition, and if so, decides to start weighted prediction for the current block, and if not, decides not to start weighted prediction for the current block. Regarding how the decoding side decides whether to start weighted prediction for the current block based on the feature information, please refer to step 401, and the description will be omitted here.

[0104] In another possible embodiment, the encoding side determines whether the current block supports weighted prediction based on the feature information of the current block, and when the current block supports weighted prediction, it may adopt other methods to determine whether to start weighted prediction for the current block, for example, adopt the RDO method to determine whether to start weighted prediction for the current block. After determining whether to start weighted prediction for the current block, when the encoding side sends the encoding bitstream of the current block, the encoding bitstream may include a syntax for whether to start weighted prediction for the current block, and the syntax represents whether to start weighted prediction for the current block. The specific manner for the decoding side to determine whether the current block supports weighted prediction based on the feature information of the current block refers to step 401, and the description is omitted here. When it is determined that the current block supports weighted prediction, the decoding side may parse the syntax for whether to start weighted prediction for the current block from the encoding bitstream, and determine whether to start weighted prediction for the current block based on the syntax.

[0105] In one possible embodiment, when it is determined to start weighted prediction for a current block, the decoding side obtains a weighted prediction angle and a weighted prediction position of the current block, and the interpretation related to the weighted prediction angle and the weighted prediction position can refer to step 401, and the description is omitted here. The decoding side can obtain the weighted prediction angle and the weighted prediction position of the current block by adopting the following method.

[0106] Method 1: The decoding side and the encoding side decide the same weighted prediction angle as the weighted prediction angle of the current block, and decide the same weighted prediction position as the weighted prediction position of the current block. For details, refer to the method 1 in the previous embodiment.

[0107] Method 2: The decoding side constructs a weighted prediction angle list, and the weighted prediction angle list is the same as the weighted prediction angle list of the encoding side. The decoding side constructs a weighted prediction position list, and the weighted prediction position list is the same as the weighted prediction position list of the encoding side. For specific content, refer to method 2 of the previous embodiment. After receiving the encoding bit stream of the current block, the decoding side analyzes indication information from the encoding bit stream, and selects one weighted prediction angle from the weighted prediction angle list as the weighted prediction angle of the current block according to the indication information, and selects one weighted prediction position from the weighted prediction position list as the weighted prediction position of the current block according to the indication information.

[0108] Below, the implementation process of method 2 will be explained with reference to some specific application scenarios.

[0109] Application scenario 1: When the encoding side transmits an encoded bitstream to the decoding side, the encoded bitstream may include indication information 1, which is used to indicate the weighted prediction angle of the current block (i.e., the target weighted prediction angle) and the weighted prediction position of the current block (i.e., the target weighted prediction position). For example, when the indication information 1 is 0, it is used to indicate the first weighted prediction angle in the weighted prediction angle list, and to indicate the first weighted prediction position in the weighted prediction position list, and thus the value of the indication information 1 is used to indicate which weighted prediction angle and which weighted prediction position, and as long as the encoding side and the decoding side agree on this, there is no limitation regarding this.

[0110] After receiving the encoded bitstream, the decoding side may analyze the indication information 1 from the encoded bitstream, and the decoding side may select a weighted prediction angle corresponding to the indication information 1 from the weighted prediction angle list based on the indication information 1, and set the weighted prediction angle as the weighted prediction angle of the current block. The decoding side may select a weighted prediction position corresponding to the indication information 1 from the weighted prediction position list based on the indication information 1, and set the weighted prediction position as the weighted prediction position of the current block.

[0111] Application scenario 2: When the encoding side transmits an encoded bitstream to the decoding side, the encoded bitstream may include indication information 2 and indication information 3. The indication information 2 is used to indicate a target weighted prediction angle of the current block, for example, index value 1 in a weighted prediction angle list of a target weighted prediction angle, where index value 1 indicates the ordinal number of the weighted prediction angle in the weighted prediction angle list of the target weighted prediction angle. The indication information 3 is used to indicate a target weighted prediction position of the current block, for example, index value 2 in a weighted prediction position list of a target weighted prediction position, where index value 2 indicates the ordinal number of the weighted prediction position in the weighted prediction position list of the target weighted prediction position.

[0112] After receiving the encoded bitstream, the decoding side analyzes the instruction information 2 and the instruction information 3 from the encoded bitstream, and selects a weighted prediction angle corresponding to the index value 1 from the weighted prediction angle list based on the instruction information 2, and sets the weighted prediction angle as the weighted prediction angle of the current block. The decoding side selects a weighted prediction position corresponding to the index value 2 from the weighted prediction position list based on the instruction information 3, and sets the weighted prediction position as the weighted prediction position of the current block.

[0113] Application scenario 3: The encoding side and the decoding side may agree on a preferred setting combination, and may be set according to actual experience without being limited to the preferred setting combination. For example, weighted prediction angle A and weighted prediction position a 4 A preferred setting combination 1 including a weighted prediction angle B and a weighted prediction position b 4 A preferred setting combination 2 including the above may be determined.

[0114] After the encoding side determines the target weight prediction angle and the target weight prediction position of the current block, it determines whether the target weight prediction angle and the target weight prediction position are the preferred setting combination. If so, when the encoding side transmits the encoded bit stream to the decoding side, the encoded bit stream may include the indication information 4 and the indication information 5. The indication information 4 is used to indicate whether the current block adopts the preferred setting combination, for example, the indication information 4 being a first value (for example, 0) indicates that the current block adopts the preferred setting combination. The indication information 5 is used to indicate which preferred setting combination the current block adopts, for example, when the value of the indication information 5 is 0, it is used to indicate that the current block adopts the preferred setting combination 1, and when the value of the indication information 5 is 1, it is used to indicate that the current block adopts the preferred setting combination 2.

[0115] After receiving the encoded bitstream, the decoding side can analyze the indication information 4 and the indication information 5 in the encoded bitstream, and the decoding side can determine whether the current block adopts a preferred configuration combination based on the indication information 4. If the indication information 4 is a first value, it is determined that the current block adopts a preferred configuration combination. When the current block adopts a preferred configuration combination, the decoding side can determine which preferred configuration combination the current block adopts based on the indication information 5. For example, when the value of the indication information 5 is 0, the decoding side may determine that the current block adopts a preferred configuration combination 1, that is, the weighted prediction angle of the current block is weighted prediction angle A, and the weighted prediction position of the current block is weighted prediction position a. 4 As another example, when the value of the indication information 5 is 1, the decoding side may determine that the current block adopts the preferred setting combination 2, that is, the weighted prediction angle of the current block is the weighted prediction angle B, and the weighted prediction position of the current block is the weighted prediction position b 4 It is.

[0116] For example, if the encoding side and the decoding side only negotiate one set of preferred setting combinations, for example, weight prediction angle A and weight prediction position a 4 If the preferred setting combination includes, the coding bitstream may only include the indication information 4 and not include the indication information 5, and the indication information 4 is used to indicate that the current block adopts the preferred setting combination. After the decoding side analyzes the indication information 4 from the coding bitstream, if the indication information 4 is a first value, the decoding side determines that the current block adopts the preferred setting combination, and the decoding side sets the weighted prediction angle of the current block to the weighted prediction angle A and the weighted prediction position of the current block to the weighted prediction position a according to the preferred setting combination. 4 It is determined as follows.

[0117] Application scenario 4: The encoding side and the decoding side may negotiate a preferred setting combination, and the encoding side may determine whether the target weight prediction angle and the target weight prediction position of the current block are the preferred setting combination after determining the target weight prediction angle and the target weight prediction position of the current block. Otherwise, when the encoding side sends an encoded bit stream to the decoding side, the encoded bit stream includes the indication information 4 and the indication information 6. The indication information 4 is used to indicate whether the current block adopts the preferred setting combination, for example, the indication information 4 is a second value (for example, 1), which indicates that the current block does not adopt the preferred setting combination. The indication information 6 is used to indicate the target weight prediction angle of the current block and the target weight prediction position of the current block.

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

[0119] Application scenario 5: The encoding side and the decoding side may negotiate a preferred setting combination, and the encoding side may determine whether the target weight prediction angle and the target weight prediction position of the current block are a preferred setting combination after determining the target weight prediction angle and the target weight prediction position of the current block. Otherwise, when the encoding side transmits an encoded bit stream to the decoding side, the encoded bit stream may include the indication information 4, the indication information 7, and the indication information 8. Exemplarily, the indication information 4 is used to indicate whether the current block adopts a preferred setting combination, for example, the indication information 4 being the second value represents that the current block does not adopt a preferred configuration combination. The indication information 7 is used to indicate the target weight prediction angle of the current block. The indication information 8 is used to indicate the target weight prediction position of the current block.

[0120] After receiving the encoded bitstream, the decoding side analyzes the indication information 4, the indication information 7, and the indication information 8 from the encoded bitstream, and the decoding side determines whether the current block adopts a preferred configuration combination based on the indication information 4. If the indication information 4 is a second value, it determines that the current block does not adopt a preferred configuration combination. When the current block does not adopt a preferred configuration combination, the decoding side selects a corresponding weighted prediction angle from the weighted prediction angle list based on the indication information 7, and sets the weighted prediction angle as the weighted prediction angle of the current block. The decoding side selects a corresponding weighted prediction position from the weighted prediction position list based on the indication information 8, and sets the weighted prediction position as the weighted prediction position of the current block.

[0121] Of course, the above method 1 and method 2 are merely examples and are not limiting in this respect, as long as the decoding side can obtain the weighted prediction angle (i.e., the target weighted prediction angle) and weighted prediction position (i.e., the target weighted prediction position) of the current block.

[0122] In step 412, for each pixel position of the current block, the decoding side determines a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block.

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

[0124] In step 414, the decoder determines an associated weight value for the pixel position based on the target weight value for that pixel position.

[0125] In step 415, for each pixel position of the current block, the decoding side determines a first predicted value for that pixel position based on a first prediction mode of the current block, and determines a second predicted value for that pixel position based on a second prediction mode of the current block.

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

[0127] In step 417, the decoding side determines a weighted prediction value for the current block based on the weighted prediction value for each pixel position of the current block.

[0128] For example, the implementation process of steps 412 to 417 can refer to steps 402 to 407, except that steps 412 to 417 are the process flow on the decoding side, not the process flow on the encoding side, and therefore the description will be omitted here.

[0129] As can be seen from the above, the embodiment of the present application proposes an effective method for setting weight values, and a reasonable target weight value can be set for each pixel position of the current block, so that the predicted value of the current block is closer to the original pixel, thereby improving the prediction accuracy, improving the prediction performance, and improving the decoding performance.

[0130] In the second and third embodiments, the current block includes one sub-block, that is, the processing is performed on the current block. Such a processing method can be referred to as an inter-frame angular weighted prediction (AWP) mode.

[0131] Example 4: In the above-mentioned Examples 1 to 3, a weighted prediction angle is involved, and the weighted prediction angle may be any angle, for example, any angle within 180 degrees, or any angle within 360 degrees, for example, 10 degrees, 20 degrees, 30 degrees, etc., and there is no limitation to the weighted prediction angle. In one possible embodiment, the weighted prediction angle may be a horizontal angle (for example, angle 2 in FIG. 5B), or the weighted prediction angle may be a vertical angle (for example, angle 6 in FIG. 5B), or the absolute value of the gradient of the weighted prediction angle (the gradient of the weighted prediction angle is the tangent of the weighted prediction angle) may be 2 to the power of n, where n is an integer, for example, a positive integer, 0, a negative integer, etc. For example, the absolute value of the gradient of the weighted prediction angle may be 1 (i.e., 2 to the power of 0), 2 (i.e., 2 to the power of 1), 1 / 2 (i.e., 2 to the power of -1), 4 (i.e., 2 to the power of 2), 1 / 4 (i.e., 2 to the power of -2), 8 (i.e., 2 to the power of 3), 1 / 8 (i.e., 2 to the power of -3), etc. Exemplarily, FIG. 5A shows eight weighted prediction angles, and the absolute values ​​of the gradients of these weighted prediction angles are 2 to the power of n. In the following embodiment, a shift can be performed on the weighted prediction angle, and thus, when the absolute value of the gradient of the weighted prediction angle is 2 to the power of n, a division can be avoided when performing a shift on the weighted prediction angle, making the shift easier to realize.

[0132] For example, the number of weighted prediction angles supported may be the same or different depending on the block size.

[0133] In the above-mentioned embodiments 1 to 3, for each pixel position, the target weight value of the pixel position may be determined based on the reference weight value associated with the surrounding matching positions pointed to by the pixel position. In the embodiments 2 and 3, the surrounding matching positions are the surrounding matching positions of the current block.

[0134] The following manner may be adopted to obtain the reference weight value associated with the surrounding matching position: Determine a reference weight value associated with the surrounding matching position according to the coordinate value of the surrounding matching position of the current block and the coordinate value of the weight transformation start position of the current block.

[0135] For example, if the peripheral matching position is a peripheral position of the upper row or the lower row outside the current block, the coordinate value of the peripheral matching position is the abscissa value of the peripheral matching position, and the coordinate value of the weight transformation start position is the abscissa value of the weight transformation start position; or if the peripheral matching position is a peripheral position of the left column or the right column outside the current block, the coordinate value of the peripheral matching position is the ordinate value of the peripheral matching position, and the coordinate value of the weight transformation start position is the ordinate value of the weight transformation start position.

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

[0137] In one possible embodiment, when determining the reference weight value associated with the surrounding matching position based on the coordinate value of the surrounding matching position and the coordinate value of the weight transformation start position of the current block, the difference between the coordinate value of the surrounding matching position and the coordinate value of the weight transformation start position of the current block may be calculated. If the difference is smaller than a first threshold, the reference weight value associated with the surrounding matching position is determined as the first threshold, if the difference is larger than a second threshold, the reference weight value associated with the surrounding matching position is determined as the second threshold, if the difference is equal to or larger than the first threshold and equal to or smaller than the second threshold, the reference weight value associated with the surrounding matching position is determined as the difference. In another possible embodiment, when determining the reference weight value associated with the surrounding matching position based on the coordinate value of the surrounding matching position and the coordinate value of the weight transformation start position of the current block, the reference weight value associated with the surrounding matching position may be directly determined based on the magnitude relationship between the coordinate value of the surrounding matching position and the coordinate value of the weight transformation start position of the current block.

[0138] For example, if the coordinate value of the surrounding matching position is smaller than the coordinate value of the weight transformation start position of the current block, the reference weight value associated with the surrounding matching position may be determined as a first threshold value, and if the coordinate value of the surrounding matching position is greater than or equal to the coordinate value of the weight transformation start position of the current block, the reference weight value associated with the surrounding matching position may be determined as a second threshold value.

[0139] As another example, if the coordinate value of the surrounding matching position is smaller than the coordinate value of the weight transformation start position of the current block, the reference weight value associated with the surrounding matching position may be determined as the second threshold value, and if the coordinate value of the surrounding matching position is greater than or equal to the coordinate value of the weight transformation start position of the current block, the reference weight value associated with the surrounding matching position may be determined as the first threshold value.

[0140] For example, the first threshold and the second threshold may be set according to experience, and the first threshold is smaller than the second threshold, and there is no limitation on the first threshold and the second threshold. For example, the first threshold is a minimum value of a pre-arranged reference weight value, such as 0, and the second threshold is a maximum value of a pre-arranged reference weight value, such as 8, and of course, 0 and 8 are merely examples.

[0141] For example, as shown in FIG. 4D, after dividing all the peripheral positions into 8 equal parts, 7 weighted predicted positions can be obtained. When the weighted predicted position is 0, the peripheral position a 0 That is, the coordinate value of the weight transformation start position is the peripheral position a 0 When the weighted predicted position is 1, the surrounding position a 1 That is, the coordinate value of the weight transformation start position is the peripheral position a 1 The method for repeating this process and determining the coordinate values ​​of the weighting conversion start position will not be described here.

[0142] Example 6: In the above Examples 1 to 3, for each pixel position, a target weight value of the pixel position may be determined based on a reference weight value related to a surrounding matching position indicated by the pixel position. The following description will be given taking the surrounding matching position of the current block as an example. The following method may be adopted to obtain the reference weight value related to the surrounding matching position. A reference weight value list of the current block is determined, the reference weight value list may include a plurality of reference weight values, and the plurality of reference weight values ​​in the reference weight value list are preset or set based on a weight setting parameter. A valid number of reference weight values ​​is selected from the reference weight value list based on a target index, and a reference weight value of a surrounding position outside the current block is set based on the valid number of reference weight values. Exemplarily, the valid number may be determined based on a size of the current block and a weight prediction angle of the current block, and the target index may be determined based on a size of the current block, a weight prediction angle of the current block, and a weight prediction position of the current block.

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

[0144] The above process of setting the reference weight values ​​of the peripheral positions will be described below with reference to the specific implementation steps shown in FIG. 6A.

[0145] In step S1, a reference weight value list for the current block is determined.

[0146] In one possible embodiment, the sequence-level reference weight list may be determined as the reference weight list of the current block. For example, both the encoding side and the decoding side may configure the sequence-level reference weight list A1, and for the sequence-level multi-frame images, they all use the reference weight list A1, that is, for each current block of the sequence-level multi-frame images, no matter what the weight prediction angle and weight prediction position are, they share the same reference weight list A1.

[0147] In another possible embodiment, a preset reference weight value list may be determined as the reference weight value list of the current block. For example, both the encoding side and the decoding side can preset a reference weight value list, and all images of multiple sequences use the same reference weight value list, that is, no matter what the weight prediction angle and weight prediction position are, each current block of all images of multiple sequences shares the same reference weight value list.

[0148] In another possible embodiment, the reference weight value list corresponding to the weighted prediction angle of the current block may be determined as the reference weight value list of the current block. For example, a plurality of reference weight value lists are configured on both the encoding side and the decoding side, and some weighted prediction angles share the same reference weight value list. For example, a reference weight value list A2 and a reference weight value list A3 are configured, and weighted prediction angle 1 and weighted prediction angle 2 share the same reference weight value list A2, and weighted prediction angle 3 uses the reference weight value list A3. Thus, after obtaining the weighted prediction angle of the current block, if the weighted prediction angle of the current block is weighted prediction angle 1, the reference weight value list A2 corresponding to weighted prediction angle 1 is determined as the reference weight value list of the current block.

[0149] In another possible embodiment, the reference weight value list corresponding to the weighted prediction angle of the current block and the weighted prediction position of the current block may be determined as the reference weight value list of the current block. For example, a plurality of reference weight value lists are configured on both the encoding side and the decoding side, and different combinations of weighted prediction angles and weighted prediction positions may correspond to the same or different reference weight value lists. For example, a reference weight value list A4, a reference weight value list A5, and a reference weight value list A6 are configured, and weighted prediction angle 1 and weighted prediction positions 0 to 2 share the same reference weight value list A4, weighted prediction angle 1 and weighted prediction positions 3 to 5 share the same reference weight value list A5, and weighted prediction angle 2 and weighted prediction positions 0 to 5 share the same reference weight value list A6. Thus, after obtaining the weighted prediction angle and weighted prediction position of the current block, if the weighted prediction angle of the current block is weighted prediction angle 1 and the weighted prediction position of the current block is weighted prediction position 4, the reference weight value list A5 corresponding to the weighted prediction angle 1 and the weighted prediction position 4 is determined as the reference weight value list of the current block.

[0150] In another possible embodiment, a reference weight value list corresponding to the size of the current block and the weighted prediction angle of the current block may be determined as the reference weight value list of the current block. For example, a plurality of reference weight value lists are configured on both the encoding side and the decoding side, and different combinations of size and weighted prediction angle may correspond to the same or different reference weight value lists. For example, a reference weight value list A7 and a reference weight value list A8 are configured, and weighted prediction angle 1 and size 1 adopt the reference weight value list A7, and weighted prediction angle 1 and size 2, and weighted prediction angle 2 and size 1 both adopt the reference weight value list A8. Thus, if the weighted prediction angle of the current block is weighted prediction angle 1 and the size of the current block is size 1, the reference weight value list A7 corresponding to weighted prediction angle 1 and size 1 may be determined as the reference weight value list of the current block.

[0151] As can be seen above, a reference weight value list for the current block can be determined, which may include multiple reference weight values, and the multiple reference weight values ​​in the reference weight value list may be pre-set or set based on weight setting parameters.

[0152] Regarding the reference weight value list of the current block, the number of reference weight values ​​in the reference weight value list may be a fixed value that is set, and the fixed value may be arbitrarily set based on experience, and there is no limitation in this respect. Or, the number of reference weight values ​​in the reference weight value list may be related to the size (for example, width or height) of the current frame where the current block is located, for example, the number of reference weight values ​​may be greater than the width of the current frame or the same as the width of the current frame, and the number of reference weight values ​​may be greater than the height of the current frame or the same as the height of the current frame, and there is no limitation in this respect, and the number of reference weight values ​​may be selected according to actual needs.

[0153] By way of example, for multiple reference weight values ​​in a reference weight value list, the multiple reference weight values ​​may be inconsistent reference weight values, for example, the multiple reference weight values ​​in the reference weight value list may not be exactly the same.

[0154] In one possible embodiment, the plurality of reference weight values ​​in the reference weight value list may monotonically increase or monotonically decrease. Or, the plurality of reference weight values ​​in the reference weight value list may monotonically increase and then monotonically decrease, or monotonically decrease and then monotonically increase. Or, the plurality of reference weight values ​​in the reference weight value list may first include a plurality of first reference weight values ​​and then include a plurality of second reference weight values, or first include a plurality of second reference weight values ​​and then include a plurality of first reference weight values. Hereinafter, the contents of the reference weight value list will be described with reference to some specific situations.

[0155] Case 1: A plurality of reference weight values ​​in the reference weight value list may monotonically increase or decrease. For example, the reference weight value list may be [8 8 8 8...8 8 7 6 5 4 3 2 1 0 0 0 0...0 0], that is, a plurality of reference weight values ​​in the reference weight value list monotonically decrease. As another example, the reference weight value list may be [0 0 0 0...0 0 1 2 3 4 5 6 7 8 8 8 8...8 8], that is, a plurality of reference weight values ​​in the reference weight value list monotonically increase. Of course, the above is merely an example and is not limited to the reference weight value list.

[0156] For example, the reference weight values ​​in the reference weight value list may be preset or may be set based on weight setting parameters. The weight setting parameters may include a weight conversion rate and a start position of the weight conversion. The weight conversion rate may be a value set by experience, and the start position of the weight conversion may also be a value set by experience.

[0157] The multiple reference weight values ​​in the reference weight value list may monotonically increase or decrease. For example, if the maximum value of the reference weight value is M1 and the minimum value of the reference weight value is M2, the multiple reference weight values ​​in the reference weight value list may monotonically decrease from the maximum value M1 to the minimum value M2, or monotonically increase from the minimum value M2 to the maximum value M1. If M1 is 8 and M2 is 0, the multiple reference weight values ​​may monotonically decrease from 8 to 0, or monotonically increase from 0 to 8.

[0158] For example, in the process of presetting the reference weight values ​​in the reference weight value list, the multiple reference weight values ​​in the reference weight value list may be set arbitrarily, and the multiple reference weight values ​​only need to monotonically increase or decrease.

[0159] For example, the process of setting the reference weight value in the reference weight value list according to the weight setting parameter may first obtain a weight conversion rate and a start position of weight conversion, and then determine a plurality of reference weight values ​​in the reference weight value list according to the weight conversion rate and the start position of weight conversion. The weight conversion rate and the start position of weight conversion may be preset values, and the weight conversion rate and the start position of weight conversion may not be limited, and may be set according to experience.

[0160] For example, the following method may be adopted to determine the reference weight value in the reference weight value list: y(x)=Clip3(minimum, maximum, a*(xs)), where x represents the position index in the reference weight value list, for example, x is 1 represents the first position in the reference weight value list, and y(x) represents the x-th reference weight value in the reference weight value list. a represents the weight conversion rate, and s represents the start position of the weight conversion. The Clip3 function is used to restrict the reference weight value to be between the minimum and maximum values, and both the minimum and maximum values ​​may be set empirically. For the convenience of explanation, the following explanation will be given with the minimum value being 0 and the maximum value being 8 as an example.

[0161] a represents a weight conversion rate, which may be set empirically, for example, a may be an integer other than 0, for example, a may be -4, -3, -2, -1, 1, 2, 3, 4, etc., and for convenience of explanation, a is taken as 1. If a is 1, the reference weight value from 0 to 8 must pass through 0, 1, 2, 3, 4, 5, 6, 7, 8, or the reference weight value from 8 to 0 must pass through 8, 7, 6, 5, 4, 3, 2, 1, 0.

[0162] s can represent the starting position of weight conversion, and can be set empirically, for example, s can be half the total number of reference weight values ​​in the reference weight value list, or s can be slightly less than half the total number of reference weight values, for example, half the total number of reference weight values ​​minus 4, or s can be slightly more than half the total number of reference weight values, for example, half the total number of reference weight values ​​plus 4. Of course, the above are only some examples of the value of s, and are not limited to the value of s.

[0163] As can be seen above, when setting the reference weight value in the reference weight value list according to the weight setting parameter, the following method can be adopted: ReferenceWeightsWhole[x]=Clip3(0,8,xZ), or ReferenceWeightsWhole[x]=Clip3(0,8,Zx), or ReferenceWeightsWhole[x]=Clip3(0,4,xZ), or ReferenceWeightsWhole[x]=Clip3(0,4,Zx). Of course, the above methods are merely some examples, and are not limited to the present implementation.

[0164] In the above formula, the value of x ranges from 0 to WholeLength-1, and when x is 1, ReferenceWeightsWhole[x] represents the first reference weight value in the reference weight value list, when x is 2, ReferenceWeightsWhole[x] represents the second reference weight value in the reference weight value list, and so on. Exemplarily, if the outer peripheral position of the current block is the peripheral position of one row above or one row below, WholeLength is determined based on the width of the current frame, and if the outer peripheral position of the current block is the peripheral position of one column to the left or one column to the right, WholeLength is determined based on the height of the current frame.

[0165] In the above formula a*(xs), if a is 1, a*(xs)=xs, that is, xZ in Clip3(0,8,xZ) is equal to xs, and Z represents the starting position of the weight transformation. If a is -1, a*(xs)=sx, that is, Zx in Clip3(0,8,Zx) is equal to sx, and Z represents the starting position of the weight transformation. When a is another value, the realization process is similar, and the reference weight value in the reference weight value list only needs to satisfy y(x)=Clip3(minimum, maximum,a*(xs)). Clip3(0,8) is used to limit the reference weight value between 0 and 8, and Clip3(0,4) is used to limit the reference weight value between 0 and 4.

[0166] In the above formula, Z represents the starting position of the weight conversion, which may be set empirically. For example, if the value of x ranges from 0 to 511 and Z is 255, then Z can be substituted into the formula ReferenceWeightsWhole[x]=Clip3(0,8,xZ), and for any value from 0 to 511, ReferenceWeightsWhole[x] can be obtained, that is, 512 reference weight values ​​can be obtained, and the 512 reference weight values ​​constitute a reference weight value list. For example, when the value of x is from 0 to 255, the reference weight values ​​are all 0, when the value of x is 256, the reference weight value is 1, thus, when the value of x is 262, the reference weight value is 7, and when the value of x is from 263 to 511, the reference weight values ​​are all 8. As can be seen above, when a is 1, Clip3(0,8,xZ) is used to monotonically increase the reference weight value. Similarly, Z may be substituted into other formulas to obtain 512 reference weight values, and a reference weight list may be constructed based on the 512 reference weight values, for example, when a is -1, Clip3(0,8,Zx) is used to monotonically decrease the reference weight value, Clip3(0,4) is used to limit the reference weight value between 0 and 4, and the description thereof is omitted.

[0167] As seen above, a reference weight value list of the current block can be obtained, and the reference weight value list may include multiple reference weight values, and the multiple reference weight values ​​in the reference weight value list may be monotonically increasing or monotonically decreasing. In one possible embodiment, for the reference weight value list, the reference weight value list may further include a reference weight value of the target area, a reference weight value of a first adjacent area of ​​the target area, and a reference weight value of a second adjacent area of ​​the target area.

[0168] The target area includes one or more reference weight values ​​determined based on the start position of the weight transformation. For example, one reference weight value is determined based on the start position of the weight transformation, and the reference weight value is set as the target area. For example, if the start position s of the weight transformation is 255, the 259th reference weight value may be set as the target area, or the 258th reference weight value may be set as the target area, or the 260th reference weight value may be set as the target area, and of course, the above are only some examples and are not limited thereto. As another example, multiple reference weight values ​​are determined based on the start position of the weight transformation, and the multiple reference weight values ​​are set as the target area, for example, the 256th to 262nd reference weight values ​​are set as the target area, or the 258th to 260th reference weight values ​​are set as the target area, and of course, the above are only some examples and are not limited thereto.

[0169] For example, the target area may include a reference weight value with a reference weight value of 4, for example, the 259th reference weight value is 4, therefore, if the target area includes one reference weight value, the target area may include the 259th reference weight value, or if the target area includes multiple reference weight values, the target area may include the 256th to 262nd reference weight values, or the 258th to 260th reference weight values, and this is not limited as long as the 259th reference weight value is present in the target area.

[0170] As seen above, the target region may include one reference weight value, or the target region may include multiple reference weight values. If the target region includes multiple reference weight values, the multiple reference weight values ​​of the target region monotonically increase or decrease. The monotonically increase may be a strict monotonically increase (i.e., the multiple reference weight values ​​of the target region strictly monotonically increase), and the monotonically decrease may be a strict monotonically decrease (i.e., the multiple reference weight values ​​of the target region strictly monotonically decrease). For example, the multiple reference weight values ​​of the target region monotonically increase from 1 to 7, or the multiple reference weight values ​​of the target region monotonically decrease from 7 to 1.

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

[0172] Or, all the reference weight values ​​of the first adjacent region are the second reference weight value, and all the reference weight values ​​of the second adjacent region are the third reference weight value, and the second reference weight value and the third reference weight value are different. For example, all the reference weight values ​​of the first adjacent region are 0, the target region includes multiple reference weight values, which monotonically increase from 1 to 7, and all the reference weight values ​​of the second adjacent region are 8, and it goes without saying that the reference weight values ​​of the first adjacent region and the reference weight values ​​of the second adjacent region are different.

[0173] Or, the reference weight values ​​of the first adjacent region and the second adjacent region monotonically increase or decrease at the same time. For example, the reference weight value of the first adjacent region monotonically increases, and the reference weight value of the second adjacent region also monotonically increases, or, as another example, the reference weight value of the first adjacent region monotonically decreases, and the reference weight value of the second adjacent region also monotonically decreases. For example, the reference weight value of the first adjacent region monotonically increases from 0 to 3, the target region includes one reference weight value, the reference weight value is 4, and the reference weight value of the second adjacent region monotonically increases from 5 to 8.

[0174] Case 2: A plurality of reference weight values ​​in the reference weight value list monotonically increase and then monotonically decrease, or a plurality of reference weight values ​​monotonically decrease and then monotonically increase. For example, the reference weight value list is [8 8...8 8 7 6 5 4 3 2 1 0 0...0 0 1 2 3 4 5 6 7 8 8...8 8], that is, a plurality of reference weight values ​​in the reference weight value list monotonically decrease and then monotonically increase. As another example, the reference weight value list may be [0 0...0 0 1 2 3 4 5 6 7 8 8...8 8 7 6 5 4 3 2 1 0 0...0 0], that is, a plurality of reference weight values ​​in the reference weight value list monotonically increase and then monotonically decrease. Of course, the above is merely an example and is not limited to the reference weight value list.

[0175] For example, the reference weight values ​​in the reference weight value list may be preset or may be set based on weight setting parameters. The weight setting parameters may include a weight conversion rate and a start position of the weight conversion. The weight conversion rate may be a value set by experience, and the start position of the weight conversion may also be a value set by experience.

[0176] For example, if the maximum value of the reference weight value is M1 and the minimum value of the reference weight value is M2, the multiple reference weight values ​​in the reference weight value list may monotonically decrease from the maximum value M1 to the minimum value M2, and then monotonically increase from the minimum value M2 to the maximum value M1. Or, they may monotonically increase from the minimum value M2 to the maximum value M1, and then monotonically decrease from the maximum value M1 to the minimum value M2. If M1 is 8 and M2 is 0, the multiple reference weight values ​​may monotonically decrease from 8 to 0, and then monotonically increase from 0 to 8, or the multiple reference weight values ​​may monotonically increase from 0 to 8, and then monotonically decrease from 8 to 0.

[0177] For example, in the process of pre-setting the reference weight values ​​in the reference weight value list, the multiple reference weight values ​​in the reference weight value list may be set arbitrarily, and the multiple reference weight values ​​only need to monotonically increase and then monotonically decrease, or the multiple reference weight values ​​only need to monotonically decrease and then monotonically increase, and there is no limitation on the multiple reference weight values.

[0178] For example, the process of setting the reference weight values ​​in the reference weight value list based on the weight setting parameters may first obtain a first weight conversion rate, a second weight conversion rate, a start position of the first weight conversion, and a start position of the second weight conversion, and then determine a plurality of reference weight values ​​in the reference weight value list based on the first weight conversion rate, the second weight conversion rate, the start position of the first weight conversion, and the start position of the second weight conversion. The first weight conversion rate, the second weight conversion rate, the start position of the first weight conversion, and the start position of the second weight conversion may all be preset values, and there is no limitation on the first weight conversion rate, the second weight conversion rate, the start position of the first weight conversion, and the start position of the second weight conversion.

[0179] For example, the following method may be adopted to determine the reference weight value in the reference weight value list: When x is in [0, k], y(x)=Clip3(minimum, maximum, a1*(x-s1)). When x is in [k+1, t], y(x)=Clip3(minimum, maximum, a2*(x-s2)). x represents the position index in the reference weight value list, for example, x being 1 represents the first position in the reference weight value list, and y(x) represents the x-th reference weight value in the reference weight value list. k is a value set by experience, and is not limited thereto, for example, it may be half the total number of reference weight values ​​in the reference weight value list, or other values, as long as k is smaller than t, and t is the total number of reference weight values ​​in the reference weight value list. a1 represents the first weight conversion rate, and a2 represents the second weight conversion rate. s1 represents the start position of the first weight conversion, and s2 represents the start position of the second weight conversion.

[0180] Clip3 is used to limit the reference weight value to be between a minimum value and a maximum value, and both the minimum value and the maximum value may be set empirically. For the sake of convenience, the following description will take the minimum value as 0 and the maximum value as 8 as an example.

[0181] a1 and a2 both represent weight conversion rates, and may be set according to experience, for example, a1 may be an integer other than 0, for example, a1 may be -4, -3, -2, -1, 1, 2, 3, 4, etc., and a2 may be an integer other than 0, for example, a2 may be -4, -3, -2, -1, 1, 2, 3, 4, etc. For example, when a1 is a positive integer, a2 may be a negative integer, and when a1 is a negative integer, a2 may be a positive integer. For example, a1 may be -a2, that is, the change rates of the two are consistent, and in terms of the setting of the reference weight value, that is, the gradient width of the reference weight value is consistent. For convenience of explanation, take a1 as 1 and a2 as -1 as an example, the reference weight value needs to pass 0, 1, 2, 3, 4, 5, 6, 7, 8 from 0 to 8, and then pass 8, 7, 6, 5, 4, 3, 2, 1, 0 from 8 to 0. Or, the reference weight value needs to pass 8, 7, 6, 5, 4, 3, 2, 1, 0 from 8 to 0, and then pass 0, 1, 2, 3, 4, 5, 6, 7, 8 from 0 to 8. Take a1 as an example, a2 as -2 as an example, the reference weight value needs to pass 0, 2, 4, 6, 8 from 0 to 8, and then pass 8, 6, 4, 2, 0 from 8 to 0. Or, the reference weight value needs to pass 8, 6, 4, 2, 0 from 8 to 0, and then pass 0, 2, 4, 6, 8 from 0 to 8.

[0182] Both s1 and s2 represent the starting position of the weight conversion, and may be set according to experience. For example, s1 is the starting position of the weight conversion of the reference weight value in the interval [0, k], and s1 may be half of k, or s1 may be slightly smaller than half of k, for example, half of k minus 4, or s1 may be slightly larger than half of k, for example, half of k plus 4. Of course, the above are only some examples, and the value of s1 is not limited. s2 is the starting position of the weight conversion of the reference weight value in the interval [k+1, t], and s2 may be half of q (i.e., the difference between t and k+1), or s2 may be slightly smaller than half of q, for example, half of q minus 4, or s2 may be slightly larger than half of q, for example, half of q plus 4. Of course, the above are only some examples, and the value of s2 is not limited.

[0183] As seen above, a reference weight value list of the current block can be obtained, and the reference weight value list may include multiple reference weight values, and the multiple reference weight values ​​in the reference weight value list may monotonically increase and then monotonically decrease, or the multiple reference weight values ​​may monotonically decrease and then monotonically increase. In one possible embodiment, for the reference weight value list, the reference weight value list may further include a reference weight value of the first target area, a reference weight value of the second target area, a reference weight value of a first adjacent area adjacent to only the first target area, a reference weight value of a second adjacent area adjacent to both the first target area and the second target area, and a reference weight value of a third adjacent area adjacent to only the second target area.

[0184] The first target region includes one or more reference weight values ​​determined based on the start position of the first weighting transformation. For example, a reference weight value is determined based on the start position of the first weighting transformation, and the reference weight value is set as the first target region. Or, multiple reference weight values ​​are determined based on the start position of the first weighting transformation, and the multiple reference weight values ​​are set as the first target region. If the first target region includes multiple reference weight values, the multiple reference weight values ​​of the first target region monotonically increase or monotonically decrease. The monotonically increase may be a monotonically increase in the multiple reference weight values ​​of the first target region, and the monotonically decrease may be a monotonically decrease in the multiple reference weight values ​​of the first target region.

[0185] The second target region includes one or more reference weight values ​​determined based on the start position of the second weight transformation. For example, one reference weight value is determined based on the start position of the second weight transformation, and the reference weight value is set as the second target region. Or, multiple reference weight values ​​are determined based on the start position of the second weight transformation, and the multiple reference weight values ​​are set as the second target region. If the second target region includes multiple reference weight values, the multiple reference weight values ​​of the second target region monotonically increase or decrease. The monotonically increase may be a strict monotonically increase (the multiple reference weight values ​​of the second target region strictly monotonically increase), and the monotonically decrease may be a strict monotonically decrease (the multiple reference weight values ​​of the second target region strictly monotonically decrease).

[0186] If the multiple reference weight values ​​of the first target area increase monotonically (e.g., strictly increase monotonically), the multiple reference weight values ​​of the second target area decrease monotonically (e.g., strictly decrease monotonically). Alternatively, if the multiple reference weight values ​​of the first target area decrease monotonically (e.g., strictly decrease monotonically), the multiple reference weight values ​​of the second target area increase monotonically (e.g., strictly increase monotonically).

[0187] Exemplarily, the reference weight values ​​of the first adjacent region are all the first reference weight value, the reference weight values ​​of the second adjacent region are all the second reference weight value, and the reference weight values ​​of the third adjacent region are all the third reference weight value. The first reference weight value and the third reference weight value may be the same, the first reference weight value and the second reference weight value may be different, or the third reference weight value and the second reference weight value may be different. For example, the reference weight values ​​of the first adjacent region are all 0, the reference weight values ​​of the second adjacent region are all 8, and the reference weight values ​​of the third adjacent region are all 0, or the reference weight values ​​of the first adjacent region are all 8, the reference weight values ​​of the second adjacent region are all 0, and the reference weight values ​​of the third adjacent region are all 8.

[0188] Or, the reference weight values ​​of the first adjacent region are all the first reference weight value, the reference weight values ​​of the second adjacent region are monotonically decreasing, and the reference weight values ​​of the third adjacent region are monotonically increasing. For example, the reference weight values ​​of the first adjacent region are all 8, the first target region has a reference weight value of 7, the reference weight values ​​of the second adjacent region are monotonically decreasing from 6 to 0, the second target region has a reference weight value of 1, and the reference weight values ​​of the third adjacent region are monotonically increasing from 2 to 8.

[0189] Or, the reference weight value of the first adjacent region monotonically decreases, the reference weight value of the second adjacent region monotonically decreases and then monotonically increases, and the reference weight value of the third adjacent region monotonically increases. For example, the reference weight value of the first adjacent region monotonically decreases from 8 to 5, the first target region has a reference weight value of 4, the reference weight value of the second adjacent region monotonically decreases from 3 to 0 and then monotonically increases from 0 to 3, the second target region has a reference weight value of 4, and the reference weight value of the third adjacent region monotonically increases from 5 to 8.

[0190] Or, the reference weight value of the first adjacent region monotonically decreases, the reference weight value of the second adjacent region monotonically increases, and the reference weight values ​​of the third adjacent region are all the third reference weight value. For example, the reference weight value of the first adjacent region monotonically decreases from 8 to 1, the first target region has a reference weight value of 0, the reference weight value of the second adjacent region monotonically increases from 0 to 7, the second target region has a reference weight value of 8, and the reference weight values ​​of the third adjacent region are all 8.

[0191] Or, the reference weight values ​​of the first adjacent region are all the first reference weight value, the reference weight values ​​of the second adjacent region monotonically increase, and the reference weight values ​​of the third adjacent region monotonically decrease. For example, the reference weight values ​​of the first adjacent region are all 0, the first target region has a reference weight value of 1, the reference weight values ​​of the second adjacent region monotonically increase from 2 to 8, the second target region has a reference weight value of 7, and the reference weight values ​​of the third adjacent region monotonically decrease from 6 to 0.

[0192] Or, the reference weight value of the first adjacent region increases monotonically, the reference weight value of the second adjacent region increases monotonically and then decreases monotonically, and the reference weight value of the third adjacent region decreases monotonically. For example, the reference weight value of the first adjacent region increases monotonically from 0 to 3, the first target region has a reference weight value of 4, the reference weight value of the second adjacent region increases monotonically from 5 to 8 and then decreases monotonically from 8 to 5, the second target region has a reference weight value of 4, and the reference weight value of the third adjacent region decreases monotonically from 3 to 0.

[0193] Or, the reference weight value of the first adjacent region increases monotonically, the reference weight value of the second adjacent region decreases monotonically, and the reference weight values ​​of the third adjacent region are all the third reference weight value. For example, the reference weight value of the first adjacent region increases monotonically from 0 to 7, the first target region has a reference weight value of 8, the reference weight value of the second adjacent region decreases monotonically from 8 to 1, the second target region has a reference weight value of 0, and the reference weight values ​​of the third adjacent region are all 0.

[0194] Of course, the above are only some examples and are not limiting in this regard, and it is only necessary that the multiple reference weight values ​​in the reference weight value list meet the requirement of increasing from 0 to 8 and then decreasing from 8 to 0, or decreasing from 8 to 0 and then increasing from 0 to 8.

[0195] Case 3: The reference weight value list may include a plurality of first reference weight values ​​and then a plurality of second reference weight values, or may include a plurality of second reference weight values ​​and then a plurality of first reference weight values. For example, the reference weight value list may be [8 8...8 8 0 0...0 0], or as another example, the reference weight value list may be [0 0...0 0 8 8...8 8].

[0196] Exemplarily, the reference weight values ​​in the reference weight value list may be preset or may be set based on weight setting parameters, which may include a starting position of the weight transformation, and the starting position of the weight transformation may be a value set by experience.

[0197] Regarding the process of presetting the reference weight values ​​in the reference weight value list, the multiple reference weight values ​​in the reference weight value list may be set arbitrarily, and the multiple reference weight values ​​only need to include a first reference weight value and a second reference weight value.

[0198] For the process of setting the reference weight value in the reference weight value list based on the weight setting parameter, first obtain the start position of the weight transformation, and then determine multiple reference weight values ​​in the reference weight value list based on the start position of the weight transformation. For example, when the start position of the weight transformation represents the s-th reference weight value in the reference weight value list, all reference weight values ​​up to (not including) the s-th reference weight value are the first reference weight value (e.g., 8), and all reference weight values ​​after (including) the s-th reference weight value are the second reference weight value (e.g., 0). Or, all reference weight values ​​up to (not including) the s-th reference weight value are the second reference weight value (e.g., 0), and all reference weight values ​​after (including) the s-th reference weight value are the first reference weight value (e.g., 8).

[0199] In any of the above cases, the reference weight value list of the current block can be obtained. For convenience of explanation, in the subsequent embodiments, the reference weight value list of case 1 is taken as an example, and the realization process of the reference weight value list in other cases is similar.

[0200] In step S2, a valid number is determined based on the size of the current block and the weighted prediction angle of the current block.

[0201] Exemplarily, the valid number indicates that there are surrounding positions of the valid number outside the current block, for example, pixel positions inside the current block only point to the surrounding positions of the valid number, that is, by simply setting reference weight values ​​to the surrounding positions of the valid number, the target weight value of each pixel position inside the current block can be obtained.

[0202] For example, the number of peripheral positions outside the current block is determined based on the size of the current block and / or the weighted prediction angle of the current block, and in this embodiment, the number of peripheral positions outside the current block is referred to as a valid number ValidLength.

[0203] For example, the valid number may be determined by the formula: ValidLength=(N+(M>>X))<<1, or ValidLength=(M+(N>>X))<<1. In the above formula, ValidLength is the valid number, M is the width of the current block, N is the height of the current block, and X is the log2 logarithm of the absolute value of the gradient of the weighted prediction angle of the current block, e.g., 0 or 1, and << represents a left shift and >> represents a right shift.

[0204] In the present application, a << b can be understood as shifting a left by b bits in the form of two's complement integer representation, 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 as shifting a right by b bits in the form of two's complement integer representation, 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.

[0205] In step S3, a target index is determined based on the size of the current block, the weight prediction angle of the current block, and the weight prediction position of the current block.

[0206] Exemplarily, the target index may indicate which reference weight value in the reference weight value list it is. For example, when the target index is 259, it can represent the 259th reference weight value in the reference weight value list.

[0207] For example, the target index may be determined by the formula: FirstIndex=(HalfLength-4)-((ValidLength>>1)-a+Y*((ValidLength-1)>>3)), or FirstIndex=(HalfLength-4)-((ValidLength>>1)-b+Y*((ValidLength-1)>>3)-((M<<1)>>X)), or FirstIndex=(HalfLength-4)-((ValidLength>>1)-c+Y*((ValidLength-1)>>3)-((N<<1)>>X)), or FirstIndex=(HalfLength-4)-((ValidLength>>1)-d+Y*((ValidLength-1)>>3)). In the above formula, FirstIndex is a target index, ValidLength is a valid number, which is determined based on the size of the current block and the weight prediction angle of the current block, Y is the weight prediction position of the current block, the value of HalfLength-4 is the start position of the weight conversion, M is the width of the current block, N is the height of the current block, X is the log2 logarithm of the absolute value of the gradient of the weight prediction angle of the current block, and a, b, c, and d are preset constants.

[0208] In the above process, ValidLength is related to the weighted prediction angle of the current block and the size of the current block, and in order to simplify the solution, some parameters can be fixed to achieve the optimization purpose, for example, the weighted prediction angle of the current block can be set as a fixed parameter value, and ValidLength is only related to the size of the current block. In other embodiments, the method of determining ValidLength is also similar.

[0209] In the above process, FirstIndex is related to the weighted prediction angle of the current block, the size of the current block, and the weighted prediction position of the current block, and in order to simplify the solution, some parameters may be fixed to achieve the purpose of optimization, for example, the weighted prediction angle of the current block may be set as a fixed parameter value, and FirstIndex is related only to the size of the current block and the weighted prediction position of the current block. Or, the weighted prediction position of the current block may be set as a fixed parameter value, and FirstIndex is related only to the size of the current block and the weighted prediction angle of the current block. Or, the weighted prediction angle of the current block and the weighted prediction position of the current block may both be set as fixed parameter values, and the two fixed parameter values ​​may be the same or different between different current blocks, and FirstIndex is related only to the size of the current block. In other embodiments, the method of determining FirstIndex (or FirstPos) is similar, and will not be described in this specification.

[0210] In step S4, an effective number of reference weight values ​​are selected from the reference weight value list based on the target index.

[0211] For example, assume that the target index is q1 and the valid number is r, if the target index is the first reference weight value to be selected in the reference weight value list, select the q1th to q2th reference weight values ​​from the reference weight value list, and select r reference weight values ​​from the reference weight value list because the index difference between q2 and q1 is r-1. Or, if the target index is the last reference weight value to be selected in the reference weight value list, select the q3th to q1th reference weight values ​​from the reference weight value list, and select r reference weight values ​​from the reference weight value list because the index difference between q1 and q3 is r-1.

[0212] Of course, the above method is merely an example, and the target index may be the reference weight value at the intermediate position to be selected in the reference weight value list, and the implementation is similar, so the description is omitted here. In the following, the target index is taken as an example to be the first reference weight value to be selected in the reference weight value list, that is, the q1th to q2th reference weight values ​​are selected.

[0213] In step S5, the reference weight values ​​of the peripheral positions outside the current block are set based on the reference weight values ​​of the effective numbers.

[0214] For example, the number of surrounding positions outside the current block is a valid number, and a valid number of reference weight values ​​is selected from the reference weight value list, so that the number of surrounding positions is the same as the number of selected reference weight values, and the valid number of reference weight values ​​in the reference weight value list may be set as the reference weight values ​​of the surrounding positions outside the current block.

[0215] For example, for the first reference weight value of the valid number of reference weight values, that reference weight value is set as the reference weight value of the first peripheral position outside the current block, for the second reference weight value of the valid number of reference weight values, that reference weight value is set as the reference weight value of the second peripheral position outside the current block, and so on.

[0216] In one possible embodiment, when r reference weight values ​​are selected from the reference weight value list, the r reference weight values ​​are extracted from the reference weight value list, and the r reference weight values ​​are set as the reference weight values ​​of the r neighboring positions outside the current block. Alternatively, when r reference weight values ​​are selected from the reference weight value list, it is not necessary to extract the r reference weight values ​​from the reference weight value list, but the r reference weight values ​​are set as the reference weight values ​​of the r neighboring positions outside the current block by shifting the reference weight values ​​in the reference weight value list.

[0217] Example 7: In the above examples 1 to 3, for each pixel position, a target weight value for the pixel position may be determined based on a reference weight value associated with a surrounding matching position indicated by the pixel position. The following description will be given taking the surrounding matching positions of the current block as an example. The following method may be adopted to obtain the reference weight value associated with the surrounding matching positions. A reference weight value is directly set for each surrounding position outside the current block, for example, a valid number of reference weight values ​​is obtained (not selected from a reference weight value list), and the reference weight value of the surrounding position outside the current block is set based on the valid number of reference weight values.

[0218] For example, the reference weight value set to the peripheral position outside the current block may be preset or set based on weight setting parameters, and the weight configuration parameters may include a weight conversion rate and a start position of the weight conversion. The start position of the weight conversion of each current block is determined by at least one parameter of the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block. When the current block includes one sub-block, the number of peripheral positions outside the current block (i.e., the effective number) is determined based on the size of the current block and the weight prediction angle of the current block.

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

[0220] The following describes the specific process of setting the reference weight values ​​of the peripheral positions.

[0221] First, obtain the reference weight value of the valid number. Then, set the reference weight value of the peripheral position outside the current block according to the reference weight value of the valid number, and the reference weight value of the peripheral position outside the current block may be monotonically increasing or monotonically decreasing.

[0222] In addition, the reference weight value of the effective number is obtained in the previous embodiment, but the effective number in the previous embodiment may be the same as or different from the effective number in this embodiment. For the purpose of distinction, the effective number in the previous embodiment may be considered as the first effective number, and the effective number in this embodiment may be considered as the second effective number.

[0223] For example, the number of peripheral positions outside the current block is a valid number, and the reference weight value of the valid number needs to be obtained. For example, the following formula is adopted to determine the valid number: ValidLength=(N+(M>>X))<<1, where N and M are the height and width of the current block respectively, and X is the log2 logarithm of the absolute value of the gradient of the weight prediction angle of the current block, e.g., 0 or 1.

[0224] In one possible embodiment, the reference weight value of the effective number may be monotonically increasing or monotonically decreasing. Or, the reference weight value of the effective number may be monotonically increasing and then monotonically decreasing, or monotonically decreasing and then monotonically increasing. Or, the reference weight value of the effective number may first include a number of first reference weight values ​​and then include a number of second reference weight values, or first include a number of second reference weight values ​​and then include a number of first reference weight values. This will be described below with reference to some specific situations.

[0225] Case 1: The reference weight value of the effective number may be monotonically increasing or monotonically decreasing.

[0226] For example, the reference weight value may be preset or may be set based on weight setting parameters. The weight setting parameters may include a weight conversion rate and a start position of the weight conversion, and the weight conversion rate may be a value set by experience. The start position of the weight conversion may be a value set by experience, or the start position of the weight conversion may be determined by a weight prediction position, or the start position of the weight conversion may be determined by a weight prediction angle and a weight prediction position.

[0227] For example, for the process of presetting a plurality of reference weight values, the plurality of reference weight values ​​may be set arbitrarily, and the plurality of reference weight values ​​only need to monotonically increase or decrease. Or, for the process of setting a plurality of reference weight values ​​based on weight setting parameters, the weight conversion rate and the start position of weight conversion may be obtained first, and then the plurality of reference weight values ​​may be determined based on the weight conversion rate and the start position of weight conversion. The start position of weight conversion is determined by the weight prediction position of the current block, or the start position of weight conversion is determined by the weight prediction angle and the weight prediction position of the current block.

[0228] For example, the reference weight value may be determined by the following method: y(x)=Clip3(min, max, a*(xs)), where x represents the index of the peripheral position, i.e., the value of x ranges from 1 to a valid value, for example, x is 1 represents the first peripheral position, and y(x) represents the reference weight value of the xth peripheral position, a represents the weight conversion rate, and s represents the start position of the weight conversion.

[0229] The Clip3 function is used to limit the reference weight value to be between a minimum value and a maximum value, and both the minimum value and the maximum value can be set empirically. For convenience of explanation, in the subsequent process, the minimum value is 0 and the maximum value is 8 as an example.

[0230] a represents a weight conversion rate, which may be set empirically, for example, a may be an integer other than 0, for example, a may be -4, -3, -2, -1, 1, 2, 3, 4, etc., and for convenience of explanation, a is 1 as an example. If a is 1, the reference weight value needs to go through 0, 1, 2, 3, 4, 5, 6, 7, 8 from 0 to 8, or the reference weight value needs to go through 8, 7, 6, 5, 4, 3, 2, 1, 0 from 8 to 0. Exemplarily, when a is a positive integer, a may have a positive correlation with the number of peripheral positions, i.e., the more peripheral positions outside the current block, the larger the value of a. When a is a negative integer, a may have a negative correlation with the number of peripheral positions, i.e., the more peripheral positions outside the current block, the smaller the value of a. Of course, the above is only an example of the value of a, and is not limited thereto.

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

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

[0233] As seen above, a valid number of reference weight values ​​of the current block can be obtained, and these reference weight values ​​may be monotonically increasing or monotonically decreasing. In one possible embodiment, the reference weight values ​​of the outer peripheral positions of the current block include a reference weight value of the target region, a reference weight value of a first adjacent region of the target region, and a reference weight value of a second adjacent region of the target region.

[0234] Regarding the target region, the reference weight value of the target region, the reference weight value of the first adjacent region, the reference weight value of the second adjacent region, etc., the description of the previous embodiment, Case 1, can be referred to, and the description will be omitted here.

[0235] Case 2: The reference weight value of the effective number may monotonically increase and then monotonically decrease, or may monotonically decrease and then monotonically increase.

[0236] For example, the reference weight value of the effective number may be preset or may be set based on weight setting parameters. The weight setting parameters may include a weight conversion rate and a start position of the weight conversion, and the weight conversion rate may be a value set by experience. The start position of the weight conversion may be a value set by experience, or the start position of the weight conversion may be determined by a weight prediction position, or the start position of the weight conversion may be determined by a weight prediction angle and a weight prediction position.

[0237] For example, for the process of presetting the multiple reference weight values, the multiple reference weight values ​​may be set arbitrarily, and the multiple reference weight values ​​only need to monotonically increase and then monotonically decrease, or the multiple reference weight values ​​only need to monotonically decrease and then monotonically increase. For the process of setting the multiple reference weight values ​​based on the weight setting parameters, a first weight conversion rate, a second weight conversion rate, a start position of the first weight conversion, and a start position of the second weight conversion may be obtained, and the multiple reference weight values ​​may be determined based on the first weight conversion rate, the second weight conversion rate, the start position of the first weight conversion, and the start position of the second weight conversion.

[0238] For example, the following method may be adopted to determine a number of reference weight values: When x is in [0, k], y(x)=Clip3(min, max, a1*(x-s1)); When x is in [k+1, t], y(x)=Clip3(min, max, a2*(x-s2)); x represents the position index of the peripheral position, for example, x is 1 represents the first peripheral position, and y(x) represents the reference weight value of the x-th peripheral position; k is a value set by experience, and is not limited thereto, for example, it may be half of the effective number or other values, as long as k is smaller than t, and t is the total number of peripheral positions, i.e., the effective number. a1 represents the first weight conversion ratio, and a2 represents the second weight conversion ratio. s1 represents the start position of the first weight conversion, and s2 represents the start position of the second weight conversion.

[0239] Clip3 is used to limit the reference weight value to be between a minimum value and a maximum value, and both the minimum value and the maximum value may be set empirically. For convenience of explanation, in the subsequent process, the minimum value is 0 and the maximum value is 8 as an example.

[0240] a1 and a2 both represent weight conversion rates and may be set empirically. For example, a1 may be an integer other than 0, such as -4, -3, -2, -1, 1, 2, 3, 4, etc., and a2 may be an integer other than 0, such as -4, -3, -2, -1, 1, 2, 3, 4, etc.

[0241] Both s1 and s2 represent the starting positions of the weight transformation, which may be set empirically, where s1 is the starting position of the weight transformation of the reference weight value in the interval [0, k], and s2 is the starting position of the weight transformation of the reference weight value in the interval [k+1, t].

[0242] s1 may be determined by the weighted prediction position, for example, s1=f(weighted prediction position), that is, s1 is a function related to the weighted prediction position. For example, after determining the range of the peripheral positions outside the current block, a range [0, k] is determined from all the peripheral positions, and all the peripheral positions in the range [0, k] are equally divided into N, and the value of N can be set arbitrarily, and the weighted prediction position is used to indicate which peripheral position in the range [0, k] is to be the target peripheral region of the current block, and the peripheral position corresponding to the weighted prediction position is the starting position s1 of the weighted transformation. Or, s1 may be determined by the weighted prediction angle and the weighted prediction position, for example, s1=f(weighted prediction angle, weighted prediction position), that is, s1 is a function related to the weighted prediction angle and the weighted prediction position. For example, a range of peripheral positions outside the current block may be determined based on the weighted prediction angle, a range [0, k] is determined from all peripheral positions, all peripheral positions in the range [0, k] are divided into N equal parts, and the weighted prediction position is used to indicate which peripheral positions in the range [0, k] are to be the target peripheral region of the current block, thereby obtaining the starting position s1 of the weighted transformation.

[0243] s2 may be determined by a weighted prediction position, or may be determined by a weighted prediction angle and a weighted prediction position, and the process of determining s2 refers to the process of determining s1, only the range changes, that is, the range is [k+1,t], and the description is omitted here.

[0244] Of course, the above is merely an example of determining the starting positions s1 and s2 of the weight transformation, and is not limiting in this respect.

[0245] As seen above, multiple reference weight values ​​can be obtained, and the multiple reference weight values ​​may monotonically increase and then monotonically decrease, or the multiple reference weight values ​​may monotonically decrease and then monotonically increase. In one possible embodiment, the reference weight values ​​of the multiple peripheral positions outside the current block may further include a reference weight value of a first target region, a reference weight value of a second target region, a reference weight value of a first adjacent region adjacent to only the first target region, a reference weight value of a second adjacent region adjacent to both the first target region and the second target region, and a reference weight value of a third adjacent region adjacent to only the second target region.

[0246] Regarding the first target area, the second target area, the reference weight value of the first target area, the reference weight value of the second target area, the reference weight value of the first adjacent area, the reference weight value of the second adjacent area, and the reference weight value of the third adjacent area, etc., please refer to the explanation in the previous embodiment, Case 2, and the explanation will be omitted here.

[0247] Case 3: The effective number of reference weight values ​​may include a plurality of first reference weight values ​​first and then a plurality of second reference weight values, or may include a plurality of second reference weight values ​​first and then a plurality of first reference weight values. The effective number of reference weight values ​​may be set in advance or may be set based on a weight setting parameter, and the weight setting parameter may include a start position of the weight transformation. The process of setting the reference weight values ​​based on the weight setting parameter may include obtaining a start position of the weight transformation and determining a plurality of reference weight values ​​based on the start position of the weight transformation.

[0248] In the above several cases, a valid number of reference weight values ​​can be obtained. For convenience of explanation, in the subsequent embodiments, the reference weight value of case 1 is described as an example, and the realization process of the reference weight value in other cases is similar.

[0249] After obtaining the reference weight value of the effective number, the reference weight value of the peripheral position outside the current block is set based on the reference weight value of the effective number, and the reference weight value of the peripheral position outside the current block may be monotonically increasing or monotonically decreasing.

[0250] For example, the number of surrounding positions outside the current block is a valid number, and the number of reference weight values ​​is a valid number, and therefore the valid number of reference weight values ​​may be set as the reference weight values ​​of the surrounding positions outside the current block.

[0251] For example, the first reference weight value is set as the reference weight value of the first surrounding location outside the current block, the second reference weight value is set as the reference weight value of the second surrounding location outside the current block, and so on.

[0252] Example 8: In Examples 1 to 7, the current block may include one sub-block, that is, the sub-block is the current block itself, and for the current block, M and N are denoted as the width and height of the current block (i.e., the current prediction unit). In this case, for example, as shown in FIG. 6B, the derivation method of the weight array of the angle weighted prediction (AWP) mode may include steps a1 to a4.

[0253] In step a1, parameters such as stepIdx, angleIdx, and subAngleIdx are obtained based on AwpIdx.

[0254] AwpIdx represents the index value of the weighted prediction position and the weighted prediction angle, and if there are seven weighted prediction positions and eight weighted prediction angles, the value range of AwpIdx is 0 to 55. If the weighted prediction position is from -3 to 3 (representing that the fourth weighted prediction position is the center and the fourth weighted prediction position is 0) and the index of the weighted prediction angle is from 0 to 7, the weighted prediction positions and weighted prediction angles corresponding to the 56 index values ​​of AwpIdx may be as shown in Table 2. [Table 2]

[0255] stepIdx represents a weighted prediction position, and the range of the weighted prediction position is from −3 to 3. For example, for the first weighted prediction position, the weighted prediction position is −3, for the second weighted prediction position, the weighted prediction position is −2, and thus for the seventh weighted prediction position, the weighted prediction position is 3.

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

[0257] Exemplarily, the formula: stepIdx=(AwpIdx>>3)-3 may be adopted to determine stepIdx.

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

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

[0260] As can be seen above, after the encoding side determines the weighted prediction angle of the current block and the weighted prediction position of the current block, it may determine the value of AwpIdx according to the weighted prediction angle and the weighted prediction position, see Table 2. When the encoding side sends an encoded bitstream to the decoding side, it may add the value of AwpIdx to the encoded bitstream, so that the decoding side can obtain the value of AwpIdx, and obtain stepIdx, angleIdx and subAngleIdx according to AwpIdx.

[0261] For example, angleIdx and subAngleIdx can uniquely determine one weighted prediction angle, see Table 3. Of course, other methods may be used to determine the weighted prediction angle, such as changing the area number. [Table 3]

[0262] In step a2, a reference weight list ReferenceWeight[x] is constructed based on stepIdx, angleIdx and subAngleIdx. Constructing the reference weight list ReferenceWeight[x] is also to set the reference weight value at the peripheral position outside the current block. There are several cases to calculate ReferenceWeight[x] based on subAngleIdx:

[0263] Case 1: If subAngleIdx is 0, that is, the weighted prediction angle is located in angle area 0, for example, if the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the formula: FirstPos=(ValidLength_H>>1)-6+DeltaPos_H may be used to determine the start position FirstPos of the weight conversion. Then, the formula ReferenceWeights[x]=Clip3(0,8,x-FirstPos) may be used to determine the reference weight value of the peripheral position outside the current block, and the formula is described by taking the minimum value of the reference weight value as 0, the maximum value of the reference weight value as 8, and the weight conversion rate as 1 as an example, that is, the above formula is equivalent to ReferenceWeights[x]=Clip3(minimum value, maximum value, a*(x-FirstPos)). x may be the index of the peripheral position outside the current block, the value range of x is 0 to ValidLength_H-1, and a represents the weight conversion rate.

[0264] In the above formula, ValidLength_H represents the number of peripheral positions outside the current block (i.e., the valid number, which may also be called the valid length), and when subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be the peripheral position of one column to the left, and therefore the valid number is denoted as ValidLength_H. Exemplarily, the valid number ValidLength_H may be determined by employing the formula: ValidLength_H=(N+(M>>angleIdx))<<1. The reason for shifting one digit to the left here is because the formula uses 1 / 2-pel precision. If 1-pel precision is used, then ValidLength_H=(N+(M>>angleIdx)), if 1 / 4-pel precision is used, then ValidLength_H=(N+(M>>angleIdx))<<2, if 2-pel precision is used, then ValidLength_H=(N+(M>>angleIdx))>>1, and other pixel precisions are similar and will not be explained here. In the formulas that follow, any part of >>1 may change due to different pixel precisions.

[0265] In the above formula, DeltaPos_H represents a position change parameter (i.e., one intermediate parameter), and when subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be the peripheral position of the left column, and therefore the position change parameter is denoted as DeltaPos_H. Exemplarily, DeltaPos_H may be determined by adopting the formula: DeltaPos_H=stepIdx*((ValidLength_H>>3)-1).

[0266] Case 2: If subAngleIdx is 1, that is, the weighted prediction angle is located in angle area 1, for example, if the weighted prediction angle is weighted prediction angle 2 or weighted prediction angle 3, the formula: FirstPos=(ValidLength_H>>1)-4+DeltaPos_H-((M<<1)>>angleIdx) may be used to determine the start position FirstPos of the weight conversion. Then, the formula: ReferenceWeights[x]=Clip3(0,8,x-FirstPos) may be used to determine the reference weight value of the peripheral position outside the current block, and the formula is described by taking the minimum value of the reference weight value as 0, the maximum value of the reference weight value as 8, and the weight conversion rate as 1 as an example. x may be the index of the peripheral position outside the current block, and the value of x ranges from 0 to ValidLength_H-1.

[0267] In the above formula, ValidLength_H and DeltaPos_H can refer to Case 1, and the description is omitted here.

[0268] Case 3: If subAngleIdx is 2, that is, the weighted prediction angle is located in angle partition 2, for example, if the weighted prediction angle is weighted prediction angle 4 or weighted prediction angle 5, the formula: FirstPos=(ValidLength_W>>1)-4+DeltaPos_W-((N<<1)>>angleIdx) may be used to determine the start position FirstPos of the weight conversion. Then, the formula: ReferenceWeights[x]=Clip3(0,8,x-FirstPos) may be used to determine the reference weight value of the peripheral position outside the current block, and the formula is described by taking the minimum reference weight value as 0, the maximum reference weight value as 8, and the weight conversion rate as 1 as an example. x may be the index of the peripheral position outside the current block, and the value of x ranges from 0 to ValidLength_W-1.

[0269] In the above formula, ValidLength_W represents the number of peripheral positions outside the current block (i.e., valid number, also called valid length), and when subAngleIdx is 2, the peripheral positions outside the current block indicated by the weighted prediction angle may be peripheral positions in the top row, and therefore the valid number is denoted as ValidLength_W. Exemplarily, the valid number ValidLength_W can be determined by adopting the formula: ValidLength_W=(M+(N>>angleIdx))<<1.

[0270] In the above formula, DeltaPos_W represents a position change parameter (i.e., an intermediate parameter), and when subAngleIdx is 2, the outer peripheral position of the current block indicated by the weighted prediction angle may be the peripheral position of the top row, and therefore the position change parameter is denoted as DeltaPos_W. Exemplarily, DeltaPos_W may be determined by adopting the formula: DeltaPos_W=stepIdx*((ValidLength_W>>3)-1).

[0271] Case 4: If subAngleIdx is 3, that is, the weighted prediction angle is located in angle area 3, for example, if the weighted prediction angle is weighted prediction angle 6 or weighted prediction angle 7, the formula: FirstPos=(ValidLength_W>>1)-6+DeltaPos_W may be used to determine the start position FirstPos of the weight conversion. Then, the formula: ReferenceWeights[x]=Clip3(0,8,x-FirstPos) may be used to determine the reference weight value of the peripheral position outside the current block, and the formula is described by taking the minimum reference weight value as 0, the maximum reference weight value as 8, and the weight conversion rate as 1 as an example. x may be the index of the peripheral position outside the current block, and the value range of x is from 0 to ValidLength_W-1.

[0272] In the above formula, ValidLength_W and DeltaPos_W can refer to Case 3, and the description is omitted here.

[0273] As can be seen above, it can be determined which case to adopt for processing based on subAngleIdx, for example, in case 1 and case 2, ValidLength_H and DeltaPos_H can be determined based on angleIdx and stepIdx, FirstPos can be determined based on ValidLength_H and DeltaPos_H, and then the reference weight value can be set based on FirstPos, in case 3 and case 4, ValidLength_W and DeltaPos_W can be determined based on angleIdx and stepIdx, FirstPos can be determined based on ValidLength_W and DeltaPos_W, and then the reference weight value can be set based on FirstPos.

[0274] The difference between the formulas in each of the above cases is that the starting position of the reference weight list ReferenceWeights[x] has changed when the upper left corner of the current block is the coordinate origin. For example, FIG. 6C shows examples of angle area 2 and angle area 3. When the accuracy is 1 / 2-pel, the starting position of the reference weight list ReferenceWeights[x] is (height<<1)>>angleIdx, that is, the offset in the formula is "-((N<<1)>>angleIdx)". The implementation of angle area 0 and angle area 1 is similar, except that the offset in the formula is "-((M<<1)>>angleIdx)", that is, the height is changed to the width.

[0275] In step a3, the brightness weight value of the pixel position is obtained based on the angleIdx and the reference weight list ReferenceWeight[x]. There are several cases in which the brightness weight value of the pixel position is determined based on the subAngleIdx.

[0276] Case 1: If subAngleIdx is 0, the formula: AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)] may be used to determine the intensity weight value of pixel position (x, y), where (y<<1)+((x<<1)>>angleIdx) represents the neighboring position of pixel position (x, y), and ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)] represents the reference weight value of the neighboring position. The value of x ranges from 0 to M-1, and the value of y ranges from 0 to N-1.

[0277] Case 2: If subAngleIdx is 1, the brightness weight value of pixel position (x, y) may be determined by using the formula: AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)], where (y<<1)-((x<<1)>>angleIdx) represents the neighboring position of pixel position (x, y), and ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)] represents the reference weight value of the neighboring position. The value of x ranges from 0 to M-1, and the value of y ranges from 0 to N-1.

[0278] Case 3: If subAngleIdx is 2, the brightness weight value of pixel position (x, y) may be determined by using the formula: AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)], where (x<<1)-((y<<1)>>angleIdx) represents the neighboring position of pixel position (x, y), and ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)] represents the reference weight value of the neighboring position. The value of x ranges from 0 to M-1, and the value of y ranges from 0 to N-1.

[0279] Case 4: If subAngleIdx is 3, the formula: AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)] may be used to determine the intensity weight value of pixel position (x, y), where (x<<1)+((y<<1)>>angleIdx) represents the neighboring position of pixel position (x, y), and ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)] represents the reference weight value of the neighboring position. The value of x ranges from 0 to M-1, and the value of y ranges from 0 to N-1.

[0280] The steps a2 and a3 can be combined into one step, i.e., step a2 (constructing a reference weight list ReferenceWeight[x] based on stepIdx, angleIdx, and subAngleIdx, constructing the reference weight list ReferenceWeight[x], i.e., setting reference weight values ​​at peripheral positions outside the current block) and step a3 (obtaining the brightness weight value of the pixel position based on angleIdx and the reference weight list ReferenceWeight[x]) can be combined with obtaining the brightness weight value of the pixel position based on stepIdx, angleIdx, and subAngleIdx, i.e., determining the brightness weight value of the pixel position based on the coordinate values ​​of the peripheral matching positions of the current block and the coordinate values ​​of the weight transformation start position of the current block.

[0281] Take case 1 as an example, if subAngleIdx is 0, that is, the weighted prediction angle is located in angle area 0, for example, if the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the formula: FirstPos=(ValidLength_H>>1)-6+DeltaPos_H may be used to determine the start position FirstPos of the weight conversion. Then, the formula: AwpWeightArrayY[x][y]=Clip3(0,8,(y<<1)+((x<<1)>>angleIdx)-FirstPos) may be used to determine the luminance weight value of pixel position (x, y), where (y<<1)+((x<<1)>>angleIdx) represents the peripheral matching position indicated by pixel position (x, y). Other cases are similar.

[0282] In step a4, a chromaticity weight value of the pixel position is obtained based on the luminance weight value of the pixel position, and the luminance weight value of the pixel position and the chromaticity weight value of the pixel position can form a target weight value of the pixel position.

[0283] For example, if the format of the chromaticity resolution is 4:2:0, the formula: AwpWeightArrayUV[x][y]=AwpWeightArrayY[x<<1][y<<1] is used to determine the chromaticity weight value at pixel position (x,y). As another example, if the format of the chromaticity resolution is 4:4:4, the formula: AwpWeightArrayUV[x][y]=AwpWeightArrayY[x][y] is used to determine the chromaticity weight value at pixel position (x,y), where the value of x ranges from 0 to M / 2-1, and the value of y ranges from 0 to N / 2-1.

[0284] Another implementation of step a4 is as follows: obtain the chromaticity weight value of the pixel position according to angleIdx and the reference weight list ReferenceWeight[x], and do not need to obtain the chromaticity weight value according to the luma weight value. For example, if the format of the chromaticity resolution is 4:2:0, obtain the chromaticity weight value of the pixel position according to angleIdx and the reference weight list ReferenceWeight[x].

[0285] For example, if subAngleIdx is 0, the formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)+((x<<2)>>angleIdx)] may be employed to determine the chromaticity weight value at pixel location (x, y).

[0286] For example, if subAngleIdx is 1, then the formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)-((x<<2)>>angleIdx)] may be employed to determine the chromaticity weight value at pixel location (x,y).

[0287] For example, if subAngleIdx is 2, the formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)-((y<<2)>>angleIdx)] may be employed to determine the chromaticity weight value at pixel location (x, y).

[0288] For example, if subAngleIdx is 3, the formula: AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)+((y<<2)>>angleIdx)] may be employed to determine the chromaticity weight value at pixel location (x, y).

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

[0290] In step a3 and step a4, the difference in the formulas for each case is shown in FIG. 6D, and examples of angle area 2 and angle area 3 are shown. When the upper left corner of the current block is the coordinate origin, the calculation formula when the peripheral matching position of (x, y) is in angle area 2 may be xy>>angleIdx, and the calculation formula when the peripheral matching position of (x, y) is in angle area 3 may be x+y>>angleIdx. When the accuracy is 1 / 2-pel, the calculation formula when the peripheral matching position of (x, y) is in angle area 2 may be (x<<1)-((y<<1)>>angleIdx), and the calculation formula when the peripheral matching position of (x, y) is in angle area 3 may be (x<<1)+((y<<1)>>angleIdx). The realization of angle area 0 and angle area 1 is similar, and the positions of x and y can be swapped.

[0291] Example 9: In the above examples 1 to 3, it is necessary to determine the first predicted value of the pixel position based on the first prediction mode, and to determine the second predicted value of the pixel position based on the second prediction mode.

[0292] In this embodiment, a case will be described in which the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode.

[0293] The first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode, and a motion information candidate list is constructed, the motion information candidate list includes at least two motion information candidates. One motion information candidate is selected from the motion information candidate list as first target motion information of the current block, and another motion information candidate is selected from the motion information candidate list as second target motion information of the current block. For each pixel position of the current block, a first predicted value for the pixel position is determined based on the first target motion information, and a second predicted value for the pixel position is determined based on the second target motion information.

[0294] For example, a motion information candidate list can be constructed for both the encoding side and the decoding side, and the motion information candidate list on the encoding side and the motion information candidate list on the decoding side are the same, and there is no limitation to the motion information candidate list.

[0295] Exemplarily, the motion information candidates in the motion information candidate list are all single-hypothesis motion information, for example, the motion information candidates in the motion information candidate list are unidirectional motion information, not bidirectional motion information. Since the motion information candidates are all single-hypothesis motion information, the motion information candidate list may be a unidirectional motion information candidate list.

[0296] Exemplarily, when constructing a motion information candidate list, spatial motion information (e.g., spatial motion vectors) may be put first, and then temporal motion information (e.g., temporal motion vectors) may be put, and / or when constructing a motion information candidate list, unidirectional motion information (e.g., unidirectional motion vectors) may be put first, and then bidirectional motion information (e.g., bidirectional motion vectors) may be put, without limitation in this regard.

[0297] Exemplarily, when bidirectional motion information is added to the motion information candidate list, the bidirectional motion information is first divided into two unidirectional motion information, and the two divided unidirectional motion information are sequentially added to the motion information candidate list. Or, when bidirectional motion information is added to the motion information candidate list, the bidirectional motion information is first trimmed into one unidirectional motion information, and the one unidirectional motion information is added to the motion information candidate list. Exemplarily, trimming the bidirectional motion information to obtain one unidirectional motion information includes directly obtaining the unidirectional motion information in List0 (reference frame list 0), or directly obtaining the unidirectional motion information in List1 (reference frame list 1), or determining to obtain the unidirectional motion information in List0 or List1 based on the order of adding.

[0298] Of course, the above is merely an example of the motion information candidate list, and is not limited to the motion information in the motion information candidate list.

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

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

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

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

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

[0304] Regarding the process in which the encoding side / decoding side determines a first predicted value of a pixel position based on first target motion information and determines a second predicted value of a pixel position based on second target motion information, reference may be made to the inter-frame prediction process, and there is no limitation regarding this.

[0305] For example, when determining the first predicted value of the pixel position based on the first target motion information, an inter-frame weighted prediction mode may be adopted to obtain the first predicted value of the pixel position. For example, first, an initial predicted value of the pixel position is determined using the first target motion information, and then the initial predicted value is multiplied by a preset coefficient to obtain an adjusted predicted value. If the adjusted predicted value is greater than the maximum predicted value, the maximum predicted value is 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 the first predicted value of the current block; if the adjusted predicted value is greater than the minimum predicted value and less than the maximum predicted value, the adjusted predicted value is the first predicted value of the current block. Of course, the above manner is merely an example, and is not limiting in this respect.

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

[0307] In the above case, the indication information of the prediction information of the first prediction mode and the indication information of the prediction information of the second prediction mode can be exchanged, as long as the encoding side and the decoding side are consistent, this is the exchange of indication information, which does not affect the analysis process, that is, there is no dependency on analysis. In the case of the same prediction mode candidate list, the indication information of the prediction information of the first prediction mode and the indication information of the prediction information of the second prediction mode should not be equal, and two index values ​​are encoded, and the value of index value a is 1 and the value of index value b is 3. When encoding index value a first, index value b may be encoded as 2 (3-1), and when encoding index value b first, index value b must be encoded as 3. As can be seen above, encoding the indication information of the smaller index value first can reduce the encoding cost of the larger index value, and in the prediction mode candidate list construction method, the probability that the first prediction mode comes from the left side is high, and based on this experience, the encoding side and the decoding side may be adjusted to first encode the indication information of the prediction information of the adjacent area on the left side.

[0308] In the above case, the prediction mode candidate list may be a motion information candidate list, the prediction information of the first prediction mode may be the first target motion information, and the prediction information of the second prediction mode may be the second target motion information. In the encoded bit stream, the indication information of the first target motion information, for example, the index value a, is encoded first, and then the indication information of the second target motion information, for example, the index value b, is encoded. Alternatively, the indication information of the second target motion information, for example, the index value b, may be encoded first, and then the indication information of the first target motion information, for example, the index value a. For example, if the value of the index value a is 1 and the value of the index value b is 3, the index value a is encoded first, and then the index value b is encoded. As another example, if the value of the index value b is 1 and the value of the index value a is 3, the index value b is encoded first, and then the index value a is encoded.

[0309] Example 10: For Example 9, it is necessary to build a motion information candidate list, and the motion information candidate list may be a unidirectional motion information candidate list. Figure 7 shows a schematic diagram of a current block and an adjacent block, and the process of building a motion information candidate list is to put unidirectional motion information into the motion information candidate list in the order of F, G, C, A, B, D, in the order of List0 being given priority, and to perform a duplication check process in the process of putting. Of course, the order of F, G, C, A, B, D is only an example, and other orders may be adopted, and this is not limited.

[0310] If the motion information candidate list is not full, the remaining bidirectional motion information is further divided into unidirectional motion information, and List0 is added to the motion information candidate list in order of priority, and a duplication check process is performed during the adding process.

[0311] Finally, if the motion information candidate list is not full, it is necessary to continue to separate the temporal motion information into unidirectional motion information, and add List0 to the motion information candidate list in order of priority, and perform a duplication check during the adding process.

[0312] The method of prioritizing List0 is as follows: If motion information of List0 exists, the motion information of List0 may be added to the motion information candidate list, and a duplication check process must be performed in the process of adding it. If motion information of List1 exists, the motion information of List1 may be added to the motion information candidate list, and a duplication check process must be performed in the process of adding it.

[0313] The process of constructing the motion information candidate list is described below with reference to some specific application scenarios.

[0314] Application Scenario 1: In step 1, as shown in FIG. 7, F, G, C, A, B, and D are adjacent predictive blocks of the current block E, and in the order of F, G, C, A, B, and D (the order may be changed, for example, the order may be D, B, A, C, G, F, or other orders, and some adjacent predictive blocks may be deleted, for example, only F, G, C, A, and D are adopted), the motion information (if any) is put into the motion information candidate list in the order of priority of List0, and a duplication check process needs to be performed in the putting process, until all the motion information has been checked or the length of the motion information candidate list reaches X-1.

[0315] In step 2, since the length of the motion information candidate list is smaller than X, among the derived temporal motion information, unidirectional motion information pointing to List0 (if any) is put into the motion information candidate list, and a duplication check process is performed in the putting process.

[0316] In step 3, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information pointing to List1 (if any) is added to the motion information candidate list, and a duplication check process is performed in the adding process.

[0317] In step 4, if the length of the motion information candidate list is less than X, the last unidirectional motion information in the motion information candidate list may be filled repeatedly, and so on until the length of the motion information candidate list becomes X.

[0318] In the above embodiment, X can be any positive integer, for example, the value of X can be 4, 5, etc.

[0319] Application scenario 2: In step 1, F, G, C, A, B, and D are adjacent prediction blocks of the current block E, and their motion information (if any) is put into the motion information candidate list in the order of F, G, C, A, B, and D, with List0 being prioritized, and a duplication check process is performed in the putting process, until all the motion information has been checked or the length of the motion information candidate list reaches X.

[0320] In step 2, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information (if any) pointing to List0 may be added to the motion information candidate list, and a duplication check process must be performed in the adding process.

[0321] In step 3, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information pointing to List1 (if any) is added to the motion information candidate list, and a duplication check process is performed in the adding process.

[0322] In step 4, if the length of the motion information candidate list is less than X, the last unidirectional motion information in the motion information candidate list may be filled repeatedly, and so on until the length of the motion information candidate list becomes X.

[0323] In the above embodiment, X can be any positive integer, for example, the value of X can be 4, 5, etc.

[0324] For example, the difference between application scenario 1 and application scenario 2 is that in application scenario 1, at least one position is reserved for the temporal motion information, i.e., in step 1, the length of the motion information candidate list reaches X-1 instead of the maximum X.

[0325] Application scenario 3: In step 1, F, G, C, A, B, and D are adjacent prediction blocks of the current block E, and the unidirectional motion information (if any) is put into the motion information candidate list in the order of F, G, C, A, B, and D, and a duplication check process needs to be performed in the putting process, until all the motion information has been checked or the length of the motion information candidate list reaches X-1.

[0326] In step 2, if the length of the motion information candidate list is less than X-1, the bidirectional motion information of F, G, C, A, B, and D (if any) are put into the motion information candidate list in order of priority to List0, and a duplication check process is performed during the putting process, until all bidirectional motion information has been checked or the length of the motion information candidate list reaches X-1.

[0327] In step 3, since the length of the motion information candidate list is smaller than X, among the derived temporal motion information, unidirectional motion information pointing to List0 (if any) is put into the motion information candidate list, and a duplication check process must be performed in the putting process.

[0328] In step 4, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information (if any) pointing to List1 is added to the motion information candidate list, and a duplication check process is performed in the adding process.

[0329] In step 5, if the length of the motion information candidate list is less than X, the last unidirectional motion information in the motion information candidate list may be repeatedly filled, and so on until the length of the motion information candidate list becomes X.

[0330] In the above embodiment, X can be any positive integer, for example, the value of X can be 4, 5, etc.

[0331] In one possible embodiment, another explanation form of application scenario 3 may be as follows.

[0332] In step 1, F, G, C, A, B, and D are adjacent prediction blocks of the current block E, and it is determined whether F, G, C, A, B, and D are "usable" in the order of F, G, C, A, B, and D. If F exists and adopts an inter-frame prediction mode, it may be determined that F is usable, otherwise it is determined that F is unavailable. If G exists and adopts an inter-frame prediction mode, it may be determined that G is usable, otherwise it is determined that G is unavailable. If C exists and adopts an inter-frame prediction mode, it may be determined that C is usable, otherwise it is determined that C is unavailable. If A exists and adopts an inter-frame prediction mode, it may be determined that A is usable, otherwise it is determined that A is unavailable. If B exists and adopts an inter-frame prediction mode, it may be determined that B is usable, otherwise it is determined that B is unavailable. If D exists and employs an inter-frame prediction mode, it may be determined that D is available; otherwise, it is determined that D is unavailable.

[0333] In step 2, the unidirectionally available motion information is put into the motion information candidate list in the order of F, G, C, A, B, and D, and a duplication check process is required during the putting process, until the length of the motion information candidate list becomes X-1 or the traversal is completed.

[0334] In step 3, if the length of the motion information candidate list is less than X-1, the bidirectionally usable motion information is divided into unidirectional motion information pointing to List0 and unidirectional motion information pointing to List1, in the order of F, G, C, A, B, and D, and then entered into the motion information candidate list in order to perform a duplication check, continuing until the length of the motion information candidate list becomes X-1 or the traversal is completed.

[0335] In step 4, the derived time bidirectional motion information is divided into unidirectional motion information pointing to List0 and unidirectional motion information pointing to List1, and a duplication check process is first performed on the unidirectional motion information. If the unidirectional motion information does not overlap, the unidirectional motion information is put into the motion information candidate list, and the process continues until the length of the motion information candidate list becomes X or the traversal is completed.

[0336] In step 5, if the length of the motion information candidate list is less than X, the last unidirectional motion information in the motion information candidate list may be repeatedly filled, and so on until the length of the motion information candidate list becomes X.

[0337] In the above embodiment, X can be any positive integer, for example, the value of X can be 4, 5, etc.

[0338] Application scenario 4: In step 1, F, G, C, A, B, and D are adjacent prediction blocks of the current block E, and the unidirectional motion information (if any) is put into the motion information candidate list in the order of F, G, C, A, B, and D, and in the process of putting them in, a duplication check process needs to be performed, until all the unidirectional motion information has been checked or the length of the motion information candidate list reaches X.

[0339] In step 2, if the length of the motion information candidate list is less than X, the bidirectional motion information of F, G, C, A, B, and D (if any) are put into the motion information candidate list in the order of List0 priority, and a duplication check process needs to be performed during the putting process, until all the bidirectional motion information has been checked or the length of the motion information candidate list reaches X.

[0340] In step 3, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information (if any) pointing to List0 is put into the motion information candidate list, and a duplication check process is performed in the putting process.

[0341] In step 4, if the length of the motion information candidate list is less than X, among the derived temporal motion information, unidirectional motion information (if any) pointing to List1 is added to the motion information candidate list, and a duplication check process is performed in the adding process.

[0342] In step 5, if the length of the motion information candidate list is less than X, the last unidirectional motion information in the motion information candidate list may be repeatedly filled, and so on until the length of the motion information candidate list becomes X.

[0343] In the above embodiment, X can be any positive integer, for example, the value of X can be 4, 5, etc.

[0344] For example, the difference between application scenario 3 and application scenario 4 is that in application scenario 3, at least one position is reserved for the temporal motion information, i.e., in step 1, the length of the motion information candidate list reaches X-1 instead of the maximum X.

[0345] In Application Scenario 1 to Application Scenario 4, the solution related to deriving temporal motion information is conventional technology, for example, deriving temporal motion information of the current block using a collocated block of a collocated frame, but this is not limited thereto.

[0346] Application Scenario 5: In application scenarios 1 to 4, if the length of the motion information candidate list is smaller than X, the last unidirectional motion information in the motion information candidate list is repeatedly filled. In application scenario 5, the last unidirectional motion information is not repeatedly filled, but is filled by derivation. For example, based on any one valid motion information (x, y, ref_idx, ListX) in the motion information candidate list, where ref_idx and ListX are respectively a reference frame index and a reference frame list, and the two can be collectively referred to as reference frame information, at least one of the following motion information candidates may be added.

[0347] (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., the motion vector is scaled, and (k2*x,k2*y,ref_idx_new2,ListY), where k2 is any non-zero positive integer, i.e., the motion vector is scaled. Furthermore, zero motion information may be added, i.e., the motion information candidate may be (0,0,ref_idx3,ListZ). For the motion information candidate, when adding the motion information candidate to the motion information candidate list, a duplication check process may or may not be performed.

[0348] Application Scenario 6: In Application Scenario 1 to Application Scenario 4, the length of the motion information candidate list is X. For Example 9, it is necessary to select two motion information candidates from the motion information candidate list as the target motion information of the current block, and therefore the length of the motion information candidate list may be 2 to H, and H may be set, for example, to 4, 5, etc. based on experience. In addition, the encoding side may set the length of the motion information candidate list (i.e., the length of the motion information candidate list in the AWP mode, or the length of the motion information candidate list in the EAWP (Enhanced Angular Weighted Prediction) mode) by the sequence level syntax. For example, the length of the motion information candidate list may be indicated by awp_max_cand_num, and if the value indicated by awp_max_cand_num is a and a is between 2 and H, the decoding side determines the length of the motion information candidate list based on awp_max_cand_num, and for example, the length X is a. Alternatively, the length of the motion information candidate list is specified by awp_max_cand_num_minus2, and if the value specified by awp_max_cand_num_minus2 is a and a is between 0 and (H-2), the decoding side determines the length of the motion information candidate list based on awp_max_cand_num_minus2, for example, the length X is a+2. Alternatively, the encoding side sets the length of the motion information candidate list by frame level syntax, and for example, the length of the motion information candidate list is specified by slice_awp_max_cand_num, and if the value specified by slice_awp_max_cand_num is a and a is between 2 and H, the decoding side determines the length of the motion information candidate list based on slice_awp_max_cand_num, for example, the length X is a.Alternatively, the length of the motion information candidate list may be indicated by slice_awp_max_cand_num_minus2, where if the value indicated by slice_awp_max_cand_num_minus2 is a and a is between 0 and (H-2), the decoding side determines the length of the motion information candidate list based on slice_awp_max_cand_num_minus2, for example, length X is a+2.

[0349] Application Scenario 7: In Application Scenario 1 to Application Scenario 4, a motion information candidate list may be constructed, and in Application Scenario 7, the motion information candidate list may be written as AwpUniArray, and the motion information in AwpUniArray may be called motion information candidate. Regarding Example 9, a motion information candidate may be selected from AwpUniArray as the target motion information of the current block, and then a prediction value of the pixel position may be determined based on the target motion information.

[0350] For the ninth embodiment, it is necessary to select two motion information candidates from AwpUniArray and set them as the first target motion information and the second target motion information of the current block. Then, the decoding side may analyze AwpCandIdx0 and AwpCandIdx1 from the encoded bitstream and provide the AwpCandIdx0+1th motion information in AwpUniArray to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1. Provide the AwpCandIdx1+1th motion information in AwpUniArray to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1. Naturally, the AwpCandIdx0+1th motion information in the AwpUniArray may be given to mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1, and the AwpCandIdx1+1th motion information in the AwpUniArray may be given to mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1, and there is no limitation in this regard.

[0351] Exemplarily, AwpCandIdx0 represents an index value of the first target motion information, and therefore, AwpCandIdx0+1-th motion information in AwpUniArray may be set as the first target motion information. For example, if AwpCandIdx0 is 0, the first motion information in AwpUniArray is set as the first target motion information, if AwpCandIdx0 is 1, the second motion information in AwpUniArray is set as the first target motion information, and so on.

[0352] mvAwp0L0, mvAwp0L1, RefIdxAwp0L0, and RefIdxAwp0L1 are collectively defined as first target motion information, that is, the first target motion information includes unidirectional motion information pointing to List0 and unidirectional motion information pointing to List1.

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

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

[0355] Exemplarily, mvAwp0L0 and RefIdxAwp0L0 represent unidirectional motion information pointing to List0 of the first target motion information, and mvAwp0L1 and RefIdxAwp0L1 represent unidirectional motion information pointing to List1 of the first target motion information.

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

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

[0358] Exemplarily, AwpCandIdx1 represents an index value of the second target motion information, and thus the AwpCandIdx1+1th motion information in the AwpUniArray may be set as the second target motion information. For example, if AwpCandIdx1 is 0, the first motion information in the AwpUniArray is set as the second target motion information, and if AwpCandIdx1 is 1, the second motion information in the AwpUniArray is set as the second target motion information, and so on.

[0359] mvAwp1L0, mvAwp1L1, RefIdxAwp1L0, and RefIdxAwp1L1 can be collectively defined as 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.

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

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

[0362] Exemplarily, mvAwp1L0 and RefIdxAwp1L0 represent unidirectional motion information pointing to List0 of the second target motion information, and mvAwp1L1 and RefIdxAwp1L1 represent unidirectional motion information pointing to List1 of the second target motion information.

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

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

[0365] Example 11: In the above-mentioned examples 1 to 3, it is necessary to determine the first predicted value of the pixel position based on the first prediction mode, and to determine the second predicted value of the pixel position based on the second prediction mode. In this example, an example will be described in which the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode.

[0366] The first prediction mode may be an inter-frame prediction mode, and the second prediction mode may be an inter-frame prediction mode, and a motion information candidate list may be constructed, the motion information candidate list including at least two motion information candidates. Select one motion information candidate from the motion information candidate list as a first original motion information of the current block, and select another motion information candidate from the motion information candidate list as a second original motion information of the current block, the first original motion information and the second original motion information being different. Then, determine a first target motion information of the current block based on the first original motion information, and determine a second target motion information of the current block based on the second original motion information. For each pixel position of the current block, determine a first predicted value of the pixel position based on the first target motion information, and determine a second predicted value of the pixel position based on the second target motion information.

[0367] For the process of constructing the motion information candidate list, reference may be made to Example 9 and Example 10, and the description is omitted here. For the process of determining the first predicted value based on the first target motion information and determining the second predicted value based on the second target motion information, reference may be made to Example 9, and the description is omitted here. The difference from Example 9 is that in Example 11, the motion information candidate 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 may be further obtained based on the original motion information, and the specific obtaining process is referred to the following examples.

[0368] As can be seen above, for the above case, when at least one of the first prediction mode and the second prediction mode is an inter-frame prediction mode, a motion information candidate list may be constructed, and the motion information candidate list includes at least one motion information candidate. Then, two motion information candidates may be selected from the motion information candidate list as the first original motion information and the second original motion information of the current block, respectively, a first target motion information is determined according to the first original motion information, a second target motion information is determined according to the second original motion information, and then two predicted values ​​of the pixel position are determined according to the two target motion information.

[0369] Regarding how to determine the target motion information based on the original motion information, this embodiment proposes a solution of superimposing a differential motion vector on the unidirectional motion information, for example, the original motion information includes an original motion vector, and the target motion information includes a target motion vector. In order to determine the target motion vector of the current block based on the original motion vector, a differential motion vector (MVD) corresponding to the original motion vector can be obtained, and the target motion vector can be determined based on the differential motion vector and the original motion vector, that is, the sum of the differential motion vector and the original motion vector is the target motion vector.

[0370] Example 12: Based on Example 11, the direction information and amplitude information of the differential motion vector are determined. If the direction indicated by the direction information is right and the amplitude indicated by the amplitude information is Ar, the differential motion vector is (Ar, 0); if the direction indicated by the direction information is down and the amplitude indicated by the amplitude information is Ad, the differential motion vector is (0, -Ad); if the direction indicated by the direction information is left and the amplitude indicated by the amplitude information is Al, the differential motion vector is (-Al, 0); if the direction indicated by the direction information is up and the amplitude indicated by the amplitude information is Au, the differential motion vector is If the direction represented by the directional information is upper right and the amplitude represented by the amplitude information is Aru, the differential motion vector is (Aru,Aru); if the direction represented by the directional information is upper left and the amplitude represented by the amplitude information is Alu, the differential motion vector is (-Alu,Alu); if the direction represented by the directional information is lower left and the amplitude represented by the amplitude information is Ald, the differential motion vector is (-Ald,-Ald); and if the direction represented by the directional information is lower right and the amplitude represented by the amplitude information is Ard, the differential motion vector is (Ard,-Ard).

[0371] Each of the amplitudes Ar, Ad, Al, Au, Aru, Alu, Ald and Ard represents a set of values, and the values ​​in the amplitude sets in different directions may be completely the same, partially the same, or completely different.

[0372] For example, the differential motion vector may support some or all of the directional information, and the range of values ​​of the amplitude A supported by the differential motion vector may be set empirically and may be at least one value, without any limitation in this regard.

[0373] For example, the differential motion vector supports four directions: up, down, left, and right, and the differential motion vector supports five step length settings: 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, i.e., the amplitude A may have values ​​of 1, 2, 4, 8, and 16. As seen above, when the direction is up, the differential motion vector may be (0,1), (0,2), (0,4), (0,8), and (0,16). When the direction is down, the differential motion vector may be (0,-1), (0,-2), (0,-4), (0,-8), and (0,-16). When the direction is left, the differential motion vector may be (-1,0), (-2,0), (-4,0), (-8,0), and (-16,0). When the direction is right, the differential motion vectors may be (1,0), (2,0), (4,0), (8,0), (16,0).

[0374] As another example, the differential motion vector supports four directions, namely up, down, left and right, and supports six step length settings, namely 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel and 4-pel, i.e. the amplitude A may have values ​​of 1, 2, 4, 8, 12 and 16. As can be seen above, when the direction is up, the differential motion vector may be (0,1), (0,2), (0,4), (0,8), (0,12) and (0,16), and as for the differential motion vectors of other directions, they are similar to the implementation of the "up" direction, so the description will be omitted here.

[0375] As another example, the differential motion vector supports eight directions, namely, up, down, left, right, up-left, down-left, up-right, and down-right, and the differential motion vector supports three step length settings, namely, 1 / 4-pel, 1 / 2-pel, and 1-pel, that is, the values ​​of the amplitude A may be 1, 2, and 4. As can be seen above, when the direction is up-left, the differential motion vector may be (-1,1), (-2,2), and (-4,4), and when the direction is up-right, the differential motion vector may be (1,1), (2,2), and (4,4), and as for the differential motion vectors of other directions, they are similar to the implementation of the direction of "up-left, up-right", and the value of the differential motion vector may refer to the above convention, and the description here is omitted.

[0376] As another example, the differential motion vector supports four directions: up, down, left, and right, and the differential motion vector supports four step length settings: 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, i.e., the values ​​of amplitude A may be 1, 2, 4, and 8.

[0377] Of course, the above are only some examples, and are not limited thereto. For example, the direction supported by the differential motion vector can be selected arbitrarily, for example, six directions, up, down, left, right, top left, and bottom left, may be supported, or two directions, up and down, may be supported. As another example, the step length setting supported by the differential motion vector may be changed or flexibly set. As another example, the step length setting may be adaptively set based on coding parameters such as a quantization parameter QP, for example, 1-pel, 2-pel, 4-pel, or 8-pel is adopted for a larger QP, and 1 / 4-pel, 1 / 2-pel, 1-pel, or 2-pel is adopted for a smaller QP. As another example, an appropriate step length setting may be set at a sequence level, image level, frame level, slice level, tile level, patch level, CTU level, or the like, and the decoding side performs decoding based on the step length setting analyzed at the sequence level, image level, frame level, slice level, tile level, patch level, and CTU level.

[0378] For ease of explanation, in the following embodiments, the differential motion vector supports two directions, up and down, and supports setting step lengths such as 1-pel, 2-pel, etc. When described with 1 / 4-pel precision, the differential motion vector can be (0,4), (0,8), (0,-4), (0,-8), i.e., (0,1<<2), (0,1<<3), (0,-1<<2), (0,-1<<3).

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

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

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

[0382] As another example, when a differential motion vector supports four directions, namely, up, down, left, and right, and the differential motion vector supports six different step length settings, namely, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, the direction information of the differential motion vector may be encoded using a 2-bin fixed-length code (for a total of four values), and the amplitude information of the differential motion vector may be encoded using a truncated unary code.

[0383] As another example, when a differential motion vector supports eight directions, namely, up, down, left, right, upper left, lower left, upper right, and lower right, and the differential motion vector supports three step length settings, namely, 1 / 4-pel, 1 / 2-pel, and 1-pel, the direction information of the differential motion vector may be encoded using a 3-bin fixed-length code (for a total of eight values), and the amplitude information of the differential motion vector may be encoded using a truncated unary code.

[0384] As another example, when a differential motion vector supports four directions, namely, up, down, left, and right, and the differential motion vector supports four step length settings, namely, 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, the direction information of the differential motion vector may be encoded using a truncated unary code, and the amplitude information of the differential motion vector may be encoded using a 2-bin fixed-length code (for a total of four values).

[0385] Of course, the above are merely some examples of the encoding methods, and the present invention is not limited to the above encoding methods.

[0386] As can be seen above, the coding side can find the optimal motion vector in a specific region, and then take the difference between the optimal motion vector and the motion vector candidate as a differential motion vector (MVD), incorporate the amplitude information and direction information of the differential motion vector into the bitstream, and incorporate the index value of the motion vector candidate in the motion information candidate list into the bitstream. When the coding side searches for the optimal motion vector in a specific region, it needs to determine the direction and amplitude of the differential motion vector, that is, it searches for the optimal motion vector within a limited range of differential motion vectors such as (Ar, 0), (0, -Ad), (-Al, 0), (0, Au), (Aru, Aru), (-Alu, Alu), (-Ald, -Ald), (Ard, -Ard), and does not search for the optimal motion vector within the range of any differential motion vector.

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

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

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

[0390] Referring to the above embodiment, the encoding side can adopt a method such as a fixed-length code, a truncated unary code, etc. when encoding the amplitude information of the differential motion vector, and the decoding side can adopt a method such as a fixed-length code, a truncated unary code, etc. to decode the amplitude information of the differential motion vector and obtain a step length setting such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc. as the amplitude information of the differential motion vector, and then determine the value of the amplitude A of the differential motion vector based on the step length setting such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc.

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

[0392] In one possible embodiment, the encoding side may code flag information in the encoding bitstream, which indicates that a differential motion vector is superimposed on an original motion vector or that a differential motion vector is not superimposed on an original motion vector. The flag information may be a sub-mode flag of an EAWP mode, and the EAWP mode may be further called an AWP with motion vector refinement (AWP-MVR) mode. After receiving the encoding bitstream of the current block, the decoding side first analyzes the sub-mode flag of an enhanced angle weighted prediction mode from the encoding bitstream of the current block. If the sub-mode flag indicates that a differential motion vector is superimposed on an original motion vector, the decoding side analyzes the direction information and the amplitude information of the differential motion vector from the encoding bitstream of the current block, determines a differential motion vector according to the direction information and the amplitude information, and determines a target motion vector of the current block according to the original motion vector and the differential motion vector. If the submode flag indicates that the differential motion vector is not to be superimposed on the original motion vector, the decoding side does not analyze the direction information and amplitude information of the differential motion vector, but directly sets the original motion vector as the target motion vector of the current block.

[0393] For example, when the sub-mode flag of the enhanced angle weighted prediction mode is a first sub-mode value, it indicates that the differential motion vector is superimposed on the original motion vector, and when the sub-mode flag of the enhanced angle weighted prediction mode is a second sub-mode value, it indicates that the differential motion vector is not superimposed on the original motion vector. The first sub-mode value and the second sub-mode value may be set according to experience, for example, the first sub-mode value is 1 and the second sub-mode value is 0, or for example, the first sub-mode value is 0 and the second sub-mode value is 1, and of course, the above are only two examples and are not limited thereto.

[0394] In one possible embodiment, for example 11, 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, thereby obtaining a first differential motion vector corresponding to the first original motion vector, and determining the first target motion vector based on the first differential motion vector and the first original motion vector, i.e., the sum of the first differential motion vector and the first original motion vector is the first target motion vector; obtaining a second differential motion vector corresponding to the second original motion vector, and determining the second target motion vector based on the second differential motion vector and the second original motion vector, i.e., the sum of the second differential motion vector and the second original motion vector is the second target motion vector.

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

[0396] When the encoding side transmits the encoded bit stream of the current block to the decoding side, the directional information and the amplitude information of the first differential motion vector and the directional information and the amplitude information of the second differential motion vector may be added to the encoded bit stream.

[0397] As for the decoding side, after receiving the encoded bitstream of the current block, the decoding side may analyze the direction information and amplitude information of the first differential motion vector from the encoded bitstream and determine the first differential motion vector based on the direction information and amplitude information of the first differential motion vector, and may analyze the direction information and amplitude information of the second differential motion vector from the encoded bitstream and determine the second differential motion vector based on the direction information and amplitude information of the second differential motion vector.

[0398] Next, the decoding side may determine a first target motion vector for the current block based on the first differential motion vector and the first original motion vector, and determine a second target motion vector for the current block based on the second differential motion vector and the second original motion vector.

[0399] In one possible embodiment, the encoding side may also encode a first sub-mode flag and a second sub-mode flag of the enhanced angle weighted prediction mode in the encoded bitstream, where the first sub-mode flag indicates overlapping a differential motion vector with respect to the first original motion vector or not overlapping a differential motion vector with respect to the first original motion vector, and the second sub-mode flag indicates overlapping a differential motion vector with respect to the second original motion vector or not overlapping a differential motion vector with respect to the second original motion vector.

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

[0401] After receiving the encoded bitstream of the current block, the decoding side may first analyze the first submode flag and the second submode flag of the enhanced angle weighting prediction mode from the encoded bitstream of the current block. If the first submode flag indicates that a differential motion vector is superimposed on the first original motion vector, the decoding side may analyze the direction information and amplitude information of the first differential motion vector from the encoded bitstream of the current block, determine the first differential motion vector based on the direction information and amplitude information of the first differential motion vector, and then determine the first target motion vector of the current block based on the first original motion vector and the first differential motion vector. If the first submode flag indicates that a differential motion vector is not superimposed on the first original motion vector, the decoding side may directly take the first original motion vector as the first target motion vector of the current block without analyzing the direction information and amplitude information of the first differential motion vector. If the second sub-mode flag indicates that the differential motion vector is superimposed on the second original motion vector, then analyze the direction information and amplitude information of the second differential motion vector from the encoded bitstream of the current block, determine the second differential motion vector according to the direction information and amplitude information of the second differential motion vector, and then determine the second target motion vector of the current block according to the second original motion vector and the second differential motion vector. If the second sub-mode flag indicates that the differential motion vector is not superimposed on the second original motion vector, then the second original motion vector may be directly taken as the second target motion vector of the current block without analyzing the direction information and amplitude information of the second differential motion vector.

[0402] Example 13: Based on Example 11, on the encoding side, an optimal motion vector is found within a specific area, and then the difference between the optimal motion vector and a motion vector candidate is treated as a differential motion vector (MVD), information on the differential motion vector is incorporated into the bitstream, and an index value in the motion information candidate list of the motion vector candidate is incorporated into the bitstream.

[0403] When searching for an optimal motion vector in a specific region, the encoding side may search arbitrarily, and there is no limitation thereto. For example, for each motion vector candidate in the motion information candidate list, find several edge motion vectors centered on the motion vector candidate, determine the RDO cost value corresponding to each edge motion vector, select the minimum RDO cost value from all the RDO cost values, and take the edge motion vector corresponding to the minimum RDO cost value as the optimal motion vector.

[0404] If an optimal motion vector is found based on motion vector candidate 1, motion vector candidate 1 may be taken as the original motion vector of the current block, and the difference between the optimal motion vector and motion vector candidate 1 may be taken as the differential motion vector.

[0405] The encoding side may encode the index value of the motion information candidate list of the motion vector candidate 1 and the information of the differential motion vector in the encoded bitstream of the current block, where the information of the differential motion vector may include, but is not limited to, information of horizontal component difference and / or information of vertical component difference, where the information of the horizontal component difference may include the absolute value of the horizontal component difference and / or the code value of the horizontal component difference, and the information of the vertical component difference may include the absolute value of the vertical component difference and / or the code value of the vertical component difference.

[0406] The decoding side may, after receiving the encoded bitstream of the current block, analyze the index value of the motion vector candidate in the motion information candidate list from the encoded bitstream, select the motion vector candidate corresponding to the index value from the motion information candidate list, and set the motion vector candidate as the original motion vector of the current block. The decoding side may also analyze the horizontal component difference information and vertical component difference information of the differential motion vector from the encoded bitstream of the current block, and determine the differential motion vector based on the horizontal component difference information (e.g., the absolute value of the horizontal component difference and / or the code value of the horizontal component difference) and the vertical component difference information (e.g., the absolute value of the vertical component difference and / or the code value of the vertical component difference) of the differential motion vector.

[0407] Next, the decoding side may determine a target motion vector for the current block based on the differential motion vector and the original motion vector; for example, the decoding side may determine the sum of the differential motion vector and the original motion vector as the target motion vector for the current block.

[0408] For example, the decoding side may determine a horizontal component difference based on the absolute value of the horizontal component difference and the code value of the horizontal component difference, and may determine a vertical component difference based on the absolute value of the vertical component difference and the code value of the vertical component difference, and the combination of the horizontal component difference and the vertical component difference is a differential motion vector, that is, the differential motion vector includes the horizontal component difference and the vertical component difference.

[0409] In one possible embodiment, the encoding side may code a sub-mode flag of an enhanced angle weighted prediction mode in the encoding bitstream, which indicates that the differential motion vector is superimposed on the original motion vector or that the differential motion vector is not superimposed on the original motion vector. After receiving the encoding bitstream of the current block, the decoding side analyzes the sub-mode flag of the enhanced angle weighted prediction mode from the encoding bitstream. If the sub-mode flag indicates that the differential motion vector is superimposed on the original motion vector, the decoding side analyzes the horizontal component difference information and the vertical component difference information of the differential motion vector from the encoding bitstream, determines the differential motion vector according to the horizontal component difference information and the vertical component difference information, and determines the target motion vector of the current block according to the original motion vector and the differential motion vector. If the sub-mode flag indicates that the differential motion vector is not superimposed on the original motion vector, the decoding side does not analyze the horizontal component difference information and the vertical component difference information of the differential motion vector, and takes the original motion vector as the target motion vector of the current block.

[0410] In one possible embodiment, for example 11, 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, thereby obtaining a first differential motion vector corresponding to the first original motion vector, and determining the first target motion vector based on the first differential motion vector and the first original motion vector, i.e., the sum of the first differential motion vector and the first original motion vector is the first target motion vector; obtaining a second differential motion vector corresponding to the second original motion vector, and determining the second target motion vector based on the second differential motion vector and the second original motion vector, i.e., the sum of the second differential motion vector and the second original motion vector is the second target motion vector.

[0411] On the encoding side, information on the horizontal component difference (e.g., the absolute value of the horizontal component difference and / or the code value of the horizontal component difference) and information on the vertical component difference (e.g., the absolute value of the vertical component difference and / or the code value of the vertical component difference) of the first differential motion vector, as well as information on the horizontal component difference and information on the vertical component difference of the second differential motion vector may be added to the encoded bitstream of the current block.

[0412] On the decoding side, after receiving the coded bit stream of the current block, the decoding side may analyze information on horizontal component difference and vertical component difference of the first differential motion vector from the coded bit stream, and determine the first differential motion vector based on the information on horizontal component difference and vertical component difference of the first differential motion vector. The decoding side may analyze information on horizontal component difference and vertical component difference of the second differential motion vector from the coded bit stream, and determine the second differential motion vector based on the information on horizontal component difference and vertical component difference of the second differential motion vector. The decoding side may determine a first target motion vector based on the first differential motion vector and the first original motion vector, and determine a second target motion vector based on the second differential motion vector and the second original motion vector.

[0413] In one possible embodiment, the encoding side may also encode a first sub-mode flag and a second sub-mode flag of the enhanced angle weighted prediction mode in the encoded bitstream, where the first sub-mode flag may indicate overlapping a differential motion vector with respect to the first original motion vector or not overlapping a differential motion vector with respect to the first original motion vector, and the second sub-mode flag may indicate overlapping a differential motion vector with respect to the second original motion vector or not overlapping a differential motion vector with respect to the second original motion vector.

[0414] After receiving the encoded bitstream of the current block, the decoding side may first analyze the first submode flag and the second submode flag of the enhanced angle weighting prediction mode from the encoded bitstream of the current block. If the first submode flag indicates that a differential motion vector is superimposed on the first original motion vector, the decoding side may analyze the horizontal component difference information and the vertical component difference information of the first differential motion vector from the encoded bitstream of the current block, and determine the first differential motion vector based on the horizontal component difference information and the vertical component difference information of the first differential motion vector, and then determine the first target motion vector of the current block based on the first original motion vector and the first differential motion vector. If the first submode flag indicates that a differential motion vector is not superimposed on the first original motion vector, the decoding side may directly set the first original motion vector as the first target motion vector of the current block without analyzing the horizontal component difference information and the vertical component difference information of the first differential motion vector. If the second sub-mode flag indicates that the differential motion vector is superimposed on the second original motion vector, the horizontal component difference information and vertical component difference information of the second differential motion vector are analyzed from the encoded bitstream of the current block, and the second differential motion vector is determined according to the horizontal component difference information and vertical component difference information of the second differential motion vector, and then the second target motion vector of the current block is determined according to the second original motion vector and the second differential motion vector.If the second sub-mode flag indicates that the differential motion vector is not superimposed on the second original motion vector, the horizontal component difference information and vertical component difference information of the second differential motion vector are not analyzed, and the second original motion vector may be directly used as the second target motion vector of the current block.

[0415] Example 14: Based on Examples 11 to 13, the syntax related to overlapping a differential motion vector with unidirectional motion information will be described below with reference to some specific application scenarios for the case of two differential motion vectors.

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

[0417] awp_idx (angle weighted prediction mode index): Angle weighted prediction mode index value in skip mode or direct mode, and the value of AwpIdx (see Example 8 for the definition of AwpIdx) may be equal to the value of awp_idx. If awp_idx does not exist in the bitstream, the value of AwpIdx is equal to 0.

[0418] awp_cand_idx0 (first motion information index of angle weighted prediction mode): the first motion information index value of angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx0 (see Example 10 for related definition) is equal to the value of awp_cand_idx0, and if awp_cand_idx0 does not exist in the bitstream, the value of AwpCandIdx0 is equal to 0.

[0419] awp_cand_idx1 (second motion information index of angle weighted prediction mode): the second motion information index value of angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx1 (see Example 10 for related definition) is equal to the value of awp_cand_idx1, and if awp_cand_idx1 does not exist in the bitstream, the value of AwpCandIdx1 is equal to 0.

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

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

[0422] awp_mvd_sub_flag1 (second submode flag of enhanced angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may represent that it is necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may represent that it is not necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 does not exist in the bitstream, the following case may also exist: if AwpMvdFlag is equal to 1, the value of AwpMvdSubFlag1 may be equal to 1, otherwise, the value of AwpMvdSubFlag1 may be equal to 0.

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

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

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

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

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

[0428] Regarding awp_idx, awp_cand_idx0, and awp_cand_idx1, reference can be made to application scenario 1, and explanations thereof will be omitted here.

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

[0430] awp_mvd_sub_flag1 (second submode flag of enhanced angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may represent that it is necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may represent that it is not necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 does not exist in the bitstream, the value of AwpMvdSubFlag1 may be equal to 0.

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

[0432] For example, the difference between application scenario 1 and application scenario 2 is that the syntax awp_mvd_flag exists in application scenario 1, and the syntax awp_mvd_flag does not exist in application scenario 2. In application scenario 1, the enhanced angle weighting prediction mode is controlled by awp_mvd_flag, that is, the enhanced angle weighting prediction mode can be controlled by the master switch.

[0433] Exemplarily, application scenario 1 and application scenario 2 may be implementation forms for Example 12.

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

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

[0436] awp_cand_idx0 (first motion information index of angle weighted prediction mode): the first motion information index value of angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx0 (see Example 10 for related definition) is equal to the value of awp_cand_idx0, and if awp_cand_idx0 does not exist in the bitstream, the value of AwpCandIdx0 is equal to 0.

[0437] awp_cand_idx1 (second motion information index of angle weighted prediction mode): the second motion information index value of angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx1 (see Example 10 for related definition) is equal to the value of awp_cand_idx1, and if awp_cand_idx1 does not exist in the bitstream, the value of AwpCandIdx1 is equal to 0.

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

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

[0440] awp_mvd_sub_flag1 (second submode flag of enhanced angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may represent that it is necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may represent that it is not necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 does not exist in the bitstream, the following case may also exist: if AwpMvdFlag is equal to 1, the value of AwpMvdSubFlag1 may be equal to 1, otherwise, the value of AwpMvdSubFlag1 may be equal to 0. For example, awp_mv_diff_x_abs0 (absolute value of the first motion vector horizontal component difference in enhanced angle weighted prediction mode) and awp_mv_diff_y_abs0 (absolute value of the first motion vector vertical component difference in enhanced angle weighted prediction mode) are the absolute values ​​of the first differential motion vector value in enhanced angle weighted prediction mode, AwpMvDiffXAbs0 is equal to the value of awp_mv_diff_x_abs0, and AwpMvDiffYAbs0 is equal to the value of awp_mv_diff_y_abs0. awp_mv_diff_x_sign0 (sign value of the first motion vector horizontal component difference in enhanced angle weighted prediction mode) and awp_mv_diff_y_sign0 (sign value of the first motion vector vertical component difference in enhanced angle weighted prediction mode) are the sign bits of the first differential motion vector value in enhanced angle weighted prediction mode, and the value of AwpMvDiffXSign0 is equal to the value of awp_mv_diff_x_sign0, and the value of AwpMvDiffYSign0 is equal to the value of awp_mv_diff_y_sign0.

[0441] In one possible embodiment, if awp_mv_diff_x_sign0 or awp_mv_diff_y_sign0 is not present in the bitstream, the value of AwpMvDiffXSign0 or AwpMvDiffYSign0 is 0. If the value of AwpMvDiffXSign0 is 0, then AwpMvDiffX0 may be equal to AwpMvDiffXAbs0, and if the value of AwpMvDiffXSign0 is 1, then AwpMvDiffX0 may be equal to -AwpMvDiffXAbs0. If the value of AwpMvDiffYSign0 is 0, then AwpMvDiffY0 may be equal to AwpMvDiffYAbs0, and if the value of AwpMvDiffYSign0 is 1, then AwpMvDiffY0 may be equal to -AwpMvDiffYAbs0. The value range of AwpMvDiffX0 and AwpMvDiffY0 is -32768 to 32767.

[0442] For example, awp_mv_diff_x_abs1 (absolute value of the second motion vector horizontal component difference in enhanced angle weighted prediction mode) and awp_mv_diff_y_abs1 (absolute value of the second motion vector vertical component difference in enhanced angle weighted prediction mode) are the absolute values ​​of the second differential motion vector values ​​in enhanced angle weighted prediction mode, AwpMvDiffXAbs1 is equal to the value of awp_mv_diff_x_abs1, and AwpMvDiffYAbs1 is equal to the value of awp_mv_diff_y_abs1. awp_mv_diff_x_sign1 (sign value of the second motion vector horizontal component difference in enhanced angle weighted prediction mode) and awp_mv_diff_y_sign1 (sign value of the second motion vector vertical component difference in enhanced angle weighted prediction mode) are the sign bits of the second differential motion vector value in enhanced angle weighted prediction mode, and the value of AwpMvDiffXSign1 is equal to the value of awp_mv_diff_x_sign1, and the value of AwpMvDiffYSign1 is equal to the value of awp_mv_diff_y_sign1.

[0443] In one possible embodiment, if awp_mv_diff_x_sign1 or awp_mv_diff_y_sign1 is not present in the bitstream, the value of AwpMvDiffXSign1 or AwpMvDiffYSign1 is 0. If the value of AwpMvDiffXSign1 is 0, AwpMvDiffX1 is equal to AwpMvDiffXAbs1, and if the value of AwpMvDiffXSign1 is 1, AwpMvDiffX1 is equal to -AwpMvDiffXAbs1. If the value of AwpMvDiffYSign1 is 0, AwpMvDiffY1 may be equal to AwpMvDiffYAbs1, and if the value of AwpMvDiffYSign1 is 1, AwpMvDiffY1 may be equal to -AwpMvDiffYAbs1. The value range of AwpMvDiffX1 and AwpMvDiffY1 is -32768 to 32767. [Table 6]

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

[0445] Regarding awp_idx, awp_cand_idx0, and awp_cand_idx1, reference can be made to application scenario 1, and explanations thereof will be omitted here.

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

[0447] awp_mvd_sub_flag1 (second submode flag of enhanced angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may represent that it is necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may represent that it is not necessary to overlap differential motion information on the second motion information of the enhanced angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and if awp_mvd_sub_flag1 does not exist in the bitstream, the value of AwpMvdSubFlag1 may be equal to 0.

[0448] For example, for parameters such as awp_mv_diff_x_abs0, awp_mv_diff_y_abs0, awp_mv_diff_x_sign0, awp_mv_diff_y_sign0, awp_mv_diff_x_abs1, awp_mv_diff_y_abs1, awp_mv_diff_x_sign1 and awp_mv_diff_y_sign1 in Table 7, reference may be made to Application Scenario 3, and description thereof will be omitted here. [Table 7]

[0449] For example, the difference between application scenario 3 and application scenario 4 is that the syntax awp_mvd_flag exists in application scenario 3, and the syntax awp_mvd_flag does not exist in application scenario 4. In application scenario 3, the enhanced angle weighting prediction mode is controlled by awp_mvd_flag, that is, the enhanced angle weighting prediction mode can be controlled by the master switch.

[0450] Illustratively, application scenario 3 and application scenario 4 may be implementation forms for the thirteenth embodiment.

[0451] The difference between Application Scenario 3 / Application Scenario 4 and Application Scenario 1 / Application Scenario 2 is that Application Scenario 1 / Application Scenario 2 adopt some preferred MVDs, while Application Scenario 3 / Application Scenario 4 allows all MVDs within a specific search range. For example, the method of Application Scenario 5 may be adopted to search for all MVDs within a specific search range.

[0452] Application Scenario 5: Table 8 shows an example of the relevant syntax, and Table 8 shows the encoding method of MVD. As can be seen from Table 8, the following steps can be adopted to realize the encoding of MVD, and of course, this is just one example.

[0453] 1. Determine whether |MVD_X| is greater than 0, where |...| is the absolute value symbol and MVD_X represents the horizontal component of MVD.

[0454] 2. Determine whether |MVD_Y| is greater than 0, where |...| is the absolute value symbol and MVD_Y represents the vertical component of MVD.

[0455] 3. If |MVD_X| is greater than 0, determine whether |MVD_X| is greater than 1.

[0456] 4. If |MVD_Y| is greater than 0, determine whether |MVD_Y| is greater than 1.

[0457] 5. If |MVD_X| is greater than 1, code |MVD_X|-2.

[0458] 6. If |MVD_X| is greater than 0, encode the sign bit of MVD_X.

[0459] 7. If |MVD_Y| is greater than 1, code |MVD_Y|-2.

[0460] 8. If |MVD_Y| is greater than 0, encode the sign bit of MVD_Y. [Table 8]

[0461] Application Scenario 6: The application scenarios 1 to 4 can be derived, and the AWP and EAWP modes are completely integrated, that is, 0 span is added to the span, so that it is not necessary to code the flag bit for enable or not. For example, the differential motion vector supports four directions, namely up, down, left, and right, and the differential motion vector supports six step length settings, namely 0-pel, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, that is, 0-pel is added to the step length setting. In addition, Table 4 / Table 5 may be updated to Table 9, and Table 6 / Table 7 may be updated to Table 10. The meaning of the relevant syntax of Table 9 and Table 10 can be referred to Table 4 and Table 6, and the description will be omitted here. [Table 9] [Table 10]

[0462] Application Scenario 7: The above embodiment relates to the AWP mode, the DAWP (Dual Interframe Angle Weighted Prediction) mode, and the EAWP mode, and these modes can be controlled to be on or off by the high level syntax. For example, the AWP mode is controlled to be on or off by the high level syntax 1. As another example, the DAWP mode is controlled to be on or off by the high level syntax 2. As another example, the EAWP mode is controlled to be on or off by the high level syntax 3. As another example, the AWP mode and the DAWP mode are controlled to be on simultaneously by the high level syntax 4, or the AWP mode and the DAWP mode are controlled to be off simultaneously by the high level syntax 5. As another example, the AWP mode and the EAWP mode are controlled to be on simultaneously by the high level syntax 5, or the AWP mode and the EAWP mode are controlled to be off simultaneously. As another example, the DAWP mode and the EAWP mode are controlled to be on simultaneously by the high level syntax 6, or the DAWP mode and the EAWP mode are controlled to be off simultaneously. As another example, the AWP mode, the DAWP mode, and the EAWP mode may be controlled to be simultaneously turned on by the high level syntax 7, or the AWP mode, the DAWP mode, and the EAWP mode may be controlled to be simultaneously turned off by the high level syntax 7. Of course, the above are only a few examples, and are not limited thereto.

[0463] In the embodiment, the high level syntax may be a high level syntax at a sequence parameter set level, or a high level syntax at a picture parameter set level, or a high level syntax at a slice header level, or a high level syntax at a picture header level, and is not limited to the high level syntax. For example, based on the high level syntax at the sequence parameter set level, sps_awp_enable_flag, sh_awp_enable_flag, awp_enable_flag, etc. may be used to control the on or off of the AWP mode, or to control the on or off of the EAWP mode, or to control multiple modes to be on or off simultaneously, and is not limited thereto.

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

[0465] Exemplarily, the above-mentioned Examples 1 to 14 may be realized alone or in combination. For example, the Examples 1 and 2 may be realized in combination, the Examples 1 and 3 may be realized in combination, and the Examples 1, 2 and 3 may be realized in combination. The Example 4 may be realized in combination with one or more of the Examples 1 to 3, and the Example 5 (or the Example 6, or the Example 7) may be realized in combination with the Example 2 (or the Example 3). The Example 8 may be realized in combination with the Example 2 (or the Example 3). Any one or more of the Examples 9 to 14 may be realized in combination with any one or more of the Examples 1 to 8. Of course, the above are merely some examples, and are not limited to the manner of combination between the Examples.

[0466] Based on the same concept as the above method, an embodiment of the present application further proposes an encoding device and a decoding device, both of which may include an obtaining module 811, a first determining module 812, a second determining module 813, a third determining module 814, and an encoding-decoding module 815, as shown in Fig. 8A. Note that, for the encoding device, the encoding-decoding module 815 realizes the encoding function, and for the decoding device, the encoding-decoding module 815 realizes the decoding function.

[0467] In some examples, when it is determined to start weighted prediction for a current block, the encoding apparatus includes a module (e.g., an acquisition module 811) for executing, for the current block, obtaining a weighted prediction angle of the current block; and a module (e.g., a first determination module 812) for executing, for each pixel position of the current block, determining a surrounding matching position to which the pixel position points from among surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value of the pixel position based on a reference weight value associated with the surrounding matching position; and determining an associated weight value of the pixel position based on the target weight value of the pixel position. the second determination module 813); for each pixel position of the current block, a module (e.g., a third determination module 814) for determining a first predicted value for the pixel position based on a first prediction mode of the current block, determining a second predicted value for the pixel position based on a second prediction mode of the current block, and determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and a module (e.g., an encoding / decoding module 815) for determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0468] In some examples, when it is determined to start weighted prediction for a current block, the decoding device includes a module (e.g., an acquisition module 811) for executing, for the current block, obtaining a weighted prediction angle of the current block; for each pixel position of the current block, a module (e.g., a first determination module 812) for executing, based on the weighted prediction angle of the current block, determining a neighboring matching position pointed to by the pixel position from among neighboring positions outside the current block, based on the weighted prediction angle of the current block; and determining a target weight value of the pixel position based on a reference weight value associated with the neighboring matching position, and determining an associated weight value of the pixel position based on the target weight value of the pixel position. The current block may further include a module (e.g., a second determination module 813) for performing, for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block, determining a second predicted value for the pixel position based on a second prediction mode of the current block, and determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and a module (e.g., an encoding / decoding module 815) for determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0469] The second determination module 813 is further used to set a reference weight value for an outer peripheral position of the current block, and the reference weight value for the outer peripheral position of the current block is preset or set based on a weight setting parameter, and the weight setting parameter includes a weight conversion rate and a start position of weight conversion. Exemplarily, the start position of weight conversion is determined by at least one parameter of a weight prediction angle of the current block, a weight prediction position of the current block, and a size of the current block.

[0470] For example, the number of peripheral positions outside the current block is determined based on the size of the current block and / or the weighted prediction angle of the current block, and the reference weight values ​​of the peripheral positions outside the current block monotonically increase or decrease.

[0471] For example, the reference weight values ​​of the peripheral positions outside the current block include a reference weight value of the target area, a reference weight value of a first adjacent area of ​​the target area, and a reference weight value of a second adjacent area of ​​the target area, or, the reference weight values ​​of the first adjacent area are all second reference weight values, and the reference weight values ​​of the second adjacent area are all third reference weight values, and the second reference weight values ​​and the third reference weight values ​​are different.

[0472] The target region includes one reference weight value or at least two reference weight values, and if the target region includes at least two reference weight values, the at least two reference weight values ​​of the target region are monotonically increasing.

[0473] For example, the weighted prediction angle of the current block is a horizontal angle, or the weighted prediction angle of the current block is a vertical angle, or the absolute value of the gradient of the weighted prediction angle of the current block is 2 to the power of 2, where n is an integer.

[0474] For example, the peripheral positions outside the current block include integer pixel positions, or sub-pixel positions, or integer pixel positions and sub-pixel positions, and the peripheral positions outside the current block include peripheral positions in a top row outside the current block, or peripheral positions in a left column outside the current block.

[0475] Specifically, the second determination module 813 is used to determine a target weight value of the pixel position based on the reference weight value of the integer pixel position when the surrounding matching position is an integer pixel position and a reference weight value is set at the integer pixel position, or to determine a target weight value of the pixel position based on the reference weight value of the sub-pixel position when the surrounding matching position is a sub-pixel position and a reference weight value is set at the sub-pixel position.

[0476] Exemplarily, the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode.

[0477] Illustratively, the third determination module 814 further constructs a motion information candidate list, where the motion information candidate list includes at least two motion information candidates, and is used to select one motion information candidate from the motion information candidate list as a first target motion information of the current block and determine the first predicted value of the pixel position based on the first target motion information, and to select another motion information candidate from the motion information candidate list as a second target motion information of the current block and determine the second predicted value of the pixel position based on the second target motion information.

[0478] The third determination module 814 further constructs a motion information candidate list, where the motion information candidate list includes at least two motion information candidates, and is used to select one motion information candidate from the motion information candidate list as a first original motion information of the current block, determine a first target motion information of the current block based on the first original motion information, determine the first predicted value of the pixel position based on the first target motion information, select another motion information candidate from the motion information candidate list as a second original motion information of the current block, determine a second target motion information of the current block based on the second original motion information, and determine the second predicted value of the pixel position based on the second target motion information.

[0479] 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, and the third determination module 814 is further used for obtaining a differential motion vector corresponding to the first original motion vector, determining the first target motion vector according to the differential motion vector corresponding to the first original motion vector and the first original motion vector, obtaining a differential motion vector corresponding to the second original motion vector, and determining the second target motion vector according to the differential motion vector corresponding to the second original motion vector and the second original motion vector. When the device is applied to a decoding side, the third determination module 814 is further used for analyzing direction information and amplitude information of the corresponding differential motion vector from the encoded bitstream of the current block, and determining the corresponding differential motion vector according to the direction information and amplitude information of the corresponding differential motion vector.

[0480] For example, if the direction represented by the directional information is right and the amplitude represented by the amplitude information is Ar, the differential motion vector is (Ar, 0); if the direction represented by the directional information is down and the amplitude represented by the amplitude information is Ad, the differential motion vector is (0, -Ad); if the direction represented by the directional information is left and the amplitude represented by the amplitude information is Al, the differential motion vector is (-Al, 0); and if the direction represented by the directional information is up and the amplitude represented by the amplitude information is Au, the differential motion vector is (0, Au).

[0481] The third determination module 814 is further used to analyze flag information from the encoded bitstream of the current block, and if the flag information indicates that a differential motion vector is to be superimposed on the original motion vector, to analyze direction information and amplitude information of the corresponding differential motion vector from the encoded bitstream of the current block.

[0482] In an embodiment of the present application, based on the same concept as the method, a decoding device (also called a video decoder) is provided, and in terms of hardware, the hardware architecture schematic diagram of the decoding device can be specifically referred to in Fig. 8B. The decoding device includes a processor 821 and a machine-readable storage medium 822, and the machine-readable storage medium 822 stores machine-executable instructions executable by the processor 821, and the processor 821 is used to implement the method disclosed in the above example of the present application by executing the machine-executable instructions. For example, when the processor 821, by executing machine-executable instructions, determines to start weighted prediction for a current block, the processor 821 is used to perform the following steps for the current block: obtaining a weighted prediction angle for the current block; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position and determining an associated weight value for the pixel position based on the target weight value for the pixel position; for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted prediction value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted prediction value for the current block based on the weighted prediction values ​​of all pixel positions of the current block.

[0483] In an embodiment of the present application, based on the same concept as the method, an encoding device (also called a video encoder) is provided, and looking at the hardware, one can specifically refer to Fig. 8C as its hardware architecture schematic diagram. The encoding device includes a processor 831 and a machine-readable storage medium 832, and the machine-readable storage medium 832 stores machine-executable instructions executable by the processor 831, and the processor 831 is used to implement the method disclosed in the above example of the present application by executing the machine-executable instructions. For example, when the processor 831, by executing machine-executable instructions, determines to start weighted prediction for a current block, the processor 831 is used to perform the following steps for the current block: obtaining a weighted prediction angle for the current block; for each pixel position of the current block, determining a surrounding matching position pointed to by the pixel position from among surrounding positions outside the current block based on the weighted prediction angle of the current block; determining a target weight value for the pixel position based on a reference weight value associated with the surrounding matching position and determining an associated weight value for the pixel position based on the target weight value for the pixel position; for each pixel position of the current block, determining a first predicted value for the pixel position based on a first prediction mode of the current block and determining a second predicted value for the pixel position based on a second prediction mode of the current block; determining a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value; and determining a weighted predicted value for the current block based on the weighted predicted values ​​of all pixel positions of the current block.

[0484] In an embodiment of the present application, based on the same concept as the above method, a camera device is further provided, which may include an encoding / decoding device according to any of the above embodiments, and which can employ the above flow to perform processing.

[0485] In an embodiment of the present application, based on the same concept as the above method, a machine-readable storage medium is further provided, in which some computer instructions are stored, and when the computer instructions are executed by a processor, the method disclosed in the above examples of the present application, for example the encoding / decoding method according to each of the above embodiments, can be realized.

[0486] The systems, devices, modules or units described in the above embodiments may be realized by computer chips or entities, or by products having specific functions. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cell phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an e-mail sending / receiving device, a game machine, a tablet computer, a wearable device, or any combination of these devices. For convenience of explanation, when describing the above devices, the devices are divided into various units according to their functions and each unit is described. Of course, when implementing the present application, the functions of each unit may be realized by the same or multiple software and / or hardware.

[0487] It will be apparent to those skilled in the art that the embodiments of the present application may be provided as a method, a system, or a computer program product. The present application may take the form of an embodiment consisting entirely of hardware, an embodiment consisting entirely of software, or an embodiment consisting of a combination of software and hardware. The embodiments of the present application may take the form of a computer program product embodied in one or more computer usable storage media (including, but not limited to, disk storage devices, CD-ROMs, optical storage devices) containing computer usable program code.

[0488] The above is merely an embodiment of the present application, and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. that do not deviate from the spirit and principles of the present application shall be included in the scope of the claims of the present application. [Explanation of symbols]

[0489] 811 Acquisition Module 812 First Decision Module 813 Second Decision Module 814 Third Decision Module 815 Encoding and Decoding Module 821 Processor 822 Machine-readable storage medium 831 Processor 832 Machine-readable storage medium

Claims

1. When it is decided to start weighted prediction for the current block, for the current block, obtaining a weighted prediction angle for the current block; For each pixel location of the current block, determining a peripheral matching position indicated by the pixel position from among peripheral positions outside the current block based on a weighted prediction angle of the current block; determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations; determining an associated weight value for the pixel location based on a target weight value for the pixel location; determining a first predicted value for the pixel location based on a first prediction mode of the current block; determining a second predicted value for the pixel location based on a second prediction mode of the current block; determining a weighted prediction for the pixel location based on the first prediction, the target weight, the second prediction, and the associated weight; determining a weighted prediction value for the current block based on weighted prediction values ​​of all pixel positions of the current block; the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode; The step of determining a first predicted value for the pixel location based on a first prediction mode of the current block comprises: A step of analyzing first flag information from the encoded bitstream of the current block, and when the first flag information indicates that a differential motion vector is not superimposed on a first original motion vector, selecting one motion information candidate from a constructed motion information candidate list as a first target motion information of the current block, wherein the motion information candidate list includes at least two motion information candidates; determining the first predicted value for the pixel location based on the first target motion information; The step of determining a second predicted value for the pixel location based on a second prediction mode of the current block includes: analyzing second flag information from the encoded bitstream of the current block, and when the second flag information indicates that a differential motion vector is not superimposed on a second original motion vector, selecting another motion information candidate from the motion information candidate list as second target motion information of the current block; determining the second predicted value for the pixel position based on the second target motion information.

2. prior to determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations; The method further includes the step of setting a reference weight value at a peripheral position outside the current block; However, the reference weight values ​​of the peripheral positions outside the current block are preset or set based on weight setting parameters, and the weight setting parameters include a weight conversion rate and a start position of the weight conversion.

3. 3. The method of claim 2, wherein the starting position of the weighted transformation is determined by at least one parameter of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block.

4. The number of peripheral positions outside the current block is determined based on a size of the current block and / or a weighted prediction angle of the current block; The method according to claim 2 , wherein the reference weight values ​​of the peripheral positions outside the current block are monotonically increasing or monotonically decreasing.

5. The reference weight value of the peripheral position outside the current block includes a reference weight value of a target area, a reference weight value of a first adjacent area of ​​the target area, and a reference weight value of a second adjacent area of ​​the target area; However, all of the reference weight values ​​of the first adjacent region are the second reference weight value, all of the reference weight values ​​of the second adjacent region are the third reference weight value, and 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; The method of claim 2 , wherein if the target region includes at least two reference weight values, the at least two reference weight values ​​of the target region are monotonically increasing.

6. The weighted prediction angle of the current block is a horizontal angle, or The weighted prediction angle of the current block is a vertical angle, or 6. The method according to claim 1, wherein the absolute value of the gradient of the weighted prediction angle for the current block is the nth power of 2, where n is an integer.

7. the peripheral locations outside the current block include integer pixel locations, or sub-pixel locations, or integer pixel locations and sub-pixel locations; 6. The method according to claim 1, wherein the peripheral positions outside the current block include peripheral positions adjacent to the upper side of the outside of the current block, or peripheral positions adjacent to the left side of the outside of the current block.

8. determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations, When the neighboring matching position is an integer pixel position and a reference weight value is set for the integer pixel position, determining a target weight value for the pixel position based on the reference weight value for the integer pixel position; or The method according to any one of claims 1 to 5, further comprising, when the surrounding matching position is a sub-pixel position and a reference weight value is set for the sub-pixel position, determining a target weight value for the pixel position based on the reference weight value for the sub-pixel position.

9. The step of determining a first predicted value for the pixel position based on a first prediction mode of the current block further comprises: selecting one motion information candidate from the motion information candidate list as the first original motion information of the current block when the first flag information indicates that a differential motion vector is superimposed on a first original motion vector; determining first target motion information for the current block based on the first original motion information; determining the first predicted value for the pixel location based on the first target motion information; The step of determining a second predicted value for the pixel location based on a second prediction mode of the current block further comprises: selecting another candidate motion information from the motion information candidate list as the second original motion information of the current block when the second flag information indicates that a differential motion vector is superimposed on a second original motion vector; determining second target motion information for the current block based on the second original motion information; determining the second predicted value for the pixel location based on the second target motion information; The first original motion information includes a first original motion vector, and the first target motion information includes a first target motion vector, and the step of determining the first target motion information of the current block based on the first original motion information includes: obtaining a differential motion vector corresponding to the first original motion vector; determining the first target motion vector based on a differential motion vector corresponding to the first original motion vector and the first original 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, and determining second target motion information of the current block based on the second original motion information includes: obtaining a differential motion vector corresponding to the second original motion vector; 2. The method of claim 1, further comprising: determining the second target motion vector based on a differential motion vector corresponding to the second original motion vector and the second original motion vector.

10. When the method is applied to the decoding side, The step of obtaining a differential motion vector corresponding to the first original motion vector comprises: analyzing direction information and amplitude information of a differential motion vector corresponding to the first original motion vector in the encoded bitstream of the current block; determining a differential motion vector corresponding to the first original motion vector based on direction information and amplitude information of a differential motion vector corresponding to the first original motion vector; The step of obtaining a differential motion vector corresponding to the second original motion vector comprises: analyzing direction information and amplitude information of a differential motion vector corresponding to the second original motion vector in the encoded bitstream of the current block; determining a differential motion vector corresponding to the second original motion vector based on direction information and amplitude information of a differential motion vector corresponding to the second original motion vector; The step of analyzing direction information and amplitude information of a differential motion vector corresponding to the first original motion vector or the second original motion vector from the encoded bitstream of the current block includes: analyzing flag information from the encoded bitstream of the current block; and analyzing direction information and amplitude information of a differential motion vector corresponding to the first original motion vector or the second original motion vector from the encoded bitstream of the current block when the flag information indicates that a differential motion vector is to be superimposed on the original motion vector.

11. A module for performing, when it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle for the current block for the current block; a module for performing, for each pixel position of the current block, determining a peripheral matching position indicated by the pixel position from among peripheral positions outside the current block according to a weighted prediction angle of the current block; a module for performing: determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations; and determining an associated weight value for the pixel location based on the target weight value for the pixel location; a module for performing, for each pixel location of the current block, determining a first predicted value for the pixel location based on a first prediction mode of the current block, determining a second predicted value for the pixel location based on a second prediction mode of the current block, and determining a weighted predicted value for the pixel location based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; Specifically, when determining a first predicted value of the pixel position based on the first prediction mode of the current block, Analyze first flag information from the encoded bitstream of the current block, and if the first flag information indicates that a differential motion vector is not superimposed on a first original motion vector, select one motion information candidate from the constructed motion information candidate list as first target motion information of the current block; is used to determine the first predicted value of the pixel location based on the first target motion information, the motion information candidate list including at least two motion information candidates; Specifically, when determining a second predicted value of the pixel position based on the second prediction mode of the current block, Analyze second flag information from the encoded bitstream of the current block, and if the second flag information indicates that a differential motion vector is not superimposed on a second original motion vector, select another motion information candidate from the motion information candidate list as second target motion information of the current block; a module adapted to determine the second predicted value for the pixel location based on the second target motion information; and a module for performing determining a weighted prediction value of the current block based on weighted prediction values ​​of all pixel positions of the current block; An encoding device, wherein the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode.

12. A module for performing, when it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle for the current block for the current block; a module for performing, for each pixel position of the current block, determining a peripheral matching position indicated by the pixel position from among peripheral positions outside the current block according to a weighted prediction angle of the current block; a module for performing: determining a target weight value for the pixel location based on reference weight values ​​associated with the neighboring matching locations; and determining an associated weight value for the pixel location based on the target weight value for the pixel location; a module for performing, for each pixel location of the current block, determining a first predicted value for the pixel location based on a first prediction mode of the current block, determining a second predicted value for the pixel location based on a second prediction mode of the current block, and determining a weighted predicted value for the pixel location based on the first predicted value, the target weight value, the second predicted value, and the associated weight value; Specifically, when determining a first predicted value of the pixel position based on the first prediction mode of the current block, Analyze first flag information from the encoded bitstream of the current block, and if the first flag information indicates that a differential motion vector is not superimposed on a first original motion vector, select one motion information candidate from the constructed motion information candidate list as first target motion information of the current block; is used to determine the first predicted value of the pixel location based on the first target motion information, the motion information candidate list including at least two motion information candidates; Specifically, when determining a second predicted value of the pixel position based on the second prediction mode of the current block, Analyze second flag information from the encoded bitstream of the current block, and if the second flag information indicates that a differential motion vector is not superimposed on a second original motion vector, select another motion information candidate from the motion information candidate list as second target motion information of the current block; a module adapted to determine the second predicted value for the pixel location based on the second target motion information; and a module for performing determining a weighted prediction value of the current block based on weighted prediction values ​​of all pixel positions of the current block; A decoding device, wherein the first prediction mode is an inter-frame prediction mode, and the second prediction mode is an inter-frame prediction mode.

13. A method for implementing the present invention includes: providing a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor; and executing the machine-executable instructions to perform the present invention. A decoding device for implementing the method according to any one of claims 1 to 10.

14. A method for implementing the present invention includes: providing a processor and a machine-readable storage medium having machine-executable instructions stored thereon that are executable by the processor; and executing the machine-executable instructions to perform the present invention. Coding device for implementing the method according to any one of claims 1 to 10.

15. A machine-readable recording medium having stored thereon machine-executable instructions executable by a processor, the processor executing the machine-executable instructions to perform the method according to any one of claims 1 to 10. A machine-readable recording medium comprising:

Citation Information

Patent Citations

  • JPP7375224B