Encoding and decoding method, apparatus and device therefor
By setting weighted prediction angles and parameters for video blocks, the method addresses the challenge of predicting non-rectangular objects with mismatched motions, enhancing prediction accuracy and encoding performance in video encoding methods.
Patent Information
- Application Number
- JP2024118030
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2020-06-30
- Filing Date
- 2024-07-23
- Publication Date
- 2024-10-16
- Estimated Expiration
- 2041-06-24
AI Technical Summary
Existing video encoding methods face challenges in accurately predicting non-rectangular objects due to mismatched motions, leading to low prediction effectiveness and poor encoding performance, especially when objects in the foreground and background have different motions.
The method involves setting weighted prediction angles and parameters for current blocks, determining reference weight values at peripheral positions, and calculating target weight values for each pixel position to improve prediction accuracy and encoding performance.
This approach enhances prediction accuracy and encoding performance by setting rational weight values for each pixel, bringing the predicted values closer to the original pixels, thus improving overall video encoding efficiency.
Smart Images

Figure 2024147771000001_ABST
Abstract
Description
[Technical field]
[0001] (CROSS REFERENCE TO RELATED APPLICATIONS) This patent application claims priority to a Chinese patent application filed on June 30, 2020, with application number 202010622752.7, entitled "Encoding and Decoding Method, Apparatus and Apparatus Thereof," the entire contents of which are incorporated herein by reference.
[0002] The present invention relates to the field of encoding / decoding technology, and in particular to an encoding / decoding method, device and equipment thereof. [Background technology]
[0003] In order to achieve the purpose of space saving, the video image is transmitted after being encoded, and the video encoding may include processes such as prediction, transformation, quantization, entropy encoding, filtering, etc. Prediction may include intra prediction and inter prediction. Inter prediction is to predict a current pixel using pixels of adjacent encoded images by utilizing the correlation of the video temporal domain to achieve the purpose of effectively removing redundancy in the video temporal domain. Intra prediction is to predict a current pixel using pixels of encoded blocks of a current frame image by utilizing the correlation of the video spatial domain to achieve the purpose of removing redundancy in the video spatial domain.
[0004] In related art, the current block is rectangular, but the edge of the actual object is often not rectangular, so there are often two different objects (such as an object in the foreground and a background) at the edge of the object. Based on this, when the movements of the two objects do not match, the rectangular division cannot divide the two objects well, and even if the current block is divided into two non-rectangular sub-blocks and the current block is predicted by the two non-rectangular sub-blocks, there are currently problems such as low prediction effect and poor coding performance. Summary of the Invention
[0005] In view of this, the present invention provides an encoding / decoding method, apparatus and device thereof, which improves prediction accuracy.
[0006] The present invention provides an encoding / decoding method, the method comprising:
[0007] When it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle and a weight setting parameter for the current block;
[0008] setting a reference weight value for a peripheral position outside the current block based on the weight setting parameter;
[0009] For each pixel position of the current block, determining a surrounding matching position to which the pixel position points from surrounding positions outside the current block based on the weighted prediction angle, 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;
[0010] obtaining a motion information candidate list including at least one candidate motion information; and obtaining first target motion information and second target motion information of the current block based on the motion information candidate list;
[0011] determining a first predicted value for the pixel location based on first target motion information of the current block, determining a second predicted value for the pixel location based on second target motion information 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;
[0012] determining a weighted prediction value for the current block based on the weighted prediction values of all pixel positions of the current block.
[0013] The present invention provides an encoding / decoding device, the device including, when determining to start weighted prediction for a current block, an acquisition module for acquiring a weighted prediction angle and a weight setting parameter of the current block, a setting module for setting a reference weight value at a peripheral position outside the current block based on the weight setting parameter, a determination module for, for each pixel position of the current block, determining a peripheral matching position to which the pixel position points from the peripheral position outside the current block based on the weighted prediction angle, and a decision module for determining a target weight value of the pixel position based on the reference weight value associated with the peripheral matching position, and determining an associated weight value of the pixel position based on the target weight value of the pixel position. and a determination module, wherein the acquisition module is further used to acquire a motion information candidate list including at least one candidate motion information, and acquire first target motion information and second target motion information of the current block based on the motion information candidate list, and the determination module is further used to determine a first predicted value for the pixel position based on the first target motion information of the current block, determine a second predicted value for the pixel position based on the second target motion information of the current block, determine a weighted predicted value for the pixel position based on the first predicted value, the target weight value, the second predicted value and the associated weight value, and determine a weighted predicted value of the current block based on the weighted predicted values of all pixel positions of the current block.
[0014] The present invention provides a decoding apparatus, comprising a processor and a machine-readable storage medium having stored thereon machine-executable instructions executable by said processor,
[0015] The processor executes the machine-executable instructions to:
[0016] When it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle and a weight setting parameter for the current block;
[0017] setting a reference weight value for a peripheral position outside the current block based on the weight setting parameter;
[0018] For each pixel position of the current block, determining a surrounding matching position to which the pixel position points from surrounding positions outside the current block based on the weighted prediction angle, 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;
[0019] obtaining a motion information candidate list including at least one candidate motion information; and obtaining first target motion information and second target motion information of the current block based on the motion information candidate list;
[0020] determining a first predicted value for the pixel location based on first target motion information of the current block, determining a second predicted value for the pixel location based on second target motion information 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;
[0021] determining a weighted prediction value for the current block based on the weighted prediction values of all pixel positions of the current block.
[0022] The present invention provides an encoding apparatus, comprising a processor and a machine-readable storage medium having stored thereon machine-executable instructions executable by said processor,
[0023] The processor executes the machine-executable instructions to:
[0024] When it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle and a weight setting parameter for the current block;
[0025] setting a reference weight value for a peripheral position outside the current block based on the weight setting parameter;
[0026] For each pixel position of the current block, determining a surrounding matching position to which the pixel position points from surrounding positions outside the current block based on the weighted prediction angle, 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;
[0027] obtaining a motion information candidate list including at least one candidate motion information; and obtaining first target motion information and second target motion information of the current block based on the motion information candidate list;
[0028] determining a first predicted value for the pixel location based on first target motion information of the current block, determining a second predicted value for the pixel location based on second target motion information 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;
[0029] determining a weighted prediction value for the current block based on the weighted prediction values of all pixel positions of the current block.
[0030] It can be seen from the above technical solution that the embodiment of the present invention proposes an effective method for setting weight values, so that a reasonable target weight value can be set for each pixel position of the current block, thereby improving prediction accuracy, improving prediction performance, improving coding performance, so that the predicted value of the current block can be closer to the original pixels, and improving coding performance. [Brief description of the drawings]
[0031] [Figure 1] FIG. 1 is a schematic diagram of a video encoding framework. [Figure 2A]FIG. 1 is a schematic diagram of weighted prediction. [Figure 2B] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2C] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2D] FIG. 1 is a schematic diagram of weighted prediction. [Figure 2E] FIG. 1 is a schematic diagram of weighted prediction. [Diagram 3] 4 is a flowchart of an encoding / decoding method in one embodiment of the present invention. [Figure 4A] FIG. 2 is a schematic diagram of peripheral locations outside the current block. [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. [Diagram 5] 4 is a flowchart of an encoding / decoding method in one embodiment of the present invention. [Figure 6] FIG. 2 is a schematic diagram of a weighted prediction angle in one embodiment of the present invention; [Figure 7] FIG. 2 is a schematic diagram of reference weight values of four kinds of weight conversion ratios in an embodiment of the present invention; [Figure 8A] FIG. 2 is a schematic diagram of weighted prediction angles and angle partitions in one embodiment of the present invention. [Figure 8B] FIG. 2 is a schematic diagram of weighted prediction angles and angle partitions in one embodiment of the present invention. [Figure 8C] FIG. 2 is a schematic diagram of weighted prediction angles and angle partitions in one embodiment of the present invention. [Figure 9A] FIG. 2 is a schematic diagram of neighboring blocks of a current block in an embodiment of the present invention; [Figure 9B] FIG. 2 is a schematic diagram of a target position of a current block in one embodiment of the present invention; [Figure 9C] FIG. 2 is a schematic diagram of a target position of a current block in one embodiment of the present invention; [Figure 9D]FIG. 2 is a schematic diagram of a target position of a current block in one embodiment of the present invention; [Figure 10A] FIG. 1 is a schematic diagram illustrating the configuration of an encoding / decoding device according to one embodiment of the present invention. [Figure 10B] FIG. 1 is a schematic diagram illustrating the configuration of an encoding / decoding device according to one embodiment of the present invention. [Figure 10C] FIG. 2 is a hardware configuration diagram of a decoding device according to an embodiment of the present invention. [Figure 10D] FIG. 2 is a hardware configuration diagram of an encoding device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0032] The terms used in the embodiments of the present invention are only for describing the particular embodiment and are not intended to limit the present invention. The singular forms "a", "the" and "the" used in the embodiments and claims of the present invention are intended to include the plural forms unless the context clearly indicates otherwise. The term "and / or" used herein should also be understood to mean any or all possible combinations including one or more of the associated listed items. Although the embodiments of the present invention may employ terms such as first, second, third, etc. to describe various information, it should be understood that such information should not be limited to these terms. These terms are used only to distinguish the same type of information from each other. 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, depending on the context, without departing from the scope of the embodiments of the present invention. Furthermore, the term "if" used may be interpreted as "when...", or "when...", or "responsive to a determination".
[0033] The embodiments of the present invention propose an encoding / decoding method, an apparatus and an apparatus thereof, which may relate to the following concepts.
[0034] These are intra prediction, inter prediction, and IBC (intra block copy) prediction.
[0035] Intra prediction is to use the coded block to perform prediction based on the correlation of the video space domain, so as to achieve the purpose of removing the redundancy of the video space domain. Intra prediction specifies a number of prediction modes, each of which corresponds to one texture direction (except DC mode), for example, if the image texture is arranged horizontally, the horizontal prediction mode can better predict the image information.
[0036] Inter prediction is based on the correlation in the video time domain. Because a video sequence contains relatively strong time domain correlation, the pixels of a current image are predicted using the pixels of adjacent encoded images, so as to achieve the purpose of effectively eliminating the redundancy in the video time domain.
[0037] Intra block copy (IBC) allows reference to the same frame, and reference data of a current block originates from the same frame, and may also be called intra block duplication. In the intra block copy technique, a predicted value of a current block can be obtained using a block vector of the current block. For example, based on the characteristic that there are many textures that repeatedly occur in the same frame in a screen content, when a predicted value of a current block is obtained using a block vector, the compression efficiency of a screen content sequence can be improved.
[0038] Predicted pixel (Prediction Signal): A predicted pixel is a pixel value derived from a pixel that has already been coded and decoded. A residual is obtained from the difference between the original pixel and the predicted pixel, and the residual is then transformed, quantized, and coefficient coded. An inter-predicted pixel is a pixel value that the current block derives from a reference frame. 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 residual energy obtained by subtracting the two will be, and the higher the coding compression performance will be.
[0039] Motion Vector (MV): In inter prediction, a motion vector can be used to represent the relative displacement between a current block of a current frame and a reference block of a reference frame. Each divided block has a corresponding motion vector to be transmitted to the decoding side, and if the motion vector of each block is coded and transmitted independently, a lot of bits will be consumed, especially when there are many small-sized blocks. In order to reduce the number of bits for coding the motion vector, the spatial correlation between adjacent blocks can be utilized to predict the motion vector of the current block based on the motion vector of the adjacent coded block, and the prediction difference can be coded, thus effectively reducing the number of bits representing the motion vector. When coding the motion vector of the current block, the motion vector of the current block can be predicted first using the motion vector of the adjacent coded block, and the difference value (MVD, Motion Vector Difference) between the predicted value of the motion vector (MVP, Motion Vector Prediction) and the true estimated value of the motion vector can be coded.
[0040] Motion Information: A motion vector represents the positional displacement between a current block and a reference block, so in order to accurately obtain information pointing to a block, in addition to the motion vector, index information of a reference frame image is required, which indicates which reference frame image the current block uses. In video coding technology, a reference frame image list can usually be established for the current frame, and the reference frame image index information indicates which reference frame image in the reference frame image list the current block adopts.
[0041] Furthermore, since many coding techniques support multiple reference frame image lists, one index value may be used to indicate which reference frame image list is used, and this index value may be called a reference direction. As described above, in video coding techniques, information related to motion, such as a motion vector, a reference frame index, and a reference direction, may be collectively called motion information.
[0042] Rate-Distortion Optimized: There are two indices to evaluate 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 image quality of the reconstructed image. During mode selection, the discriminant is essentially a comprehensive evaluation of both. For example, the cost corresponding to the mode is: J(mode)=D+λ*R, where D represents distortion, which can usually be measured using the SSE index, where SSE is the root mean square sum of the difference between the reconstructed image block and the original image, λ is the Lagrange multiplier, and R is the actual number of bits required to code the image block in the mode, including the sum of bits required to code mode information, motion information, and residuals. During mode selection, if the coding mode is compared and determined using the RDO principle, the optimal coding performance can usually be guaranteed.
[0043] Video encoding framework: Referring to FIG. 1, the encoding side processing flow of the embodiment of the present invention can be realized using a video encoding framework, and the schematic diagram of the video decoding framework is similar to FIG. 1, and its description is omitted here, and the decoding side processing flow of the embodiment of the present invention can be realized using a video decoding framework. Exemplarily, the video encoding framework and the video decoding framework may include modules such as intra prediction / inter 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 encoding side processing flow can be realized by the cooperation between these modules, and on the decoding side, the decoding side processing flow can be realized by the cooperation between these modules.
[0044] In the related art, the current block may be rectangular, but the edge of an actual object is often not rectangular, so that there are often two different objects (such as an object in the foreground and a background) at the edge of the object. If the movements of the two objects are not consistent, the rectangular division cannot divide the two objects well, so that the current block can be divided into two non-rectangular sub-blocks, and the two non-rectangular sub-blocks can be weighted predicted. Exemplarily, the weighted prediction is to perform a weighting operation using multiple predictive values, thereby obtaining a final predicted value, and the weighted prediction may include inter and intra combined weighted prediction (Combined inter / intra prediction, CIIP), inter and inter combined weighted prediction, intra and intra combined weighted prediction, etc. Regarding the weight value of the combined weighted prediction, the same weight value may be set to different pixel positions of the current block, or different weight values may be set to different pixel positions of the current block.
[0045] Referring to FIG. 2A, there is a schematic diagram of inter-intra joint weighted prediction.
[0046] The CIIP prediction block is obtained by weighting the intra prediction block (i.e., the intra prediction mode is adopted to obtain the intra prediction value of the pixel position) and the inter prediction block (i.e., the inter prediction mode is adopted to obtain the inter prediction value of the pixel position), and the weight ratio of the intra prediction value and the inter prediction value adopted at each pixel position is 1:1. For example, for each pixel position, the intra prediction value of the pixel position and the inter prediction value of the pixel position are weighted to obtain the combined prediction value of the pixel position, and finally the combined prediction value of each pixel position forms the CIIP prediction block.
[0047] Referring to FIG. 2B, there is shown a schematic diagram of inter-triangular partition weighted prediction (Triangular Partition Mode, TPM).
[0048] The TPM prediction block is obtained by combining an inter prediction block 1 (i.e., an inter prediction value of a pixel position is obtained using an inter prediction mode 1) and an inter prediction block 2 (i.e., an inter prediction value of a pixel position is obtained using an inter prediction mode 2). The TPM prediction block may be divided into two regions, one region may be an inter region 1 and the other region may be an inter region 2, and the two inter regions of the TPM prediction block may be distributed as a non-rectangle, and the angle of the dashed boundary line may be both a main diagonal or a sub-diagonal.
[0049] For each pixel position in the inter region 1, a predicted value of the pixel position is determined mainly based on the inter prediction value of the inter prediction block 1. For example, when the inter prediction value of the inter prediction block 1 of the pixel position and the inter prediction value of the inter prediction block 2 of the pixel position are weighted, the weight value of the inter prediction value of the inter prediction block 1 is relatively large, and the weight value of the inter prediction value of the inter prediction block 2 is relatively small (even 0), to obtain a combined predicted value of the pixel position. For each pixel position in the inter region 2, a predicted value of the pixel position is determined mainly based on the inter prediction value of the inter prediction block 2. For example, when the inter prediction value of the inter prediction block 1 of the pixel position and the inter prediction value of the inter prediction block 2 of the pixel position are weighted, the weight value of the inter prediction value of the inter prediction block 2 of the pixel position is relatively large, and the weight value of the inter prediction value of the inter prediction block 1 is relatively small (even 0), to obtain a combined predicted value of the pixel position.
[0050] 2C, which is a schematic diagram of inter-intra joint triangular weighted prediction, by modifying inter-intra joint weighted prediction, the inter region and intra region of the CIIP prediction block exhibit the weight distribution of triangular weighted split prediction.
[0051] The CIIP prediction block is obtained by combining an intra prediction block (i.e., adopting an intra prediction mode to obtain an intra prediction value at a pixel position) and an inter prediction block (i.e., adopting an inter prediction mode to obtain an inter prediction value at a pixel position). The CIIP prediction block can be divided into two regions, one region can be an intra region, the other region can be an inter region, the inter-intra of the CIIP prediction block can be distributed in a non-rectangular shape, the dashed boundary region can adopt a mixed weighting method or can be directly divided, and the angle of the dashed boundary can be both a main diagonal or a sub-diagonal, and the positions of the intra region and the inter region are variable.
[0052] For each pixel position of the intra region, determine the predicted value of the pixel position mainly based on the intra prediction value, for example, when the intra prediction value of the pixel position and the inter prediction value of the pixel position are weighted, the weight value of the intra prediction value is relatively large and the weight value of the inter prediction value is relatively small, and obtain the combined predicted value of the pixel position.For each pixel position of the inter region, determine the predicted value of the pixel position mainly based on the inter prediction value, for example, when the intra prediction value of the pixel position and the inter prediction value of the pixel position are weighted, the weight value of the inter prediction value is relatively large and the weight value of the intra prediction value is relatively small, and obtain the combined predicted value of the pixel position.
[0053] Referring to FIG. 2D, there is shown a schematic diagram of a geometric partitioning mode for inter blocks (GEO), in which a GEO mode is used to divide an inter prediction block into two sub-blocks using one partition line. Unlike the TPM mode, the GEO mode can adopt more partition directions, and the weighted prediction process of the GEO mode is similar to that of the TPM mode.
[0054] The GEO prediction block is obtained by combining an inter prediction block 1 (i.e., an inter prediction value at a pixel position is obtained by adopting an inter prediction mode 1) and an inter prediction block 2 (i.e., an inter prediction value at a pixel position is obtained by adopting an inter prediction mode 2). The GEO prediction block may be divided into two regions, one of which may be an inter region 1 and the other may be an inter region 2.
[0055] For each pixel position in the inter region 1, a predicted value of the pixel position is determined mainly based on the inter predicted value of the inter predicted block 1. For example, when the inter predicted value of the inter predicted block 1 at the pixel position and the inter predicted value of the inter predicted block 2 at the pixel position are weighted, the weight value of the inter predicted value of the inter predicted block 1 is relatively large, and the weight value of the inter predicted value of the inter predicted block 2 is relatively small. For each pixel position in the inter region 2, a predicted value of the pixel position is determined mainly based on the inter predicted value of the inter predicted block 2. For example, when the inter predicted value of the inter predicted block 1 at the pixel position and the inter predicted value of the inter predicted block 2 at the pixel position are weighted, the weight value of the inter predicted value of the inter predicted block 2 is relatively large, and the weight value of the inter predicted value of the inter predicted block 1 is relatively small.
[0056] Illustratively, the weight value setting of the GEO prediction block is related to the distance of the pixel position from the division line, and referring to FIG. 2E, pixel position A, pixel position B, and pixel position C are located on the lower right side of the division line, and pixel position D, pixel position E, and pixel position F are located on the upper left side of the division line. For pixel position A, pixel position B, and pixel position C, the weight values of inter region 2 are ordered as B≧A≧C, and the weight values of inter region 1 are ordered as C≧A≧B. For pixel position D, pixel position E, and pixel position F, the weight values of inter region 1 are ordered as D≧F≧E, and the weight values of inter region 2 are ordered as E≧F≧D. The above method needs to calculate the distance between the pixel position and the division line, and then determine the weight value of the pixel position.
[0057] In the above various cases, in order to realize weighted prediction, it is necessary to determine the weight value of each pixel position of the current block, and then weighted prediction is performed for the pixel position according to the weight value of the pixel position.However, in the related art, there is no effective method for setting the weight value, and the weight value cannot be set reasonably, so that the prediction effect is low, the coding performance is poor, and other problems are caused.
[0058] Based on the above discovery, an embodiment of the present invention proposes a weight value derivation method, which can determine a target weight value for each pixel position of the current block based on the reference weight values of the surrounding positions outside the current block, and can set a reasonable target weight value for each pixel position, thereby improving prediction accuracy, improving prediction performance, improving coding performance, and making the predicted value closer to the original pixel.
[0059] Hereinafter, the encoding / decoding method according to the embodiment of the present invention will be described in detail with reference to some specific embodiments.
[0060] Example 1: Referring to Figure 3, it is a schematic flowchart of an encoding / decoding method, which may be applied to a decoding side (which may also be called a video decoder) or an encoding side (which may also be called a video encoder), and the method may include:
[0061] In step 301, if it is determined to start weighted prediction for a current block, obtain a weighted prediction angle and a weight setting parameter of the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion. The start position of weight conversion may be 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.
[0062] For example, when a current block needs to be predicted, the decoding side or the encoding side can 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 according to the embodiment of the present invention is adopted, that is, step 301 and the subsequent steps are performed. If weighted prediction is not started for the current block, the implementation method is not limited to the embodiment of the present invention.
[0063] For example, when it is determined to start weighted prediction for the current block, a weighted prediction angle of the current block, a weighted prediction position of the current block, and a weighted transformation rate of the current block can be obtained. Then, a start position of the weighted transformation of the current block can be determined based on at least one of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block. In this way, the weighted prediction angle of the current block, the weighted transformation rate of the current block, and the start position of the weighted transformation of the current block can be obtained.
[0064] In step 302, a reference weight value is set for a peripheral position outside the current block according to a weight setting parameter of the current block.
[0065] Exemplarily, the number of surrounding positions outside the current block may be determined based on the size of the current block and / or the weighted prediction angle of the current block, for example, determining the number M of surrounding positions outside the current block based on the size of the current block and / or the weighted prediction angle of the current block, and setting reference weight values for the M surrounding positions based on the weight setting parameters of the current block.
[0066] Exemplarily, the reference weight values of the peripheral positions outside the current block may be monotonically increasing, or the reference weight values of the peripheral positions outside the current block may be monotonically decreasing, for example, the arrangement of the reference weight values of the peripheral positions outside the current block may be 00...0024688...88, or the arrangement of the reference weight values of the peripheral positions outside the current block may be 88...8864200...00.
[0067] Exemplarily, the peripheral position outside the current block may include an integer pixel position, or a sub-pixel position, or an integer pixel position and a sub-pixel position. The peripheral position outside the current block may include, but is not limited to, a peripheral position of a top row outside the current block, a peripheral position of a left column outside the current block, a peripheral position of a bottom row outside the current block, or a peripheral position of a right column outside the current block. Of course, the above are merely examples of peripheral positions and are not limited thereto.
[0068] 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.
[0069] Exemplarily, the reference weight values of the first adjacent region are all the first reference weight value, and the reference weight values of the second adjacent region monotonically increase. Or, the reference weight values of the first adjacent region are all the first reference weight value, and the reference weight values of the second adjacent region monotonically decrease. Or, the reference weight values of the first adjacent region are all the second reference weight value, and the reference weight values of the second adjacent region are all the third reference weight value, and the second reference weight value is different from the third reference weight value. Or, the reference weight values of the first adjacent region monotonically increase, and the reference weight values of the second adjacent region monotonically increase. Or, the reference weight values of the first adjacent region monotonically decrease, and the reference weight values of the second adjacent region monotonically decrease.
[0070] Illustratively, 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 monotonically increase or monotonically decrease.
[0071] In step 303, for each pixel position of the current block, determine a surrounding matching position to which the pixel position points from 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.
[0072] Exemplarily, the weighted prediction angle represents an angular direction of a pixel position inside the current block, for example, based on a weighted prediction angle, the angular direction corresponding to the weighted prediction angle points to an external peripheral position of the current block. Based on this, 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 peripheral matching position of the pixel position is determined from the external peripheral position of the current block based on the angular direction.
[0073] For each pixel position of the current block, determine the surrounding matching positions indicated by the pixel position, and then determine the target weight value of the pixel position based on the reference weight value associated with the surrounding matching positions, for example, determine the reference weight value associated with the surrounding matching positions as the target weight value of the pixel position. Then, determine the associated weight value of the pixel position based on the target weight value of the pixel position, for example, the sum of the target weight value of each pixel position and the associated weight value may be a fixed preset value, and therefore the associated weight value may be the difference between the preset value and the target weight value. Suppose the preset value is 8 and the target weight value of the pixel position is 0, the associated weight value of the pixel position is 8, and if the target weight value of the pixel position is 1, the associated weight value of the pixel position is 7, and by this analogy, the sum of the target weight value and the associated weight value may be 8.
[0074] In step 304, a motion information candidate list including at least one candidate motion information is obtained, and a first target motion information and a second target motion information of a current block are obtained based on the motion information candidate list.
[0075] In step 305, for each pixel position of the current block, a first predicted value for the pixel position is determined based on first target motion information of the current block, a second predicted value for the pixel position is determined based on second target motion information 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 the associated weight value.
[0076] Exemplarily, assuming that the target weight value is a weight value corresponding to the first target motion information and the associated weight value is a weight value corresponding to the second target motion information, the weighted predicted value of the pixel position may be (the first predicted value of the pixel position*the target weight value of the pixel position+the second predicted value of the pixel position*the associated weight value of the pixel position) / a fixed preset value. Alternatively, assuming that the target weight value is a weight value corresponding to the second target motion information and the associated weight value is a weight value corresponding to the first target motion information, the weighted predicted value of the pixel position may be (the second predicted value of the pixel position*the target weight value of the pixel position+the first predicted value of the pixel position*the associated weight value of the pixel position) / a fixed preset value.
[0077] In step 306, a weighted prediction value for the current block is determined based on the weighted prediction values of all pixel locations of the current block.
[0078] For example, the weighted prediction value of the current block is composed of the weighted prediction values of all pixel positions of the current block.
[0079] It can be seen from the above technical solution that the embodiment of the present invention proposes an effective method for setting weight values, so that a reasonable target weight value can be set for each pixel position of the current block, thereby improving prediction accuracy, improving prediction performance, improving coding performance, so that the predicted value of the current block can be closer to the original pixels, and improving coding performance.
[0080] Embodiment 2: The embodiment of the present invention proposes another encoding-decoding method, which may be applied to the encoding side, and the method includes:
[0081] In step a1, if it is determined to start weighted prediction for the current block, the encoding side obtains the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation rate of the current block. Illustratively, the encoding side determines whether to start weighted prediction for the current block, and if so, executes step a1 and subsequent steps; otherwise, the present invention is not limited in the processing manner.
[0082] In one possible embodiment, if the current block satisfies the condition for starting weighted prediction, it is determined to start weighted prediction for the current block. If the current block does not satisfy the condition for starting weighted prediction, it is determined not to start weighted prediction for the current block. For example, it is determined whether the feature information of the current block satisfies a certain condition. If so, it is determined to start weighted prediction for the current block, and if not, it is determined not to start weighted prediction for the current block. The feature information includes, but is not limited to, one or any combination of the frame type of the current frame in which the current block is located, the size information of the current block, and switch control information. The switch control information may include, but is not limited to, sequence level (SPS, SH) switch control information, or picture level (PPS: Picture Parameter Set, PH: Picture Header) switch control information, or slice level (Slice, Tile, Patch), or largest coding unit level (LCU: Largest Coding Unit, CTU: Coding Tree Unit), or block level (CU: Coding Unit, PU: Prediction Unit, TU: Transform Units) switch control information.
[0083] For example, when the feature information is the frame type of the current frame in which the current block is located, the frame type of the current frame in which the current block is located satisfying a particular condition may include, but is not limited to, determining that the frame type satisfies a particular condition if the frame type of the current frame in which the current block is located is a B frame, or determining that the frame type satisfies a particular condition if the frame type of the current frame in which the current block is located is an I frame.
[0084] For example, when the feature information is size information of the current block, for example, the width and height of the current block, the size information satisfies a certain condition, including, but not limited to, determining that the size information of the current block satisfies the certain condition when the width is equal to or greater than a first value and the height is equal to or greater than a second value, or determining that the size information of the current block satisfies the certain condition when the width is equal to or greater than a third value, the height is equal to or greater than a fourth value, the width is equal to or less than a fifth value, and the height is equal to or less than a sixth value, or determining that the size information of the current block satisfies the certain condition when the product of the width and the height is equal to or greater than a seventh value. The above values may be empirically set, and may be, for example, 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. As described above, when the width is equal to or greater than 8 and the height is equal to or greater than 8, it is determined that the size information of the current block satisfies the certain condition. Alternatively, it is determined that the size information of the current block satisfies the specific condition if the width is 8 or more, the height is 8 or more, the width is 64 or less, and the height is 64 or less. Alternatively, it is determined that the size information of the current block satisfies the specific condition if the product of the width and height is 64 or more.
[0085] For example, when the feature information is size information of the current block, such as the width and height of the current block, the size information of the current block satisfying a certain condition may include, but is not limited to, that the width is greater than or equal to a and less than or equal to b, and that the height is greater than or equal to a and less than or equal to b. a may be less than or equal to 16, and b may be greater than or equal to 16. For example, a is equal to 8, and b is equal to 64, or b is equal to 32.
[0086] For example, when the feature information is switch control information, the switch control information satisfying a particular condition may include, but is not limited to, determining that the switch control information satisfies the particular condition if the switch control information allows the current block to initiate weighted prediction.
[0087] For example, if the feature 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 can be determined that the feature information of the current block satisfies a specific condition if the frame type meets a specific condition and the size information meets a specific condition. Alternatively, if the feature information is the frame type of the current frame in which the current block is located and the switch control information, it can be determined that the feature information of the current block meets a specific condition if the frame type meets a specific condition and the switch control information meets a specific condition. Alternatively, if the feature information is the size information of the current block and the switch control information, it can be determined that the feature information of the current block meets a specific condition if the size information meets a specific condition and the switch control information meets a specific condition. Alternatively, if the feature information is the frame type of the current frame in which the current block is located, the size information of the current block, and the switch control information, it can be determined that the feature information of the current block meets a specific condition if the frame type meets a specific condition, the size information meets a specific condition, and the switch control information meets a specific condition.
[0088] In one possible embodiment, when it is decided to start weighted prediction for the current block, the encoding side can obtain the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation rate of the current block.
[0089] Exemplarily, the weighted prediction angle represents an angular direction of a pixel position inside a current block, and referring to FIG. 4A, a weighted prediction angle indicates an angular direction of a pixel position inside a current block (e.g., pixel position 1, pixel position 2, and pixel position 3), which points to a certain peripheral position outside the current block. Referring to FIG. 4B, a weighted prediction angle indicates an angular direction of a pixel position inside a current block (e.g., pixel position 2, pixel position 3, and pixel position 4), which points to a certain peripheral position outside the current block, based on another weighted prediction angle.
[0090] Exemplarily, the weighted prediction position (which may also be referred to as a distance parameter) is used to set a reference weight value of a peripheral position outside the current block. For example, referring to FIG. 4A or FIG. 4B, the range of peripheral positions outside the current block (i.e., the number of peripheral positions outside the current block) is determined based on parameters such as the weighted prediction angle of the current block and the size of the current block.
[0091] Then, the range of the surrounding positions is divided into N equal parts, and the value of N can be set arbitrarily, for example, 4, 6, 8, etc., and 8 will be taken as an example. The weighted prediction position is used to indicate which surrounding position outside the current block should be used as the starting position of the weight transformation of the current block, thereby setting the reference weight value of the surrounding position outside the current block based on the starting position of the weight transformation.
[0092] Referring to FIG. 4C, after dividing all the peripheral positions into eight equal parts, seven weighted prediction positions can be obtained. In addition, when the weighted prediction position is 0, it can be expressed that the peripheral position a0 (i.e., the peripheral position indicated by the dashed line 0, in actual application, the dashed line 0 does not exist, the dashed line 0 is an example for easy understanding, and the dashed lines 0 to 6 are used to divide all the peripheral positions into eight equal parts) is the starting position of the weighted transformation of the peripheral positions outside the current block. By analogy, when the weighted prediction position is 6, it can be expressed that the peripheral position a6 is the starting position of the weighted transformation of the peripheral positions outside the current block.
[0093] The value of N may be different for different weighted prediction angles; for example, for weighted prediction angle A, an N value 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, an N value of 8 represents that the range of peripheral positions determined based on weighted prediction angle B is divided into 8 equal parts.
[0094] For different weighted prediction angles, the value of N may be the same, and when the value of N is the same, the number of weighted prediction positions may be different, for example, for weighted prediction angle A, an N value of 8 represents that the range of peripheral positions determined based on weighted prediction angle A is divided into 8 equal parts, and for weighted prediction angle B, an N value of 8 represents that the range of peripheral positions determined based on weighted prediction angle B is divided into 8 equal parts, but the weighted prediction positions corresponding to weighted prediction angle A select a total of five positions, a1 to a5, and the weighted prediction positions corresponding to weighted prediction angle B select a total of seven positions, a0 to a6.
[0095] The above is an example of dividing the peripheral position range into N equal parts, and in actual applications, a non-uniform division method can also be adopted, for example, instead of dividing into N equal parts, the peripheral position range is divided into N parts, and there is no limitation thereto.
[0096] After all the surrounding positions are divided into eight equal parts, seven weighted prediction positions can be obtained, and in step a1, the encoding side may obtain one weighted prediction position from the seven weighted prediction positions, or may select some weighted prediction positions (for example, five weighted prediction positions) from the seven weighted prediction positions and obtain one weighted prediction position from the five weighted prediction positions.
[0097] Exemplarily, the weight conversion ratio represents a conversion ratio of the reference weight value of the peripheral position outside the current block, and is used to represent the change speed of the reference weight value, and the weight conversion ratio may be any number other than 0, for example, the weight conversion ratio may be -4, -2, -1, 1, 2, 4, 0.5, 0.75, 1.5, etc. When the absolute value of the weight conversion ratio is 1, that is, the weight conversion ratio is -1 or 1, it represents the change speed of the reference weight value is 1, and the reference weight value needs to go through values of 0, 1, 2, 3, 4, 5, 6, 7, 8, etc. from 0 to 8, and the reference weight value needs to go through values of 8, 7, 6, 5, 4, 3, 2, 1, 0, etc. from 8 to 0. When the absolute value of the weight conversion ratio is 2, that is, the weight conversion ratio is -2 or 2, it represents the change speed of the reference weight value is 2, and the reference weight value needs to go through values of 0, 2, 4, 6, 8, etc. from 0 to 8, and the reference weight value needs to go through values of 8, 6, 4, 2, 0, etc. from 8 to 0. When the absolute value of the weight conversion rate is 4, that is, when the weight conversion rate is -4 or 4, it represents that the change speed of the reference weight value is 4, and the reference weight value needs to go through values such as 0, 4, 8 from 0 to 8, and the reference weight value needs to go through values such as 8, 4, 0 from 8 to 0. When the absolute value of the weight conversion rate is 0.5, that is, when the weight conversion rate is -0.5 or 0.5, it represents that the change speed of the reference weight value is 0.5, and the reference weight value needs to go through values such as 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 from 0 to 8, and the reference weight value needs to go through values such as 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0 from 8 to 0. Of course, the above example is from 0 to 8, and 0 and 8 can be replaced with any number.
[0098] In step a2, the encoding side sets a reference weight value at a peripheral position outside the current block based on the weight transformation rate and the starting position of the weight transformation of the current block (the weight transformation rate and the starting position of the weight transformation may also be called weight setting parameters).
[0099] Exemplarily, the start position of the weighted transformation may be determined by at least one of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block, and therefore the start position of the weighted transformation of the current block may be determined based on at least one of the weighted prediction angle of the current block, the weighted prediction position of the current block, and the size of the current block. Then, the reference weight value is set at a peripheral position outside the current block based on the weighted transformation rate and the start position of the weighted transformation of the current block.
[0100] In step a3, for each pixel position of the current block, the encoding side determines the peripheral matching position that this pixel position points to from the peripheral position outside the current block according to the weighted prediction angle of the current block.For convenience of distinction, in this embodiment, the peripheral position that this pixel position points to outside the current block may be called the peripheral matching position of this pixel position.
[0101] 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 to which the pixel position points is determined from surrounding positions outside the current block based on the angular direction.
[0102] 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 thereto. Alternatively, the peripheral position outside the current block 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 thereto. Alternatively, the peripheral position outside the current block 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 thereto. Alternatively, the peripheral position outside the current block 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 thereto.
[0103] Of course, the above are only some examples of peripheral positions, and are not limited thereto, and in practical application, in addition to using peripheral positions outside the current block, internal positions of the current block may also be used, that is, internal positions of the current block may be used to replace peripheral positions outside the current block, for example, an internal position located at the n5th row inside the current block, where n5 may be 1, 2, 3, etc., or an internal position located at the n6th column inside the current block, where n6 may be 1, 2, 3, etc. Of course, the length of the internal position (i.e., a row located at the internal position in the current block) 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, it extends on both sides.
[0104] Of course, the internal position of the current block and the external peripheral positions of the current block can be used simultaneously.
[0105] When using the internal position of the current block, or 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 small blocks, one above and one below, according to the row in which the internal position is located, or into two small blocks, one left and one right, according to the column in which the internal position is located, and in this case, the two small blocks have the same weighted prediction angle and the same weighted prediction position.
[0106] For example, the outer peripheral position of the current block may be located between pixel positions, i.e., sub-pixel positions, and in this case, the outer peripheral position of the current block cannot be described simply as the xth row, but is described as a sub-pixel position row located between the xth row and the yth row.
[0107] For convenience of explanation, in the following embodiments, the peripheral position of the first row on the top side outside the current block or the peripheral position of the first column on the left side outside the current block is taken as an example, and the implementation methods for other peripheral positions are similar.
[0108] For example, regarding the range of peripheral positions outside the current block, a certain 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 pointed to by each pixel position inside the current block may be determined based on a weighted prediction angle, and the boundaries of the peripheral positions pointed to by all pixel positions may be the range of peripheral positions outside the current block, or there may be no restriction on this range of peripheral positions.
[0109] 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 thereto, or the peripheral locations outside the current block may include integer pixel locations and sub-pixel locations.
[0110] 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.
[0111] Referring to Figures 4A and 4B, one surrounding position corresponds to one integer pixel position, and referring to Figure 4D, two surrounding positions correspond to one integer pixel position, and the description of other cases is omitted in this embodiment.
[0112] In step a4, the encoding side determines a target weight value for the pixel position based on reference weight values associated with the surrounding matching positions.
[0113] For each pixel position in the current block, after determining the surrounding matching positions to which the pixel position points, the encoding side determines a reference weight value associated with the surrounding matching positions, and determines a target weight value for the pixel position based on the reference weight value associated with the surrounding matching positions, for example, determines the reference weight value associated with the surrounding matching positions as the target weight value for the pixel position.
[0114] In one possible embodiment, the encoding side determining a target weight value for the pixel position based on a reference weight value associated with a surrounding matching position may include cases 1 to 5, and in case 1, if the surrounding matching position is an integer pixel position and a reference weight value has already been set for the integer pixel position, the encoding side determines a target weight value for the pixel position based on the reference weight value for the integer pixel position.
[0115] In case 2, if the neighboring matching position is an integer pixel position and no reference weight value is set for the integer pixel position, the target weight value of the integer pixel position can be determined based on the reference weight value of the neighboring position of the integer 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 interpolation of the reference weight value of the neighboring position of the integer pixel position, and there is no restriction thereon.
[0116] In case 3, if the surrounding matching position is a sub-pixel position and a reference weight value has already been set for the sub-pixel position, the target weight value for the pixel position can be determined based on the reference weight value for the sub-pixel position.
[0117] In case 4, if the neighboring matching position is a sub-pixel position and no reference weight value is set for the sub-pixel position, the target weight value for the pixel position can be determined based on the reference weight value of the adjacent position of the sub-pixel position. For example, a round-up operation is performed on the reference weight value of the adjacent position to obtain the target weight value for the pixel position, or a round-down operation is performed on the reference weight value of the adjacent position to obtain the target weight value for the pixel position, or the target weight value for the pixel position can be determined based on the reference weight value of the adjacent position of the sub-pixel position, and there is no restriction thereon.
[0118] In case 5, a target weight value of the pixel position is determined based on multiple reference weight values associated with the surrounding matching positions, for example, when the surrounding matching positions are integer pixel positions or sub-pixel positions, reference weight values of multiple adjacent positions of the surrounding matching positions are obtained. If a reference weight value has already been set at the surrounding matching positions, a weighting calculation is performed based on the reference weight value of the surrounding matching positions and the reference weight values of the multiple adjacent positions to obtain a target weight value of the pixel position, and if a reference weight value has not been set at the surrounding matching positions, a weighting calculation is performed based on the reference weight values of the multiple adjacent positions to obtain a target weight value of the pixel position.
[0119] In step a5, the encoding side determines an associated weight value for the pixel position based on the target weight value for the pixel position.
[0120] Illustratively, for each pixel location, the sum of the target weight value for the pixel location and the associated weight value for the pixel location may be a fixed preset numerical value, i.e., the associated weight value may be the difference between the preset numerical value and the target weight value. On this basis, assuming the preset numerical value is 8 and the target weight value for the pixel location is 2, then the associated weight value for the pixel location is 6.
[0121] In step a6, the encoding side obtains a motion information candidate list including at least one candidate motion information, and obtains a first target motion information and a second target motion information of the current block according to the motion information candidate list.
[0122] In step a7, for each pixel position of the current block, the encoding side determines a first predicted value of the pixel position based on the first target motion information of the current block, and determines a second predicted value of the pixel position based on the second target motion information of the current block.
[0123] In step a8, the encoding side determines a weighted predicted value for the pixel position based on the first predicted value for the pixel position, the target weight value for the pixel position, the second predicted value for the pixel position and the associated weight value for the pixel position.
[0124] For example, the weighted prediction value for the pixel position may be (first prediction value for the pixel position*target weight value for the pixel position+second prediction value for the pixel position*associated weight value for the pixel position) / a fixed preset numerical value.
[0125] In step a9, the encoding side determines a weighted prediction value of the current block based on the weighted prediction values of all pixel positions of the current block.
[0126] Embodiment 3: The embodiment of the present invention proposes another encoding-decoding method, which may be applied to the decoding side, and the method includes:
[0127] In step b1, if it is determined to start weighted prediction for the current block, the decoding side obtains the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted transformation ratio of the current block. Illustratively, the decoding side determines whether to start weighted prediction for the current block, and if so, executes step b1 and the subsequent steps; otherwise, the processing manner is not limited in the present invention.
[0128] 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. How the decoding side decides whether the current block starts weighted prediction based on the feature information is similar to the decision method of the encoding side, and will not be described again here.
[0129] 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 if the current block supports weighted prediction, it can also adopt other policies to determine whether to start weighted prediction for the current block, for example, adopt rate-distortion optimization 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 coding bitstream of the current block, the coding bitstream may include a syntax of whether to start weighted prediction, which syntax represents whether the current block starts weighted prediction. The decoding side determines whether the current block supports weighted prediction based on the feature information of the current block, and the specific manner is similar to the determination manner of the encoding side, and the description thereof is omitted here. If the current block supports weighted prediction, the decoding side can also parse the syntax of whether to start weighted prediction from the coding bitstream, and determine whether to start weighted prediction for the current block based on the syntax.
[0130] For example, when it is determined to start weighted prediction for the current block, the decoding side may also obtain a weighted prediction angle of the current block, a weighted prediction position of the current block, and a weighted transformation rate of the current block, and the description of the weighted prediction angle, the weighted prediction position, and the weighted transformation rate may refer to step a1, and will not be repeated here.
[0131] In step b2, the decoding side sets a reference weight value at a peripheral position outside the current block based on the weight transformation rate and the starting position of the weight transformation of the current block (the weight transformation rate and the starting position of the weight transformation may also be called weight setting parameters).
[0132] For example, the decoding side may determine a start position of the weight transformation of the current block based on at least one of the weight prediction angle of the current block, the weight prediction position of the current block, and the size of the current block, and may set a reference weight value at a peripheral position outside the current block based on the weight transformation rate and the start position of the weight transformation of the current block.
[0133] In step b3, for each pixel position of the current block, the decoding side determines a peripheral matching position pointed to by the pixel position from peripheral positions outside the current block according to the weighted prediction angle of the current block.
[0134] In step b4, the decoding side determines a target weight value for the pixel position based on the reference weight values associated with the neighboring matching positions.
[0135] In step b5, the decoding side determines an associated weight value for the pixel position based on the target weight value for the pixel position.
[0136] In step b6, the decoding side obtains a motion information candidate list including at least one candidate motion information, and obtains the first target motion information and the second target motion information of the current block according to the motion information candidate list.
[0137] In step b7, for each pixel position of the current block, the decoding side determines a first predicted value of the pixel position based on the first target motion information of the current block, and determines a second predicted value of the pixel position based on the second target motion information of the current block.
[0138] In step b8, the decoding side determines a weighted predicted value for the pixel position based on the first predicted value for the pixel position, the target weight value for the pixel position, the second predicted value for the pixel position and the associated weight value for the pixel position.
[0139] In step b9, the decoding side determines a weighted prediction value for the current block based on the weighted prediction values of all pixel positions of the current block.
[0140] As an example, the realization process of steps b2 to b8 can refer to steps a2 to a8, and the difference is that steps b2 to b8 are not the processing flow on the encoding side but the processing flow on the decoding side, and the explanation thereof will be omitted here.
[0141] Example 4: Referring to Figure 5, there is shown a schematic flowchart of an encoding / decoding method, which may be applied to a decoding side (which may also be referred to as a video decoder) or an encoding side (which may also be referred to as a video encoder), and which may include:
[0142] In step 501, if it is determined to start weighted prediction for a current block, obtain a weighted prediction angle and a weight setting parameter of the current block, the weight setting parameter including a weight conversion rate and a start position of weight conversion. The start position of weight conversion may be 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.
[0143] In step 502, a reference weight value is set for a peripheral position outside the current block according to a weight setting parameter of the current block.
[0144] In step 503, for each pixel position of the current block, determine a surrounding matching position to which the pixel position points from 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.
[0145] Illustratively, steps 501 to 503 may refer to steps 301 to 303, and will not be described repeatedly here.
[0146] In step 504, reference frame information is obtained, and a motion vector candidate list corresponding to the reference frame information is obtained, the motion vector candidate list includes at least one candidate motion vector, and the reference frame information includes first reference frame information and second reference frame information, and a first target motion vector and a second target motion vector of the current block are obtained based on the motion vector candidate list.
[0147] In step 505, for each pixel position of the current block, a first predicted value for the pixel position is determined based on first target motion information of the current block, a second predicted value for the pixel position is determined based on second target motion information 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 the associated weight value.
[0148] In one possible embodiment, the first target motion information of the current block may include the first target motion vector of the current block and first reference frame information corresponding to the first target motion vector, and the second target motion information of the current block may include the second target motion vector of the current block and second reference frame information corresponding to the second target motion vector.
[0149] Exemplarily, the first reference frame information and the second reference frame information may be the same, or the first reference frame information and the second reference frame information may be different. When the first reference frame information and the second reference frame information are the same, the reference frame pointed to by the first target motion vector and the reference frame pointed to by the second target motion vector are the same frame, and when the first reference frame information and the second reference frame information are different, the reference frame pointed to by the first target motion vector and the reference frame pointed to by the second target motion vector are different frames.
[0150] In step 506, a weighted prediction value for the current block is determined based on the weighted prediction values of all pixel locations of the current block.
[0151] For example, when the encoding / decoding method is applied to the encoding side, the detailed flow of steps 501 to 506 can also be realized by the second embodiment, with the difference being that in step a6, the encoding side acquires a motion vector candidate list, and acquires a first target motion vector and a second target motion vector of the current block based on the motion vector candidate list, acquires first target motion information based on the first target motion vector and first reference frame information corresponding to the first target motion vector, and acquires second target motion information based on the second target motion vector and second reference frame information corresponding to the second target motion vector, and the description thereof will be omitted here.
[0152] For example, when the encoding / decoding method is applied to the decoding side, the detailed flow of steps 501 to 506 can also be realized by the third embodiment, with the difference being that in step b6, the decoding side acquires a motion vector candidate list, and acquires a first target motion vector and a second target motion vector of the current block based on the motion vector candidate list, acquires first target motion information based on the first target motion vector and first reference frame information corresponding to the first target motion vector, and acquires second target motion information based on the second target motion vector and second reference frame information corresponding to the second target motion vector, and the description thereof will be omitted here.
[0153] It can be seen from the above technical solution that the embodiment of the present invention proposes an effective method for setting weight values, so that a reasonable target weight value can be set for each pixel position of the current block, thereby improving prediction accuracy, improving prediction performance, improving coding performance, so that the predicted value of the current block can be closer to the original pixels, and improving coding performance.
[0154] Example 5: In Examples 1 to 4, weighting processing needs to be performed based on a weighted prediction angle, and such weighting processing method may be referred to as inter-angular weighted prediction (AWP) mode. That is, if the current block supports the AWP mode, Examples 1 to 4 are adopted to predict the current block and obtain a predicted value of the current block.
[0155] In the first to fourth embodiments, the weighted prediction angle relates to an arbitrary angle, for example, an arbitrary angle within 180 degrees or an arbitrary angle within 360 degrees, and the weighted prediction angle is not limited and may be, for example, 10 degrees, 20 degrees, 30 degrees, etc.
[0156] In one possible embodiment, the weighted prediction angle may be a horizontal angle, or the weighted prediction angle may be a vertical angle, or the absolute value of the slope of the weighted prediction angle (the absolute value of the slope of the weighted prediction angle is, i.e., the tangent value of the weighted prediction angle) may be a power of 2, where n is an integer, for example a positive integer, 0, a negative integer, etc.
[0157] For example, the absolute value of the gradient of the weighted prediction angle may be 1 (i.e., 2 to the power of 0), or 2 (i.e., 2 to the power of 1), or 1 / 2 (i.e., 2 to the power of -1), or 4 (i.e., 2 to the power of 2), or 1 / 4 (i.e., 2 to the power of -2), or 8 (i.e., 2 to the power of 3), or 1 / 8 (i.e., 2 to the power of -3), etc. Exemplarily, referring to FIG. 6, eight kinds of weighted prediction angles are shown, and the absolute values of the gradients of these weighted prediction angles are 2 to the power of n.
[0158] In an embodiment of the present invention, a shift operation may be performed on the weighted prediction angle. See the subsequent embodiments for an example of performing a shift operation on the weighted prediction angle. Therefore, when the absolute value of the slope of the weighted prediction angle is the nth power of 2, it is possible to avoid a division operation from occurring when performing a shift operation on the weighted prediction angle, thereby making it convenient to implement the shift.
[0159] Exemplarily, the number of weighted prediction angles supported by different block sizes (i.e., sizes of the current block) may be the same or different, for example, block size A supports eight weighted prediction angles, block size B and block size C support six weighted prediction angles, etc.
[0160] Example 6: In the above examples 1 to 4, the encoding side / decoding side needs to set a reference weight value to a peripheral position outside the current block based on the weight conversion rate of the current block and the start position of the weight conversion of the current block. In one possible embodiment, a method can be adopted in which a reference weight value of each peripheral position outside the current block is set based on the coordinate value of the peripheral position, the coordinate value of the start position of the weight conversion, and the weight conversion rate.
[0161] Exemplarily, for each peripheral position outside the current block, if the peripheral position is a peripheral position of one row above or one row below the current block, the coordinate value of the peripheral position may be an abscissa value, and the coordinate value of the starting position of the weight transformation may be an abscissa value; or, if the peripheral position is a peripheral position of one column to the left or one column to the right outside the current block, the coordinate value of the peripheral position may be an ordinate value, and the coordinate value of the starting position of the weight transformation may be an ordinate value.
[0162] 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 positions of the current block and the coordinate values (e.g., abscissa values or ordinate values) of the start position of the weight transformation are all coordinate values relative to the coordinate origin. Of course, other pixel positions of the current block may be set as the coordinate origin, and the implementation method is similar to the implementation method of setting the pixel position of the upper left corner as the coordinate origin.
[0163] In one possible embodiment, a difference between the coordinate value of the surrounding position and the coordinate value of the start position of the weight transformation is first determined, and the product of the difference value and the weight transformation rate of the current block is determined. If the product is smaller than a first value (i.e., the minimum value of the reference weight value, e.g., 0), the reference weight value associated with the surrounding position is determined to be the first value. If the product is larger than a second value (i.e., the maximum value of the reference weight value, e.g., 8), the reference weight value associated with the surrounding position is determined to be the second value. If the product is equal to or larger than the first value and equal to or smaller than the second value, the reference weight value associated with the surrounding position is determined to be the product. In another possible embodiment, the reference weight value associated with the surrounding position can also be directly determined based on the magnitude relationship between the coordinate value of the surrounding position and the coordinate value of the start position of the weight transformation. For example, if the coordinate value of the surrounding position is smaller than the coordinate value of the start position of the weight transformation, the reference weight value associated with the surrounding position is determined to be the first value. If the coordinate value of the surrounding position is equal to or larger than the coordinate value of the start position of the weight transformation, the reference weight value associated with the surrounding position is determined to be the second value. For example, if the coordinate value of the surrounding position is smaller than the coordinate value of the start position of the weighting transformation, the reference weight value associated with the surrounding position is determined to be a second numerical value, and if the coordinate value of the surrounding position is greater than or equal to the coordinate value of the start position of the weighting transformation, the reference weight value associated with the surrounding position is determined to be a first numerical value.
[0164] For example, the first value and the second value may be set empirically, and the first value is smaller than the second value, and there is no restriction on both the first value and the second value. For example, the first value is a predetermined minimum value of the reference weight value, such as 0, and the second value is a predetermined maximum value of the reference weight value, such as 8, and of course, 0 and 8 are also merely examples.
[0165] 4C, for example, after dividing all the peripheral positions into 8, 7 weighted predicted positions can be obtained, and when the weighted predicted position is 0, it represents peripheral position a0, and the coordinate value of the start position of the weighted transformation is the coordinate value of peripheral position a0. When the weighted predicted position is 1, it represents peripheral position a1, and the coordinate value of the start position of the weighted transformation is the coordinate value of peripheral position a1. By this analogy, the method of determining the coordinate value of the start position of the weighted transformation will not be described here.
[0166] Example 7: In Example 1 to Example 4, the encoding side / decoding side needs to set the reference weight value at the peripheral position outside the current block according to the weight transformation rate of the current block and the start position of the weight transformation of the current block. In one possible embodiment, the following method can be adopted: obtain the weight prediction angle of the current block, the weight transformation rate of the current block and the weight prediction position of the current block, determine the start position of the weight transformation of the current block according to the weight prediction position of the current block, and determine the weight setting parameter according to the start position of the weight transformation and the weight transformation rate, that is, the weight setting parameter includes the start position and the weight transformation rate of the weight transformation, and determine the reference weight value at the peripheral position outside the current block according to the weight setting parameter.
[0167] Hereinafter, the process of setting reference weights for peripheral positions outside the current block will be described with reference to specific steps.
[0168] In step c1, a reference weight value of the valid number is obtained.
[0169] For example, the number of peripheral positions outside the current block is a valid number, and in step c1, a reference weight value of the valid number needs to be obtained, and the valid number may be determined according to the size of the current block and / or the weighted prediction angle of the current block. For example, the valid number is determined by adopting a method of ValidLength=(N+(M>>X))<<1, where N and M are the height and width of the current block respectively, and X is the log2 logarithm of the absolute value of the slope of the weighted prediction angle of the current block, e.g., 0 or 1.
[0170] 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 include a plurality of first numerical values first and a plurality of second numerical values later, or may include a plurality of second numerical values first and a plurality of first numerical values later. This will be described below with reference to some specific cases.
[0171] Case 1: The reference weight value of the valid number may be monotonically increasing or monotonically decreasing. For example, the reference weight value of the valid number may be [88...88765432100...00], i.e., monotonically decreasing. For example, the reference weight value of the valid number may be [00...00123456788...88], i.e., monotonically increasing. Of course, the above is merely an example and is not limited thereto.
[0172] For example, the reference weight value may be set based on a weight setting parameter, which may include a weight conversion rate and a start position of the weight conversion, and the method of obtaining the weight conversion rate may refer to subsequent embodiments, and the start position of the weight conversion may be an empirically set numerical value, or the start position of the weight conversion may be determined from the weight prediction position, or the start position of the weight conversion may be determined from the weight prediction angle and the weight prediction position, and there is no limitation thereto.
[0173] The reference weight values of the effective number may monotonically increase or decrease from the first to the last. For example, the maximum value of the reference weight value is M1, the minimum value of the reference weight value is M2, and the reference weight values of the effective number may monotonically decrease from the maximum value M1 to the minimum value M2, or monotonically increase from the minimum value M2 to the maximum value M1. Assuming that M1 is 8 and M2 is 0, the multiple reference weight values may monotonically decrease from 8 to 0, or monotonically increase from 0 to 8.
[0174] For example, a weight conversion rate and a start position of the weight conversion may be obtained first, and then a number of reference weight values may be determined based on the weight conversion rate and the start position of the weight conversion. For example, the reference weight value may be determined by adopting a method of y=Clip3(minimum, maximum, a*(xs)), where x represents the index of the peripheral position, that is, the value range of x is 1 to a valid value, for example, x is 1, which represents the first peripheral position, y represents the reference weight value of the first peripheral position, x is 2, which represents the second peripheral position, and y represents the reference weight value of the second peripheral position. a represents the weight conversion rate, and s represents the start position of the weight conversion.
[0175] Clip3 is used to restrict 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.
[0176] a represents a weight conversion rate, a can be an integer other than 0, for example, a can be -4, -2, -1, 1, 2, 4, etc., and there is no restriction on the value of a. If the absolute value of a is 1, the reference weight value must pass through 0, 1, 2, 3, 4, 5, 6, 7, 8 from 0 to 8, or the reference weight value must pass through 8, 7, 6, 5, 4, 3, 2, 1, 0 from 8 to 0.
[0177] s represents the starting position of the weight transformation, and s may be determined by the weight prediction position, for example, s = f (weight prediction position), that is, s is a function related to the weight prediction position. For example, after the range of the peripheral positions outside the current block is determined, the effective number of peripheral positions can be determined, and all peripheral positions can be equally divided into N, and the value of N can be set arbitrarily, for example, 4, 6, 8, etc., and the weight prediction position is used to represent which peripheral position outside the current block is adopted as the target peripheral position of the current block, and the peripheral position corresponding to this weight prediction position is the starting position of the weight transformation. Or, s may be determined by the weight prediction angle and the weight prediction position, for example, s = f (weight prediction angle, weight prediction position), that is, s is a function related to the weight prediction angle and the weight prediction position. For example, a range of peripheral positions outside the current block can be determined based on a weighted prediction angle, and after the range of peripheral positions outside the current block is determined, the effective number of peripheral positions can be determined and all peripheral positions can be divided into N equal parts, and the weighted prediction position is used to indicate which peripheral position outside the current block is adopted as the target peripheral position of the current block, and the peripheral position corresponding to this weighted prediction position is the starting position of the weighted transformation.
[0178] As described above, in y=Clip3(minimum, maximum, a*(xs)), 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 according to the functional relationship. For example, assuming that the weight conversion rate a is 2 and the start position s of the weight conversion is 2, the functional relationship can be y=2*(x-2), and for each peripheral position x outside the current block, the reference weight value y can be obtained.
[0179] In this way, a valid number of reference weight values of the current block can be obtained, and these reference weight values are monotonically increasing or monotonically decreasing. In one possible embodiment, the reference weight values of the outer peripheral positions of the current block include a reference weight value of the target area, a reference weight value of the first adjacent area of the target area, and a reference weight value of the second adjacent area of the target area.
[0180] Exemplarily, the target region includes one reference weight value or at least two reference weight values. For example, based on the starting position of the weight transformation, one reference weight value is determined, and the reference weight value is set as the reference weight value of the target region. Also, for example, based on the starting position of the weight transformation, at least two reference weight values are determined, and the at least two reference weight values are set as the reference weight values of the target region.
[0181] When the target region includes at least two reference weight values, the at least two reference weight values of the target region monotonically increase or decrease. The monotonically increase may be a strict monotonically increase (i.e., the at least two reference weight values of the target region are strictly monotonically increase), and the monotonically decrease may be a strict monotonically decrease (i.e., the at least two reference weight values of the target region are strictly monotonically decrease). For example, the reference weight value of the target region monotonically increases from 1 to 7, or the reference weight value of the target region monotonically decreases from 7 to 1.
[0182] For example, the reference weight values of the first adjacent region may all be the first reference weight value, and the reference weight values of the second adjacent region may monotonically increase. For example, the reference weight values of the first adjacent region may all be 0, the target region includes one reference weight value, which is 1, and the reference weight value of the second adjacent region monotonically increases from 2 to 8.
[0183] Alternatively, the reference weight values of the first adjacent region may all be the first reference weight value, and the reference weight values of the second adjacent region may monotonically decrease. For example, the reference weight values of the first adjacent region may all be 8, the target region includes one reference weight value, which is 7, and the reference weight value of the second adjacent region monotonically decreases from 6 to 0.
[0184] Or, the reference weight values of the first adjacent region are all the second reference weight value, and the reference weight values of the second adjacent region are all the third reference weight value, and the second reference weight value is different from the third reference weight value. For example, the reference weight values of the first adjacent region are all 0, the target region includes at least two reference weight values, and the reference weight values monotonically increase from 1 to 7, and the reference weight values of the second adjacent region are all 8, and obviously, the reference weight values of the first adjacent region are different from the reference weight values of the second adjacent region.
[0185] Or, the reference weight value of the first adjacent region increases or decreases monotonically, and the reference weight value of the second adjacent region increases or decreases monotonically, for example, the reference weight value of the first adjacent region increases monotonically and the reference weight value of the second adjacent region also increases monotonically, or for example, the reference weight value of the first adjacent region decreases monotonically and the reference weight value of the second adjacent region also decreases monotonically. For example, the reference weight value of the first adjacent region increases monotonically from 0 to 3, the target region includes one reference weight value, which is 4, and the reference weight value of the second adjacent region increases monotonically from 5 to 8.
[0186] Case 2: For the reference weight value of the valid number, it may include a plurality of first numerical values before and a plurality of second numerical values after, or may include a plurality of second numerical values before and a plurality of first numerical values after. For example, the reference weight value of the valid number may be [88...8800...00] or [00...0088...88]. Exemplarily, a plurality of reference weight values may be determined based on the start position of the weight transformation. For example, the start position of the weight transformation represents the s-th reference weight value, and therefore, all reference weight values before (not including) the s-th reference weight value are the first numerical value (e.g., 8), and all reference weight values after (including) the s-th reference weight value are the second numerical value (e.g., 0). Or, all reference weight values before the s-th reference weight value are the second numerical value, and all reference weight values after the s-th reference weight value are the first numerical value.
[0187] In step c2, the reference weight values of the peripheral positions outside the current block are set according to the reference weight values of the effective numbers.
[0188] Exemplarily, since the number of surrounding positions outside the current block is a valid number and the number of reference weight values is a valid number, the valid number of reference weight values can be set as the reference weight values of the surrounding positions outside the current block.
[0189] For example, the first reference weight value can be set as the reference weight value of the first surrounding position outside the current block, and the second reference weight value can be set as the reference weight value of the second surrounding position outside the current block, and so on.
[0190] As described above, the reference weight values have already been 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.
[0191] The implementation manner of the above process will be described below with reference to some specific application scenarios. Illustratively, in some subsequent application scenarios, it is assumed that the size of the current block is M*N, where M is the width of the current block, and N is the height of the current block. X is the log2 logarithm of the tangent value of the weight prediction angle, e.g., 0 or 1. Y is the index value of the weight prediction position, and a, b, c, and d are preset constant values. ValidLength represents a valid number, FirstPos represents the start position of the weight conversion, ReferenceWeights[i] represents the reference weight value of the i-th peripheral position, Clip3 is used to restrict the reference weight value to be between the minimum value 0 and the maximum value 8, i represents the index of the peripheral position outside the current block, and a represents the absolute value of the weight conversion rate.
[0192] Application scene 1: Determine a valid number (which may be called reference weight valid length, i.e. ValidLength) based on the size of the current block and the weight prediction angle of the current block, and obtain the start position of weight conversion (i.e. FirstPos). For example, ValidLength can be determined by the formula ValidLength=(N+(M>>X))<<1, and FirstPos can be determined by the formula FirstPos=(ValidLength>>1)-a+Y*((ValidLength-1)>>3). Then, derive the reference weight value of each peripheral position of the current block by the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The value range of i may be 0 to ValidLength-1, or 1 to ValidLength. After obtaining the reference weight values ReferenceWeights[i] of the surrounding positions of the current block, the target weight value of the pixel position (x, y) of the current block is derived by the formula SampleWeight[x][y] = ReferenceWeights[(y<<1) + ((x<<1)>>X)], where << represents a left shift and >> represents a right shift.
[0193] Application scene 2: ValidLength is determined by the formula ValidLength=(N+(M>>X))<<1, and FirstPos can be determined by the formula FirstPos=(ValidLength>>1)-b+Y*((ValidLength-1)>>3)-((M<<1)>>X). Then, the reference weight value of each peripheral position of the current block is derived by the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weight value of each pixel position (x, y) of the current block can be derived by the formula SampleWeight[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>X)].
[0194] Application scene 3: ValidLength is determined by the formula ValidLength=(M+(N>>X))<<1, and FirstPos is determined by the formula FirstPos=(ValidLength>>1)-c+Y*((ValidLength-1)>>3)-((N<<1)>>X). Then, the reference weight value of each peripheral position of the current block can be derived by the formula ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weight value of each pixel position (x, y) of the current block can be derived by the formula SampleWeight[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>X)].
[0195] Application scene 4: ValidLength is determined by ValidLength=(M+(N>>X))<<1, FirstPos is determined by FirstPos=(ValidLength>>1)-d+Y*((ValidLength-1)>>3), and the reference weights of each peripheral position of the current block are derived by ReferenceWeights[i]=Clip3(0,8,a*(i-FirstPos)). The target weights of each pixel position (x,y) of the current block are derived by SampleWeight[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>X)].
[0196] Application Scenario 5: Referring to FIG. 7, a schematic diagram of reference weight values of four kinds of weight conversion ratios is shown.
[0197] When the absolute value of the weight conversion rate is 1, that is, when the weight conversion rate is 1 or the weight conversion rate is -1, the reference weight value of each peripheral position of the current block can be derived by the formula ReferenceWeights[i]=Clip3(0,8,1*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,i-FirstPos). In this case, referring to the first case shown in Fig. 7, FirstPos may be 4, that is, the reference weight values of the first to fourth peripheral positions are 0, the reference weight value of the fifth peripheral position is 1, and the reference weight value of the sixth peripheral position is 2, and so on.
[0198] When the absolute value of the weight conversion rate is 2, that is, when the weight conversion rate is 2 or the weight conversion rate is -2, the reference weight value of each peripheral position of the current block is derived by the formula ReferenceWeights[i]=Clip3(0,8,2*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<1). In this case, referring to the second case shown in FIG. 7, FirstPos may be 6, that is, the reference weight values of the 1st to 6th peripheral positions are 0, the reference weight value of the 7th peripheral position is 2, and the reference weight value of the 8th peripheral position is 4, and so on.
[0199] When the absolute value of the weight conversion rate is 4, that is, when the weight conversion rate is 4 or the weight conversion rate is −4, the reference weight value of each neighboring position of the current block can be derived by the formula ReferenceWeights[i]=Clip3(0,8,4*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<2). In this case, referring to the third case shown in FIG. 7, FirstPos may be 7, the reference weight values of the 1st to 7th neighboring positions are 0, the reference weight value of the 8th neighboring position is 4, and the reference weight values of the 9th to 17th neighboring positions are 8, and so on.
[0200] When the absolute value of the weight conversion rate is 8, i.e., when the weight conversion rate is 8 or −8, the reference weight value of each neighboring position of the current block is derived by the formula ReferenceWeights[i]=Clip3(0,8,8*(i-FirstPos)), which may be equivalent to ReferenceWeight[i]=Clip3(0,8,(i-FirstPos)<<3). In this case, referring to the fourth case shown in FIG. 7, FirstPos may be 8, i.e., the reference weight values of the 1st to 8th neighboring positions are 0, the reference weight value of the 9th neighboring position is 9, and the reference weight values of the 10th to 17th neighboring positions are 8, and so on.
[0201] As described above, when the absolute value of the weight conversion rate is 1, FirstPos is 4, when the absolute value of the weight conversion rate is 2, FirstPos is 6 (i.e., FirstPos+2 when the weight conversion rate is 1), and when the absolute value of the weight conversion rate is 4, FirstPos is 7 (i.e., FirstPos+3 when the weight conversion rate is 1), and based on this, the position of the reference weight value 4 can be aligned.
[0202] For example, for the current block, the weight conversion rate switching is supported, and when the weight conversion rate switching is started, one of the reference weight value distribution examples of the four types of weight conversion rates shown in FIG. 7 can be selected and switched, thereby performing weight conversion rate switching on an image or a local region of an image, thereby achieving the reduction of the noticeable jumps of image display in some image display scenes. For example, the problem that the jumps are relatively noticeable in some image display scenes needs to be solved, and the weight change rate switching of the AWP mode can solve this problem. For example, the mixed image content includes partial screen content, animation, images containing animation, etc., and the weight conversion rate switching can be performed on a certain region containing screen content to solve the problem that the jumps are relatively noticeable.
[0203] 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 technical solution, some parameters can be constant 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. FirstPos is related to the weighted prediction angle of the current block, the size of the current block, and the weighted prediction position of the current block, and in order to simplify the technical solution, some parameters can be constant to achieve the optimization purpose, for example, the weighted prediction angle of the current block can be set as a fixed parameter value, and FirstPos is only related 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 is set as a fixed parameter value, and FirstPos is only related 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 are both set as fixed parameter values, and the two fixed parameter values may be the same or different, and FirstPos is only related to the size of the current block.
[0204] Example 8: In Examples 1 to 4, the encoding side / decoding side needs to set a reference weight value at a peripheral position outside the current block according to the weight transformation rate of the current block and the start position of the weight transformation of the current block. In one possible embodiment, M and N are the width and height of the current block, and the weight array derivation method of the angle weighted prediction mode (AWP) includes:
[0205] In step d1, parameters such as stepIdx, angleIdx, and subAngleIdx are obtained based on AwpIdx.
[0206] Exemplarily, AwpIdx represents an index value of a weighted prediction position and a weighted prediction angle, and assuming that there are seven types of weighted prediction positions and eight types of weighted prediction angles, the value range of AwpIdx is 0 to 55. If the weighted prediction positions are 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 can be found in Table 1. [Table 1]
[0207] Exemplarily, stepIdx represents a weighted prediction position (e.g., an index value of a weighted prediction position), and the range of the weighted prediction position may be from −3 to 3. For example, for the first weighted prediction position, the index value of the weighted prediction position is −3, for the second weighted prediction position, the index value of the weighted prediction position is −2, and by analogy, for the seventh weighted prediction position, the index value of the weighted prediction position is 3.
[0208] angleIdx represents the log2 logarithm of the absolute value of the slope of the weighted prediction angle (for example, 0, or 1, or a large constant), and subAngleIdx represents the angle partition in which the weighted prediction angle is located. Referring to FIG. 8A, eight types of weighted prediction angles are shown, and angleIdx of weighted prediction angle 0 is the log2 logarithm of the absolute value of the slope of weighted prediction angle 0, and angleIdx of weighted prediction angle 1 is the log2 logarithm of the absolute value of the slope of weighted prediction angle 1. By analogy, angleIdx of weighted prediction angle 7 is the log2 logarithm of the absolute value of the slope of weighted prediction angle 7. Weighted prediction angle 0 and weighted prediction angle 1 are located in angle partition 0, weighted prediction angle 2 and weighted prediction angle 3 are located in angle partition 1, weighted prediction angle 4 and weighted prediction angle 5 are located in angle partition 2, and weighted prediction angle 6 and weighted prediction angle 7 are located in angle partition 3.
[0209] Exemplarily, stepIdx can be determined by employing the formula: stepIdx=(AwpIdx>>3)-3.
[0210] For example, modAngNum (angle number) can be determined based on the formula modAngNum=AwpIdx%8, and based on modAngNum, angleIdx can be determined by adopting the following method: if modAngNum is equal to 2, then angleIdx=7; if modAngNum is equal to 6, then angleIdx=8; otherwise, angleIdx=modAngNum%2.
[0211] Exemplarily, the formula subAngleIdx=modAngNum>>1 may be employed to determine subAngleIdx.
[0212] As described above, after the encoding side determines the weighted prediction angle of the current block and the weighted prediction position of the current block, it can determine the value of AwpIdx according to the weighted prediction angle and the weighted prediction position, see Table 1. When the encoding side sends the encoded bitstream to the decoding side, the value of AwpIdx can be added to the encoded bitstream, and the decoding side can obtain the value of AwpIdx based on this, and obtain stepIdx, angleIdx and subAngleIdx based on AwpIdx.
[0213] For example, angleIdx and subAngleIdx can uniquely determine one weighted prediction angle, see Table 2; of course, other methods, such as changing the partition number, can also be adopted to determine the weighted prediction angle. [Table 2]
[0214] In step d2, set a reference weight value for the peripheral position outside the current block based on stepIdx, angleIdx and subAngleIdx.
[0215] In case 1, when subAngleIdx is 0, that is, the weighted prediction angle is located in angle partition 0, for example, when the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the weight conversion start position FirstPos can be determined by adopting the formula FirstPos=(ValidLength_H>>1)-6+DeltaPos_H. And, the reference weight value of the peripheral position outside the current block can be determined by adopting the formula ReferenceWeights[x]=Clip3(0,8,x-FirstPos), in which the minimum value of the reference weight value is 0, the maximum value of the reference weight value is 8, and the weight conversion rate is 1 as an example, that is, the above formula may be equivalent to ReferenceWeights[x]=Clip3(minimum, maximum, a*(x-FirstPos)). x may be an index of the peripheral position outside the current block, the value range of x is 0 to ValidLength_H-1, and a represents the weight conversion rate.
[0216] In the above formula, ValidLength_H may represent the number of peripheral positions outside the current block (i.e., a valid number, which may also be called a valid length), and when subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be a peripheral position in one column to the left, and therefore the valid number may be represented as ValidLength_H. Exemplarily, the valid number ValidLength_H may be determined by employing the formula ValidLength_H=(N+(M>>angleIdx))<<1. Here, the reason for shifting left by 1 bit is that the formula adopts 1 / 2-pel precision. If it is 1-pel precision, then ValidLength_H=(N+(M>>angleIdx)), if it is 1 / 4-pel precision, then ValidLength_H=(N+(M>>angleIdx))<<2, if it is 2-pel precision, then ValidLength_H=(N+(M>>angleIdx))>>1, and other pixel precisions are inferred in this way and their explanation is omitted here. In the following formulas, some related >>1 operations may be changed depending on the difference in pixel precision.
[0217] In the above formula, DeltaPos_H represents a position change amount parameter (i.e., one intermediate parameter), and when subAngleIdx is 0, the peripheral position outside the current block indicated by the weighted prediction angle may be a peripheral position in one left column outside the current block, so the position change amount parameter can be represented as DeltaPos_H. Exemplarily, DeltaPos_H can be determined by adopting the formula DeltaPos_H=stepIdx*((ValidLength_H>>3)-1).
[0218] In case 2, when subAngleIdx is 1, that is, the weighted prediction angle is located in angle partition 1, for example, the weighted prediction angle is weighted prediction angle 2 or weighted prediction angle 3, the weight conversion start position FirstPos can be determined by using the formula FirstPos=(ValidLength_H>>1)-4+DeltaPos_H-((M<<1)>>angleIdx). Then, the reference weights of the peripheral positions outside the current block are determined by using the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)), where the minimum value of the reference weights is 0, the maximum value of the reference weights is 8, and the weight conversion rate is a. x may be an index of the peripheral positions outside the current block, and the value range of x is 0 to ValidLength_H-1.
[0219] In the above formula, ValidLength_H and DeltaPos_H can refer to Case 1, and the description thereof will be omitted here.
[0220] In case 3, when subAngleIdx is 2, that is, the weighted prediction angle is located in angle partition 2, for example, the weighted prediction angle is weighted prediction angle 4 or weighted prediction angle 5, the weight conversion start position FirstPos can be determined by adopting the formula FirstPos=(ValidLength_W>>1)-4+DeltaPos_W-((N<<1)>>angleIdx). Then, the reference weights of the peripheral positions outside the current block are determined by adopting the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)), in which the minimum value of the reference weights is 0, the maximum value of the reference weights is 8, and the weight conversion rate is a. x may be an index of the peripheral positions outside the current block, and the value range of x is 0 to ValidLength_W-1.
[0221] In the above formula, ValidLength_W represents the number of peripheral positions outside the current block (i.e., a valid number, which may be called a valid length), and when subAngleIdx is 2, the peripheral position outside the current block indicated by the weighted prediction angle may be a peripheral position in the top row, and therefore the valid number is denoted as ValidLength_W. Exemplarily, the valid number ValidLength_W may be determined by employing the formula ValidLength_W=(M+(N>>angleIdx))<<1.
[0222] In the above formula, DeltaPos_W represents a position change amount parameter (i.e., one intermediate parameter), and when subAngleIdx is 2, the peripheral position outside the current block indicated by the weighted prediction angle may be a peripheral position of the upper row outside the current block, and therefore the position change amount parameter may be represented as DeltaPos_W. Exemplarily, DeltaPos_W may be determined by adopting the formula DeltaPos_W=stepIdx*((ValidLength_W>>3)-1).
[0223] In case 4, when subAngleIdx is 3, that is, the weighted prediction angle is located in angle partition 3, for example, the weighted prediction angle is weighted prediction angle 6 or weighted prediction angle 7, the weight conversion start position FirstPos can be determined by adopting the formula FirstPos=(ValidLength_W>>1)-6+DeltaPos_W. And the reference weight value of the peripheral position outside the current block can be determined by adopting the formula ReferenceWeights[x]=Clip3(0,8,a*(x-FirstPos)), where the minimum value of the reference weight value is 0, the maximum value of the reference weight value is 8, and the weight conversion rate is a. x may be an index of the peripheral position outside the current block, and the value range of x is 0 to ValidLength_W-1.
[0224] In the above formula, ValidLength_W and DeltaPos_W can refer to Case 3, and the description thereof will be omitted here.
[0225] As described above, it is possible to determine which case to adopt for processing based on subAngleIdx, for example, in cases 1 and 2, ValidLength_H and DeltaPos_H are determined based on angleIdx and stepIdx, and FirstPos is determined based on ValidLength_H and DeltaPos_H, and then the reference weight value is set based on FirstPos. In cases 3 and 4, ValidLength_W and DeltaPos_W are determined based on angleIdx and stepIdx, and FirstPos is determined based on ValidLength_W and DeltaPos_W, and then the reference weight value is set based on FirstPos.
[0226] The difference between the formulas in each of the above cases is that when the upper left corner of the current block is the coordinate origin, the starting position of the reference weight value ReferenceWeights[x] changes. For example, referring to FIG. 8B, which shows examples of angle partition 2 and angle partition 3, in the case of 1 / 2-pel accuracy, the starting position of the reference weight value ReferenceWeights[x] is (height<<1)>>angleIdx, that is, the offset in the formula is "-((N<<1)>>angleIdx)". The implementation of angle partition 0 and angle partition 1 is similar, but the offset in the formula is "-((M<<1)>>angleIdx)", that is, the height only needs to be changed to width.
[0227] In step d3, the luminance weight value of the pixel position is obtained based on the angleIdx and the reference weight value ReferenceWeights[x].
[0228] In case 1, when subAngleIdx is 0, the following formula can be adopted to determine the brightness weight value of pixel position (x, y): AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)]. (y<<1)+((x<<1)>>angleIdx) represents the peripheral position indicated by pixel position (x, y), and ReferenceWeights[(y<<1)+((x<<1)>>angleIdx)] represents the reference weight value of the peripheral position. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.
[0229] In case 2, when subAngleIdx is 1, the brightness weight value of pixel position (x, y) can be determined by adopting the formula of AwpWeightArrayY[x][y]=ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)], where (y<<1)-((x<<1)>>angleIdx) represents the surrounding position pointed by pixel position (x, y), and ReferenceWeights[(y<<1)-((x<<1)>>angleIdx)] represents the reference weight value of the surrounding position. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.
[0230] In case 3, when subAngleIdx is 2, the brightness weight value of pixel position (x, y) can be determined by adopting the formula of AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)], where (x<<1)-((y<<1)>>angleIdx) represents the surrounding position pointed by pixel position (x, y), and ReferenceWeights[(x<<1)-((y<<1)>>angleIdx)] represents the reference weight value of the surrounding position. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.
[0231] In case 4, when subAngleIdx is 3, the brightness weight value of pixel position (x, y) can be determined by adopting the formula of AwpWeightArrayY[x][y]=ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)], where (x<<1)+((y<<1)>>angleIdx) represents the surrounding position pointed by pixel position (x, y), and ReferenceWeights[(x<<1)+((y<<1)>>angleIdx)] represents the reference weight value of the surrounding position. The value range of x is 0 to M-1, and the value range of y is 0 to N-1.
[0232] The above steps d2 and d3 can be integrated into one step, i.e., step d2 (setting a reference weight value at a peripheral position outside the current block based on stepIdx, angleIdx, and subAngleIdx) and step d3 (obtaining a brightness weight value based on angleIdx and reference weight value ReferenceWeight[x]) are integrated to obtain a brightness weight value of a pixel position based on stepIdx, angleIdx, and subAngleIdx, i.e., determined based on the coordinate values of the peripheral position and the coordinate values of the weight transformation start position.
[0233] Taking case 1 as an example, when subAngleIdx is 0, that is, the weighted prediction angle is located in angle partition 0, for example, the weighted prediction angle is weighted prediction angle 0 or weighted prediction angle 1, the formula FirstPos=(ValidLength_H>>1)-6+DeltaPos_H is adopted to determine the start position FirstPos of weight conversion. And the formula AwpWeightArrayY[x][y]=Clip3(0,8,(y<<1)+((x<<1)>>angleIdx)-FirstPos) is adopted 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).
[0234] In step d4, a chromaticity weight value of a 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 set a target weight value of the pixel position.
[0235] For example, when the chromaticity resolution format is 4:2:0, the chromaticity weight value of the pixel position (x, y) is determined by adopting the formula AwpWeightArrayUV[x][y]=AwpWeightArrayY[x<<1][y<<1]. Also, when the chromaticity resolution format is 4:4:4, the chromaticity weight value of the pixel position (x, y) is determined by adopting the formula AwpWeightArrayUV[x][y]=AwpWeightArrayY[x][y]. Here, the value range of x is 0 to M / 2-1, and the value range of y is 0 to N / 2-1.
[0236] Another implementation of step d4 is to obtain the chromaticity weight value of the pixel position according to angleIdx and the reference weight value ReferenceWeight[x], so there is no need to obtain the chromaticity weight value according to the luma weight value. For example, when the chromaticity resolution format is 4:2:0, the chromaticity weight value of the pixel position is obtained according to angleIdx and the reference weight value ReferenceWeight[x].
[0237] For example, if subAngleIdx is 0, the chromaticity weight value at pixel position (x, y) can be determined by adopting the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)+((x<<2)>>angleIdx)].
[0238] For example, if subAngleIdx is 1, the chromaticity weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(y<<2)-((x<<2)>>angleIdx)].
[0239] For example, if subAngleIdx is 2, the chromaticity weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)-((y<<2)>>angleIdx)].
[0240] For example, if subAngleIdx is 3, the chromaticity weight value of pixel position (x, y) can be determined by adopting the formula AwpWeightArrayUV[x][y]=ReferenceWeights[(x<<2)+((y<<2)>>angleIdx)].
[0241] In the above formulas, the value range of x is 0 to M-1, and the value range of y is 0 to N-1.
[0242] In step d3 and step d4, the difference in the formula in each case is as follows, referring to the examples of angle partition 2 and angle partition 3 shown in FIG. 8C. When the upper left corner of the current block is the coordinate origin, the calculation formula of the matching position of (x, y) in angle partition 2 may be xy>>angleIdx, and the calculation formula of the matching position of (x, y) in angle partition 3 may be x+y>>angleIdx. In the case of 1 / 2-pel accuracy, the calculation formula of the matching position of (x, y) in angle partition 2 may be (x<<1)-(y<<1)>>angleIdx, and the calculation formula of the matching position of (x, y) in angle partition 3 may be (x<<1)+(y<<1)>>angleIdx. The realization of angle partition 0 and angle partition 1 is similar, and only the position of (x, y) needs to be exchanged.
[0243] Example 9: In Examples 1 to 4, the encoding side / decoding side needs to obtain the weight transformation rate of the current block, and if the current block supports the weight transformation rate switching mode, the weight transformation rate of the current block is obtained by obtaining weight transformation rate indication information of the current block, and determining the weight transformation rate of the current block according to the weight transformation rate indication information. For example, if the weight transformation rate indication information is the first indication information, the weight transformation rate of the current block is the first weight transformation rate, and if the weight transformation rate indication information is the second indication information, the weight transformation rate of the current block is the second weight transformation rate. If the current block does not support the weight transformation rate switching mode, a preset weight transformation rate is determined as the weight transformation rate of the current block.
[0244] As described above, when the current block supports the weight transformation rate switching mode, the weight transformation rate of the current block may be the first weight transformation rate or the second weight transformation rate, and the first weight transformation rate is different from the second weight transformation rate, that is, the weight transformation rate of the current block is variable, so that instead of adopting a unified weight transformation rate, the weight transformation rate can be adaptively switched.
[0245] Exemplarily, if the switching control information allows the start of the weight conversion rate switching mode of the current block, the current block supports the weight conversion rate switching mode, and if the switching control information does not allow the start of the weight conversion rate switching mode of the current block, the current block does not support the weight conversion rate switching mode. The switching control information may include, but is not limited to, sequence level switching control information, frame level switching control information, slice level switching control information, tile level switching control information, patch level switching control information, coding tree unit (CTU) level switching control information, largest coding unit (LCU) level switching control information, block level switching control information, coding unit (CU) level switching control information, prediction unit (PU) level switching control information, etc.
[0246] The encoding side can know the switching control information and know whether the switching control information allows the current block to start the weight conversion rate switching mode, and then determine whether the current block supports the weight conversion rate switching mode. The encoding side codes the switching information into a bitstream, so that the decoding side can analyze the switching control information from the bitstream, know whether the switching control information allows the current block to start the weight conversion rate switching mode, and then determine whether the current block supports the weight conversion rate switching mode. Instead of coding the switching control information into a bitstream, the encoding side can also implicitly derive the switching control information by the decoding side, know whether the switching control information allows the current block to start the weight conversion rate switching mode, and then determine whether the current block supports the weight conversion rate switching mode.
[0247] Taking the sequence level switching control information as an example, the sequence level switching control information may be awp_adptive_flag (inter-angle weighted prediction adaptive flag bit), and when awp_adptive_flag is a first value, it indicates that the sequence level switching control information allows the start of the weight conversion rate switching mode of the current sequence, thereby allowing the start of the weight conversion rate switching mode of the current block, and when awp_adptive_flag is a second value, it indicates that the sequence level switching control information does not allow the start of the weight conversion rate switching mode of the current sequence, thereby not allowing the start of the weight conversion rate switching of the current block. Exemplarily, the first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above is only an example of the first value and the second value, and is not limited thereto. For other types of switching control information, the implementation process is similar to that of the sequence level switching control information, and the description thereof will be omitted here.
[0248] In one possible embodiment, the weight transformation rate indication information of the current block may be a SCC (Screen Content Coding) identifier corresponding to the current block, the first indication information is used to indicate that the current block belongs to screen content coding, and the second indication information is used to indicate that the current block belongs to non-screen content coding. Then, the SCC identifier corresponding to the current block can be obtained, and the weight transformation rate of the current block can be determined according to the SCC identifier. For example, if the SCC identifier is used to indicate that the current block belongs to screen content coding, the weight transformation rate of the current block is the first weight transformation rate, and if the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the weight transformation rate of the current block is the second weight transformation rate.
[0249] Exemplarily, the absolute value of the first weighting conversion rate may be greater than the absolute value of the second weighting conversion rate. For example, the absolute value of the first weighting conversion rate may be 4, and the absolute value of the second weighting conversion rate may be 1 or 2. For example, the absolute value of the first weighting conversion rate may be 2, and the absolute value of the second weighting conversion rate may be 1. For example, the absolute value of the first weighting conversion rate may be 8, and the absolute value of the second weighting conversion rate may be 1, 2, or 4. For example, the absolute value of the first weighting conversion rate may be 8 or 4, and the absolute value of the second weighting conversion rate may be 1 or 2. Of course, the above are merely some examples, and are not limited thereto, as long as the absolute value of the first weighting conversion rate is greater than the absolute value of the second weighting conversion rate.
[0250] Exemplarily, the SCC identifier may include, but is not limited to, a sequence level SCC identifier, a frame level SCC identifier, a slice level SCC identifier, a tile level SCC identifier, a patch level SCC identifier, a CTU level SCC identifier, an LCU level SCC identifier, a block level SCC identifier, a CU level SCC identifier, a PU level SCC identifier, etc. For example, a sequence level SCC identifier corresponding to a current block may be determined as the SCC identifier corresponding to the current block, or a frame level SCC identifier corresponding to the current block may be determined as the SCC identifier corresponding to the current block, and by this analogy, an SCC identifier corresponding to the current block may be obtained.
[0251] Exemplarily, the encoding side may determine whether the current block belongs to screen content coding or non-screen content coding. If the current block belongs to screen content coding, the encoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the current block belongs to non-screen content coding, the encoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate. Alternatively, the encoding side may obtain an SCC identifier corresponding to the current block, and if the SCC identifier is used to indicate that the current block belongs to screen content coding, the encoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the encoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate.
[0252] The encoding side can encode an SCC identifier (e.g., a sequence level SCC identifier, a frame level SCC identifier, a slice level SCC identifier, etc.) into the bitstream, so that the decoding side can parse the SCC identifier from the bitstream and determine the SCC identifier as the SCC identifier corresponding to the current block, for example, the sequence level SCC identifier corresponding to the current block can be determined as the SCC identifier corresponding to the current block. As described above, the decoding side can know the SCC identifier corresponding to the current block, and if the SCC identifier is used to indicate that the current block belongs to screen content coding, the decoding side determines that the weighted transformation rate of the current block is the first weighted transformation rate. If the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the decoding side determines that the weighted transformation rate of the current block is the second weighted transformation rate. For example, if the SCC identifier is a first value, it is used to indicate that the current block belongs to screen content coding, and if the SCC identifier is a second value, it is used to indicate that the current block belongs to non-screen content coding. The first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above are merely examples of the first and second values and are not limiting thereto.
[0253] Instead of encoding the SCC identifier into the bitstream, the encoding side may implicitly derive the SCC identifier using information consistent with the decoding side, and the decoding side may then implicitly derive the SCC identifier and determine the SCC identifier as the SCC identifier corresponding to the current block. For example, if all of the consecutive frames are screen content coding, the decoding side derives that the current frame is screen content coding, and therefore the decoding side implicitly derives a frame-level SCC identifier and determines the SCC identifier as the SCC identifier corresponding to the current block, and the SCC identifier is used to indicate that the current block belongs to screen content coding. For example, if all of the consecutive frames are non-screen content coding, the decoding side derives that the current frame is non-screen content coding, and therefore the decoding side implicitly derives a frame-level SCC identifier and uses the SCC identifier to indicate that the current block belongs to non-screen content coding. For example, if the occupancy rate of the IBC mode for all selected modes of the current image is less than a certain percentage, the next frame is determined as non-screen content coding, otherwise it continues to be determined as screen content coding. Of course, the above method is merely an example of implicitly deriving an SCC identifier, and does not limit the implicit derivation method. As described above, the decoding side can obtain an SCC identifier corresponding to a current block, and when the SCC identifier is used to indicate that the current block belongs to screen content coding, the decoding side determines that the weighted transformation rate of the current block is a first weighted transformation rate. When the SCC identifier is used to indicate that the current block belongs to non-screen content coding, the decoding side determines that the weighted transformation rate of the current block is a second weighted transformation rate. For example, when the SCC identifier is a first value, it is used to indicate that the current block belongs to screen content coding, and when the SCC identifier is a second value, it is used to indicate that the current block belongs to non-screen content coding.
[0254] As described above, the weight conversion rate of the current block may be the first weight conversion rate or the second weight conversion rate, that is, the weight conversion rate of the current block is switchable, and the switching of the weight conversion rate depends on a certain level of SCC explicit identifier or SCC implicit identifier, where the SCC explicit identifier is encoding scc_flag (SCC identifier) into the bitstream so that the decoding side parses the SCC identifier from the bitstream, and the SCC implicit identifier is adaptively deriving the SCC identifier based on information available to the decoding side.
[0255] The SCC identifier at a level may include a sequence-level SCC identifier indicating the SCC identifier of the current sequence and used as the SCC identifier of all blocks belonging to the current sequence; a frame-level SCC identifier indicating the SCC identifier of the current frame and used as the SCC identifier of all blocks belonging to the current frame; a slice-level SCC identifier indicating the SCC identifier of the current Slice and used as the SCC identifier of all blocks belonging to the current Slice; a tile-level SCC identifier indicating the SCC identifier of the current Tile and used as the SCC identifier of all blocks belonging to the current Tile; and a tile-level SCC identifier indicating the SCC identifier of the current Patch and used as the SCC identifier of all blocks belonging to the current Patch. the SCC identifier at the patch level being used as a identifier for a current CTU; the SCC identifier at the CTU level being used as the SCC identifier for all blocks that belong to the current CTU; the SCC identifier at the LCU level being used as the SCC identifier for all blocks that belong to the current LCU; the SCC identifier at the block level being used as the SCC identifier for all blocks that belong to the current block; the SCC identifier at the CU level being used as the SCC identifier for the current CU; and the SCC identifier at the PU level being used as the SCC identifier for the current PU.
[0256] Exemplarily, the second weighted transform rate may be a default weighted transform rate, and when the SCC identifier is used to indicate that the current block belongs to non-screen content coding, there is no need to switch the weighted transform rate, i.e., it is determined that the weighted transform rate of the current block is the second weighted transform rate. When the SCC identifier is used to indicate that the current block belongs to screen content coding, there is no need to switch the weighted transform rate, i.e., it is determined that the weighted transform rate of the current block is the first weighted transform rate. Or, the first weighted transform rate may be a default weighted transform rate, and when the SCC identifier is used to indicate that the current block belongs to non-screen content coding, there is no need to switch the weighted transform rate, i.e., it is determined that the weighted transform rate of the current block is the second weighted transform rate. When the SCC identifier is used to indicate that the current block belongs to screen content coding, there is no need to switch the weighted transform rate, i.e., it is determined that the weighted transform rate of the current block is the first weighted transform rate.
[0257] As described above, when the current block belongs to screen content coding, the weighted transformation ratio of the current block is the first weighted transformation ratio, and when the current block belongs to non-screen content coding, the weighted transformation ratio of the current block is the second weighted transformation ratio, and the absolute value of the first weighted transformation ratio is greater than the absolute value of the second weighted transformation ratio, for example, the absolute value of the first weighted transformation ratio is 4, and the absolute value of the second weighted transformation ratio is 1, so that the absolute value of the weighted transformation ratio of the current block belonging to the SCC sequence increases, that is, the transformation speed increases.
[0258] In another possible embodiment, the weight transformation rate indication information of the current block may be a weight transformation rate switching identifier corresponding to the current block, the first indication information is used to indicate that the current block does not need a weight transformation rate switching, and the second indication information is used to indicate that the current block needs a weight transformation rate switching. Then, a weight transformation rate switching identifier corresponding to the current block may be obtained, and a weight transformation rate of the current block may be determined according to the weight transformation rate switching identifier. For example, when the weight transformation rate switching identifier is used to indicate that the current block does not need a weight transformation rate switching, the weight transformation rate of the current block may be a first weight transformation rate, and when the weight transformation rate switching identifier is used to indicate that the current block needs a weight transformation rate switching, the weight transformation rate of the current block may be a second weight transformation rate. The absolute value of the first weight transformation rate is not equal to the absolute value of the second weight transformation rate.
[0259] For example, the absolute value of the first weighting conversion ratio may be greater than the absolute value of the second weighting conversion ratio, for example, the absolute value of the first weighting conversion ratio may be 4, and the absolute value of the second weighting conversion ratio may be 1 or 2. Or, the absolute value of the first weighting conversion ratio may be 2, and the absolute value of the second weighting conversion ratio may be 1. Or, the absolute value of the first weighting conversion ratio may be 8, and the absolute value of the second weighting conversion ratio may be 1, 2, or 4. Also, for example, the absolute value of the first weighting conversion ratio may be smaller than the absolute value of the second weighting conversion ratio, for example, the absolute value of the first weighting conversion ratio may be 1, and the absolute value of the second weighting conversion ratio may be 2, 4, or 8. Or, the absolute value of the first weighting conversion ratio may be 2, and the absolute value of the second weighting conversion ratio may be 4 or 8. Or, the absolute value of the first weighting conversion ratio may be 4, and the absolute value of the second weighting conversion ratio may be 8. Of course, the above are only some examples and are not limiting as long as the absolute value of the first weighting conversion factor is equal to the absolute value of the second weighting conversion factor.
[0260] For example, the weight conversion rate switching identifier may include, but is not limited to, a sequence level weight conversion rate switching identifier, a frame level weight conversion rate switching identifier, a slice level weight conversion rate switching identifier, a tile level weight conversion rate switching identifier, a patch level weight conversion rate switching identifier, a CTU level weight conversion rate switching identifier, an LCU level weight conversion rate switching identifier, a block level weight conversion rate switching identifier, a CU level weight conversion rate switching identifier, a PU level weight conversion rate switching identifier, etc.
[0261] For example, the sequence level weight conversion rate switching identifier corresponding to the current block can be determined as the weight conversion rate switching identifier corresponding to the current block, or the frame level weight conversion rate switching identifier corresponding to the current block can be determined as the weight conversion rate switching identifier corresponding to the current block. By this analogy, it is possible to obtain the weight conversion rate switching identifier corresponding to the current block.
[0262] Exemplarily, the first weighted transformation rate may be the default weighted transformation rate, and the encoding side may know whether the current block needs to switch the weighted transformation rate, and if the current block does not need to switch the weighted transformation rate, the encoding side may determine that the weighted transformation rate of the current block is the first weighted transformation rate. If the current block needs to switch the weighted transformation rate, the encoding side may determine that the weighted transformation rate of the current block is the second weighted transformation rate. Alternatively, the encoding side may know a weighted transformation rate switching identifier corresponding to the current block, and if the weighted transformation rate switching identifier is used to indicate that the current block does not need to switch the weighted transformation rate, the encoding side may determine that the weighted transformation rate of the current block is the first weighted transformation rate. If the weighted transformation rate switching identifier is used to indicate that the current block needs to switch the weighted transformation rate, the encoding side may determine that the weighted transformation rate of the current block is the second weighted transformation rate.
[0263] For example, the encoding side determines a rate-distortion cost value 1 corresponding to a first weighting transformation rate and a rate-distortion cost value 2 corresponding to a second weighting transformation rate, and determines that the current block does not need a weighting transformation rate switch if the rate-distortion cost value 1 is smaller than the rate-distortion cost value 2, and determines that the current block needs a weighting transformation rate switch if the rate-distortion cost value 2 is smaller than the rate-distortion cost value 1.
[0264] The encoding side can code a weight conversion rate switching identifier (such as a sequence level weight conversion rate switching identifier) into the bitstream, so that the decoding side analyzes the weight conversion rate switching identifier from the bitstream and determines the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block. As described above, the decoding side can know the weight conversion rate switching identifier corresponding to the current block, and if the weight conversion rate switching identifier is used to indicate that the current block does not need weight conversion rate switching, the decoding side determines that the weight conversion rate of the current block is the first weight conversion rate. If the weight conversion rate switching identifier is used to indicate that the current block needs weight conversion rate switching, the decoding side determines that the weight conversion rate of the current block is the second weight conversion rate. For example, if the weight conversion rate switching identifier is a first value, it indicates that the current block does not need weight conversion rate switching, and if the weight conversion rate switching identifier is a second value, it indicates that the current block needs weight conversion rate switching. The first value is 1 and the second value is 0, or the first value is 0 and the second value is 1. Of course, the above is merely an example of the first value and the second value, and is not limited thereto.
[0265] Instead of the encoding side coding the weight conversion rate switching identifier into the bit stream, the decoding side can also implicitly derive the weight conversion rate switching identifier, and determine the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block. For example, if all of the consecutive blocks need weight conversion rate switching, the current block also needs weight conversion rate switching, and the decoding side implicitly derives the weight conversion rate switching identifier, and determines the weight conversion rate switching identifier as the weight conversion rate switching identifier corresponding to the current block, and the weight conversion rate switching identifier indicates that the current block needs weight conversion rate switching. If none of the consecutive blocks need weight conversion rate switching, the current block also does not need weight conversion rate switching, and the decoding side implicitly derives the weight conversion rate switching identifier, and the weight conversion rate switching identifier indicates that the current block does not need weight conversion rate switching. Of course, the above method is only an example of implicitly deriving the weight conversion rate switching identifier, and does not limit this derivation method. As described above, the decoding side can know the weight transformation rate switching identifier corresponding to the current block, and if the weight transformation rate switching identifier indicates that the current block does not need weight transformation rate switching, it determines that the weight transformation rate of the current block is the first weight transformation rate, and if the weight transformation rate switching identifier indicates that the current block needs weight transformation rate switching, it determines that the weight transformation rate of the current block is the second weight transformation rate.
[0266] As described above, the weight transformation rate of the current block may be the first weight transformation rate or the second weight transformation rate, that is, the weight transformation rate of the current block is switchable, and the switching of the weight transformation rate depends on a weight transformation rate switching identifier (refine_flag) of a certain level, and the refine_flag is an explicit identifier or an implicit identifier, where the explicit identifier indicates that the refine_flag is encoded into the bitstream so that the decoding side analyzes the refine_flag from the bitstream, and the implicit identifier indicates that the encoding / decoding side adaptively derives the refine_flag from the obtained information.
[0267] Exemplarily, the refine_flag at a certain level may be a sequence-level refine_flag indicating the refine_flag of the current sequence and used as the refine_flag of all blocks belonging to the current sequence, a frame-level refine_flag indicating the refine_flag of the current frame and used as the refine_flag of all blocks belonging to the current frame, a slice-level refine_flag indicating the refine_flag of the current Slice and used as the refine_flag of all blocks belonging to the current Slice, a tile-level refine_flag indicating the refine_flag of the current Tile and used as the refine_flag of all blocks belonging to the current Tile, and a current Patch refine_flag indicating the refine_flag of the current Patch and used as the refine_flag of all blocks belonging to the current Patch. refine_flag at the patch level used as refine_flag, refine_flag at the CTU level indicating the refine_flag of the current CTU and used as the refine_flag of all blocks belonging to the current CTU, refine_flag at the LCU level indicating the refine_flag of the current LCU and used as the refine_flag of all blocks belonging to the current LCU, refine_flag at the block level indicating the refine_flag of the current block and used as the refine_flag belonging to the current block, refine_flag at the CU level indicating the refine_flag of the current CU and used as the refine_flag belonging to the current CU, and refine_flag at the PU level indicating the refine_flag of the current PU and used as the refine_flag belonging to the current PU. Of course, the above are merely some examples and are not limited thereto.
[0268] Exemplarily, the first weight transformation rate may be a default weight transformation rate, and when the weight transformation rate switching identifier is used to indicate that the current block does not need weight transformation rate switching, the weight transformation rate is not switched, i.e., it is determined that the weight transformation rate of the current block is the first weight transformation rate, and when the weight transformation rate switching identifier is used to indicate that the current block needs weight transformation rate switching, the weight transformation rate is switched, i.e., it is determined that the weight transformation rate of the current block is the second weight transformation rate.
[0269] Example 10: In Examples 1 to 4, the encoding side / decoding side needs to obtain the weighted prediction angle and weighted prediction position of the current block, and in Example 9, the weighted conversion rate of the current block, for example the first weighted conversion rate or the second weighted conversion rate, can be obtained, and then the following method is adopted to obtain the weighted prediction angle and weighted prediction position of the current block.
[0270] In method 1, the encoding side and the decoding side agree to use the same weighted prediction angle as the weighted prediction angle of the current block, and agree to use the same weighted prediction position as the weighted prediction position of the current block. For example, the encoding side and the decoding side agree to use weighted prediction angle A as the weighted prediction angle of the current block, and the encoding side and the decoding side agree to use weighted prediction position 4 as the weighted prediction position of the current block.
[0271] In method 2, the encoding side constructs a weighted prediction angle list including at least one weighted prediction angle such as weighted prediction angle A and weighted prediction angle B. The encoding side constructs a weighted prediction position list including at least one weighted prediction position, for example, weighted prediction position 0 to weighted prediction position 6. Each weighted prediction angle in the weighted prediction angle list is traversed in order, and each weighted prediction position in the weighted prediction position list is traversed, that is, each combination of each weighted prediction angle and each weighted prediction position is traversed. Each combination is taken as the weighted prediction angle and weighted prediction position obtained in step a1, and a weighted prediction value of the current block is obtained based on the weighted prediction angle, the weighted prediction position, and the weight conversion rate.
[0272] For example, when the encoding side traverses weighted prediction angle A and weighted prediction position 0, it obtains a weighted prediction value of the current block based on weighted prediction angle A and weighted prediction position 0. When the encoding side traverses weighted prediction angle A and weighted prediction position 1, it obtains a weighted prediction value of the current block based on weighted prediction angle A and weighted prediction position 1. When the encoding side traverses weighted prediction angle B and weighted prediction position 0, it obtains a weighted prediction value of the current block based on weighted prediction angle B and weighted prediction position 0, and so on. The encoding side can obtain a weighted prediction value of the current block based on each combination of weighted prediction angle and weighted prediction position.
[0273] The encoding side can obtain a weighted prediction value of the current block based on a combination of the weighted prediction angle and the weighted prediction position, and then determine a rate-distortion cost value based on the weighted prediction value of the current block. There is no restriction on the method of determining the rate-distortion cost value, and the encoding side can obtain the rate-distortion cost value of each combination, and select the minimum rate-distortion cost value from all the rate-distortion cost values.
[0274] Then, the encoding side sets the combination of weighted prediction angle and weighted prediction position corresponding to the minimum rate-distortion cost value as a target weighted prediction angle and target weighted prediction position, and finally encodes 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 a bitstream.
[0275] At the decoding side, the decoding side constructs a weighted prediction angle list, which is the same as the weighted prediction angle list of the encoding side, and the weighted prediction angle list includes at least one weighted prediction angle. A weighted prediction position list is constructed, which is the same as the weighted prediction position list of the encoding side, and the weighted prediction position list includes at least one weighted prediction position. 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.
[0276] Application scene 1: When the encoding side sends the encoding bit stream to the decoding side, the encoding bit stream can include indication information 1 for indicating the weight prediction angle (i.e. target weight prediction angle) of the current block and the weight prediction position (i.e. target weight prediction position) of the current block.For example, when indication information 1 is 0, it indicates the first weight prediction angle in the weight prediction angle list, and is used to indicate the first weight prediction position in the weight prediction position list; when indication information 1 is 1, it indicates the first weight prediction angle in the weight prediction angle list, and is used to indicate the second weight prediction position in the weight prediction position list.By analogy, as long as it is agreed between the encoding side and the decoding side, the value of indication information 1 is used to indicate which weight prediction angle and which weight prediction position, it is not limited in this embodiment.
[0277] After receiving the encoded bitstream, the decoding side analyzes the indication information 1 from the encoded bitstream, and based on the indication information 1, the decoding side can select a weighted prediction angle corresponding to the indication information 1 from the weighted prediction angle list as a weighted prediction angle of the current block. Based on the indication information 1, the decoding side can select a weighted prediction position corresponding to the indication information 1 from the weighted prediction position list as a weighted prediction position of the current block.
[0278] Application scene 2: When the encoding side transmits the encoded bit stream to the decoding side, the encoded bit stream may include indication information 2 and indication information 3. The indication information 2 is used to indicate the target weighted prediction angle of the current block, for example, index value 1 in the weighted prediction angle list of the target weighted prediction angle, where index value 1 indicates which weighted prediction angle the target weighted prediction angle is in the weighted prediction angle list. The indication information 3 is used to indicate the target weighted prediction position of the current block, for example, index value 2 in the weighted prediction position list of the target weighted prediction position, where index value 2 indicates which weighted prediction position the target weighted prediction position is in the weighted prediction position list. After receiving the encoded bit stream, the decoding side analyzes the indication information 2 and indication information 3 from the encoded bit stream, and selects the weighted prediction angle corresponding to the index value 1 from the weighted prediction angle list as the weighted prediction angle of the current block based on the indication information 2. Based on the indication information 3, selects the weighted prediction position corresponding to the index value 2 from the weighted prediction position list as the weighted prediction position of the current block.
[0279] Application scene 3: The encoding side and the decoding side can promise a preferred setting combination, and there is no restriction on this preferred setting combination, and it can be set based on actual experience, for example, the encoding side and the decoding side promise a preferred setting combination 1 including weighted prediction angle A and weighted prediction position 4, and a preferred setting combination 2 including weighted prediction angle B and weighted prediction position 4.
[0280] After determining the target weight prediction angle and the target weight prediction position of the current block, the encoding side determines whether the target weight prediction angle and the target weight prediction position are a preferred setting combination. If so, when the encoding side sends the encoded bit stream to the decoding side, the encoded bit stream can 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, when the indication information 4 is a first value (for example, 0), it 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 indication information 5 is 0, it is used to indicate that the current block adopts the preferred setting combination 1, and when the indication information 5 is 1, it is used to indicate that the current block adopts the preferred setting combination 2.
[0281] After receiving the encoded bitstream, the decoding side analyzes the indication information 4 and the indication information 5 from the encoded bitstream, and based on the indication information 4, the decoding side determines whether the current block adopts the preferred setting combination. If the indication information 4 is a first value, it determines that the current block adopts the preferred setting combination. If the current block adopts the preferred setting combination, the decoding side determines which preferred setting combination the current block adopts based on the indication information 5. For example, if the indication information 5 is 0, it determines that the current block adopts the preferred setting combination 1, that is, the weighted prediction angle of the current block is the weighted prediction angle A, and the weighted prediction position of the current block is the weighted prediction position 4. For example, if the indication information 5 is 1, it determines 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 4.
[0282] For example, when the encoding side and the decoding side promise only one set of preferred setting combinations, such as a preferred setting combination including weighted prediction angle A and weighted prediction position 4, the encoding bitstream may not include indication information 5, but may include indication information 4 to indicate that the current block adopts the preferred setting combination. After analyzing the indication information 4 from the encoding bitstream, the decoding side determines that the current block adopts the preferred setting combination if the indication information 4 is a first value, and determines that the weighted prediction angle of the current block is weighted prediction angle A and the weighted prediction position of the current block is weighted prediction position 4 according to the preferred setting combination.
[0283] Application scene 4: The encoding side and the decoding side can agree on a preferred setting combination, and the encoding side determines the target weight prediction angle and the target weight prediction position of the current block, and then determines whether the target weight prediction angle and the target weight prediction position are a preferred setting combination. If not, when the encoding side sends the encoding bit stream to the decoding side, the encoding 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, when the indication information 4 is a second value (for example, 1), it 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. For example, when the indication information 6 is 0, it is used to indicate the first weight prediction angle in the weight prediction angle list and the first weight prediction position in the weight prediction position list, and thus it is inferred.
[0284] After receiving the encoded bitstream, the decoding side analyzes the indication information 4 and the indication information 6 from the encoded bitstream, and based on the indication information 4, the decoding side determines whether the current block adopts the preferred setting combination. If the indication information 4 is a second value, it determines that the current block does not adopt the preferred setting combination. If the current block does not adopt the preferred setting combination, the decoding side can select, based on the indication information 6, a weighted prediction angle corresponding to the indication information 6 from the weighted prediction angle list as the weighted prediction angle of the current block, and based on the indication information 6, the decoding side can select a weighted prediction position corresponding to the indication information 6 from the weighted prediction position list as the weighted prediction position of the current block.
[0285] Application scene 5: The encoding side and the decoding side can agree on a preferred setting combination, and the encoding side determines the target weight prediction angle and the target weight prediction position of the current block, and then determines whether the target weight prediction angle and the target weight prediction position are a preferred setting combination. Otherwise, when the encoding side sends the encoding bit stream to the decoding side, the encoding bit stream includes 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 the preferred setting combination, for example, when the indication information 4 is a second value, it indicates that the current block does not adopt the preferred setting combination. The indication information 7 is used to indicate the target weight prediction angle of the current block, for example, the index value 1 in the weight prediction angle list of the target weight prediction angle, the index value 1 representing the weight prediction angle of the target weight prediction angle in the weight prediction angle list, and the indication information 8 is used to indicate the target weight prediction position of the current block, for example, the index value 2 in the weight prediction position list of the target weight prediction position, the index value 2 representing the weight prediction position of the target weight prediction position in the weight prediction position list.
[0286] 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 based on the indication information 4, the decoding side determines whether the current block adopts the preferred setting combination. If the indication information 4 is a second value, it determines that the current block does not adopt the preferred setting combination. If the current block does not adopt the preferred setting combination, the decoding side selects, based on the indication information 7, the weighted prediction angle corresponding to the index value 1 from the weighted prediction angle list as the weighted prediction angle of the current block. Based on the indication information 8, the decoding side selects, based on the indication information 8, the weighted prediction position corresponding to the index value 2 from the weighted prediction position list as the weighted prediction position of the current block.
[0287] Example 11: In Examples 1 to 4, the encoding side / decoding side needs to obtain the weight conversion rate of the current block, and if the current block supports the weight conversion rate switching mode, the following method is adopted to obtain the weight conversion rate of the current block: obtain weight conversion rate indication information of the current block, select a weight conversion rate corresponding to the weight conversion rate indication information from a preset lookup table, and the preset lookup table includes at least two weight conversion rates; and determine the selected weight conversion rate as the weight conversion rate of the current block.
[0288] Since the pre-set lookup table includes at least two weight conversion rates, when the current block supports a weight conversion rate switching mode, the weight conversion rate of the current block can be selected from at least two weight conversion rates, i.e., the weight conversion rate of the current block is variable, thereby enabling the weight conversion rate to be adaptively switched rather than adopting a uniform weight conversion rate.
[0289] By way of example, if the switching control information allows the current block to start the weight conversion rate switching mode, the current block supports the weight conversion rate switching mode; if the switching control information does not allow the current block to start the weight conversion rate switching mode, the current block does not support the weight conversion rate switching mode. For whether the current block supports the weight conversion rate switching mode, please refer to Example 9.
[0290] In one possible embodiment, the preset lookup table may include at least two weight conversion ratios, and the weight conversion ratio indication information may include weight conversion ratio index information (used to indicate a specific weight conversion ratio among all weight conversion ratios in the lookup table), based on which a weight conversion ratio corresponding to the weight conversion ratio index information can be selected from the lookup table.
[0291] On the encoding side, when there is only one lookup table, for each weighting conversion factor in the lookup table, the encoding side can determine a rate-distortion cost value corresponding to the weighting conversion factor, and set the weighting conversion factor corresponding to the minimum rate-distortion cost value as the target weighting conversion factor of the current block, and determine index information in the lookup table of the target weighting conversion factor, i.e., weighting conversion factor index information indicating which weighting conversion factor in the lookup table it is.
[0292] In the decoding side, when there is only one lookup table, when the encoding side transmits the encoded bit stream of the current block to the decoding side, weight conversion rate index information for indicating index information in the lookup table of the target weight conversion rate can be added to the encoded bit stream, and the decoding side selects the weight conversion rate corresponding to the weight conversion rate index information from the lookup table as the target weight conversion rate of the current block.
[0293] Example 12: In Examples 1 to 4, the encoding side / decoding side needs to obtain the weighted prediction angle of the current block, the weighted prediction position of the current block, and the weighted conversion rate of the current block. In Example 11, the weighted conversion rate of the current block can be obtained, and then the weighted prediction angle and weighted prediction position of the current block can be obtained by adopting the following method.
[0294] In method 1, the encoding side and the decoding side agree to use the same weighted prediction angle as the weighted prediction angle of the current block, and agree to use the same weighted prediction position as the weighted prediction position of the current block. For example, the encoding side and the decoding side agree to use weighted prediction angle A as the weighted prediction angle of the current block, and the encoding side and the decoding side agree to use weighted prediction position 4 as the weighted prediction position of the current block.
[0295] As the second method, the encoding side constructs a weighted prediction angle list including at least one weighted prediction angle. The encoding side constructs a weighted prediction position list including at least one weighted prediction position. The encoding side constructs at least two lookup tables, taking the first lookup table and the second lookup table as examples, the first lookup table includes at least one weighted conversion ratio, and the second lookup table includes at least one weighted conversion ratio. The encoding side determines a target lookup table, and the determination method refers to the embodiment 11, and takes the target lookup table as an example that the first lookup table is the first lookup table. The encoding side traverses each weighted prediction angle in the weighted prediction angle list in order, traverses each weighted prediction position in the weighted prediction position list, and traverses each weighted conversion ratio in the target lookup table, that is, traverses the combination of each weighted prediction angle, each weighted prediction position, and each weighted conversion ratio. For the combination of the weighted prediction angle, weighted prediction position and weighted conversion rate obtained in step a1, a weighted prediction value of the current block is obtained based on the weighted prediction angle, weighted prediction position and weighted conversion rate.
[0296] In this way, the encoding side can obtain a weighted predicted value of the current block according to each combination. After obtaining the weighted predicted value of the current block, the encoding side can determine a rate-distortion cost value according to the weighted predicted value of the current block, that is, the encoding side can obtain the rate-distortion cost value of each combination, and select the minimum rate-distortion cost value from all the rate-distortion cost values.
[0297] Then, the encoding side determines the weighted prediction angle, weighted prediction position, and weight conversion rate corresponding to the minimum rate-distortion cost value as a target weighted prediction angle, a target weighted prediction position, and a target weight conversion rate, respectively, and finally encodes the index value of the target weighted prediction angle in the weighted prediction angle list, the index value of the target weighted prediction position in the weighted prediction position list, and the index value of the target weight conversion rate in the target look-up table into the bitstream of the current block.
[0298] Regarding the decoding side, the decoding side constructs the weight prediction angle list that is the same as the weight prediction angle list of the encoding side, the decoding side constructs the weight prediction position list that is the same as the weight prediction position list of the encoding side, and the decoding side constructs the first lookup table that is the same as the first lookup table of the encoding side and the second lookup table that is the same as the second lookup table of the encoding side. After receiving the encoding bit stream of the current block, the decoding side analyzes indication information from the encoding bit stream, and according to the indication information, selects one weight prediction angle from the weight prediction angle list as the weight prediction angle of the current block, and according to the indication information, selects one weight prediction position from the weight prediction position list as the weight prediction position of the current block, and the method of obtaining the weight prediction angle and the weight prediction position refers to the tenth embodiment, and the description thereof is omitted here. After receiving the encoded bitstream of the current block, the decoding side can determine a target lookup table (e.g., the first lookup table or the second lookup table), and select one weight conversion rate from the target lookup table as the weight conversion rate of the current block based on the weight conversion rate index information. For the method of obtaining the weight conversion rate, refer to Example 11, and the description thereof will be omitted here.
[0299] Example 13: In the above-mentioned Example 1 to Example 3, the encoding side / decoding side needs to obtain a motion information candidate list, and for example, obtains at least one available motion information to be added to the motion information candidate list, and obtains the motion information candidate list based on the at least one available motion information. Exemplarily, the at least one available motion information includes at least one of spatial domain motion information, time domain motion information, HMVP (History-based Motion Vector Prediction) motion information, and preset motion information, but is not limited thereto.
[0300] Exemplarily, for spatial domain motion information, the following method is adopted to obtain at least one available motion information to be added to the motion information candidate list: for a spatial domain neighboring block of a current block, if a spatial domain neighboring block exists and the spatial domain neighboring block adopts an inter prediction mode, determine the motion information of the spatial domain neighboring block as the available motion information.
[0301] Exemplarily, for time-domain motion information, the following method is adopted to obtain at least one available motion information to be added to the motion information candidate list: based on a preset position of the current block (e.g., the upper left corner pixel position of the current block), select a time-domain neighboring block corresponding to the preset position from the reference frame of the current block, and determine the motion information of the time-domain neighboring block as the available motion information.
[0302] Exemplarily, for the pre-set motion information, the following method is adopted to obtain at least one available motion information to be added to the motion information candidate list: determine the pre-set motion information as the available motion information, and the pre-set motion information may include, but is not limited to, default motion information derived based on candidate motion information already present in the motion information candidate list.
[0303] In one possible embodiment, a motion information candidate list is obtained based on at least one available motion information in the following manner: for available motion information currently to be added to the motion information candidate list, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with any candidate motion information already present in the motion information candidate list, the unidirectional motion information is added to the motion information candidate list; if the available motion information is bidirectional motion information, the bidirectional motion information is clipped to first unidirectional motion information and second unidirectional motion information; and if the first unidirectional motion information does not overlap with any candidate motion information already present in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list.
[0304] In the above embodiment, the first unidirectional motion information may be unidirectional motion information pointing to a reference frame in a first reference frame list, and the second unidirectional motion information may be unidirectional motion information pointing to a reference frame in a second reference frame list.
[0305] In one possible embodiment, List0 may be the forward reference frame list and List1 may be the backward reference frame list.
[0306] In the above embodiment, the overlap check operation for the unidirectional motion information and the candidate motion information already present in the motion information candidate list may include, but is not limited to, determining that the unidirectional motion information overlaps with the candidate motion information if the POC (Picture Order Count, display order) of the reference frame pointed to by the unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information and the motion vector of the unidirectional motion information is the same as the motion vector of the candidate motion information, and otherwise determining that the unidirectional motion information does not overlap with the candidate motion information.
[0307] The overlap check operation for the first unidirectional motion information and the candidate motion information already existing in the motion information candidate list may include, but is not limited to, determining that the first unidirectional motion information overlaps with the candidate motion information if the reference frame list pointed to by the first unidirectional motion information is the same as the reference frame list pointed to by the candidate motion information, and the refIdx of the first unidirectional motion information is the same as the refIdx of the candidate motion information, and the motion vector of the first unidirectional motion information is the same as the motion vector of the candidate motion information, and determining that the first unidirectional motion information does not overlap with the candidate motion information if not; or determining that the first unidirectional motion information does not overlap with the candidate motion information if the POC of the reference frame pointed to by the first unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the first unidirectional motion information is the same as the motion vector of the candidate motion information, and determining that the first unidirectional motion information does not overlap with the candidate motion information if not.
[0308] The overlap check operation for the second unidirectional motion information and the candidate motion information already existing in the motion information candidate list may include, but is not limited to, determining that the second unidirectional motion information overlaps with the candidate motion information if the reference frame list pointed to by the second unidirectional motion information is the same as the reference frame list pointed to by the candidate motion information, and the refIdx of the second unidirectional motion information is the same as the refIdx of the candidate motion information, and the motion vector of the second unidirectional motion information is the same as the motion vector of the candidate motion information, and determining that the second unidirectional motion information does not overlap with the candidate motion information if not; or determining that the second unidirectional motion information does not overlap with the candidate motion information if the POC of the reference frame pointed to by the second unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the motion vector of the second unidirectional motion information is the same as the motion vector of the candidate motion information, and determining that the second unidirectional motion information does not overlap with the candidate motion information if not.
[0309] For example, the above process needs to compare whether the POC of the reference frame pointed to by the unidirectional motion information is the same as the POC of the reference frame pointed to by the candidate motion information, and the POC of the reference frame is merely an example of checking whether the reference frames are the same, and other attributes such as the DOC (Decoding Order Count) of the reference frame can be used to check whether the reference frames are the same, and there is no limitation thereto. As described above, it is also possible to compare whether the DOC of the reference frame pointed to by the unidirectional motion information is the same as the DOC of the reference frame pointed to by the candidate motion information, and the implementation principle is similar to that of POC.
[0310] Example 14: With respect to Example 13, the motion information candidate list can be obtained by using spatial domain motion information (in this specification, the motion information of the spatial domain neighboring blocks of the current block is referred to as spatial domain motion information) and / or temporal domain motion information (in this specification, the motion information of the temporal domain neighboring blocks of the current block is referred to as temporal domain motion information), and therefore, it is necessary to first select available motion information from the spatial domain motion information and / or temporal domain motion information. Referring to Figure 9A, which is a schematic diagram of the spatial domain neighboring blocks of the current block, the spatial domain motion information may be the motion information of spatial domain neighboring blocks such as F, G, C, A, B, D, and the temporal domain motion information may be at least one.
[0311] For the spatial domain motion information, the following scheme can be adopted to obtain the available motion information to be added to the motion information candidate list.
[0312] For method 11, referring to FIG. 9A, F, G, C, A, B, and D are spatial domain neighboring blocks of the current block E, and the "availability" of the motion information of F, G, C, A, B, and D can be determined. Illustratively, if F exists and adopts an inter prediction mode, the motion information of F is available motion information, otherwise the motion information of F is unavailable motion information. If G exists and adopts an inter prediction mode, the motion information of G is available motion information, otherwise the motion information of G is unavailable motion information. If C exists and adopts an inter prediction mode, the motion information of C is available motion information, otherwise the motion information of C is unavailable motion information. If A exists and adopts an inter prediction mode, the motion information of A is available motion information, otherwise the motion information of A is unavailable motion information. If B exists and adopts an inter prediction mode, the motion information of B is available motion information, otherwise the motion information of B is unavailable motion information. If D exists and adopts an inter prediction mode, the motion information of D is available motion information, otherwise the motion information of D is unavailable motion information.
[0313] As the method 12, F, G, C, A, B, D are spatial domain neighboring blocks of the current block E, and determine the "availability" of the motion information of F, G, C, A, B, D. If F exists and adopts an inter prediction mode, the motion information of F is available motion information, otherwise, the motion information of F is unavailable motion information. If G exists and adopts an inter prediction mode, and the motion information of G is different from the motion information of F, the motion information of G is available motion information, otherwise, the motion information of G is unavailable motion information. If C exists and adopts an inter prediction mode, and the motion information of C is different from the motion information of G, the motion information of C is available motion information, otherwise, the motion information of C is unavailable motion information. If A exists and adopts an inter prediction mode, and the motion information of A is different from the motion information of F, the motion information of A is available motion information, otherwise, the motion information of A is unavailable motion information. If B exists and adopts an inter prediction mode, and the motion information of B is different from the motion information of G, the motion information of B is available motion information, otherwise, the motion information of B is unavailable motion information. If D exists and adopts inter prediction mode, and the motion information of D is different from the motion information of A and different from the motion information of G, the motion information of D is available motion information; otherwise, the motion information of D is unavailable motion information.
[0314] As a method 13, F, G, C, A, B, and D are spatial domain neighboring blocks of the current block E, and the "availability" of the motion information of F, G, C, A, B, and D can be determined. Illustratively, if F exists and adopts an inter prediction mode, the motion information of F is available motion information, otherwise the motion information of F is unavailable motion information. If G exists and adopts an inter prediction mode, and the motion information of G is different from the motion information of F, the motion information of G is available motion information, otherwise the motion information of G is unavailable motion information. If C exists and adopts an inter prediction mode, and the motion information of C is different from the motion information of G, the motion information of C is available motion information, otherwise the motion information of C is unavailable motion information. If A exists and adopts an inter prediction mode, and the motion information of A is different from the motion information of F, the motion information of A is available motion information, otherwise the motion information of A is unavailable motion information. If B exists and adopts an inter prediction mode, the motion information of B is available motion information, otherwise the motion information of B is unavailable motion information. If D exists and adopts inter prediction mode, and the motion information of D is different from the motion information of A and different from the motion information of G, the motion information of D is available motion information; otherwise, the motion information of D is unavailable motion information.
[0315] For example, in the method 12 and the method 13, when determining whether the motion information of the spatial domain adjacent block is available motion information, it may be necessary to compare whether the motion information of two spatial domain adjacent blocks is the same, for example, compare whether the motion information of G is the same as the motion information of F, and the comparison process of whether the motion information is the same is actually a motion information overlap check operation, and if the overlap check result is overlap, the motion information comparison result is the same, and if the overlap check result is not overlap, the motion information comparison result is different. For the motion information overlap check operation, refer to the following embodiment, and the description thereof will be omitted here.
[0316] For the time domain motion information, the following scheme can be adopted to obtain the available motion information to be added to the motion information candidate list.
[0317] In the manner 21, according to a preset position of a current block, a time-domain neighboring block corresponding to the preset position is selected from a reference frame of the current block, and motion information of the time-domain neighboring block is determined as available motion information. For example, if the current frame in which the current block is located is a B frame, unidirectional motion information or bidirectional motion information is derived according to a co-located block of a co-located reference frame, and the unidirectional motion information or bidirectional motion information is determined as available motion information. If the current frame is a P frame, unidirectional motion information is derived according to a co-located block of a co-located reference frame, and the unidirectional motion information is determined as available motion information.
[0318] Exemplarily, the co-located block is a time-domain neighboring block corresponding to a preset position of the current block in the co-located reference frame, and the preset position of the current block may be empirically set, and is not limited to the preset position of the current block, such as the upper left corner pixel position of the current block, the upper right corner pixel position of the current block, the lower left corner pixel position of the current block, the lower right corner pixel position of the current block, the center pixel position of the current block, etc. The co-located reference frame may be a preset reference frame, for example, a reference frame in List0 of the current block is set as the co-located reference frame, and may be a derived reference frame, for example, a reference frame closest to the current frame in List0 of the current block is set as the co-located reference frame, and may be a reference frame analyzed from the bitstream, for example, the decoding side can analyze the information of the co-located reference frame from the bitstream and then determine the co-located reference frame.
[0319] If the current frame in which the current block is located is a B frame, unidirectional motion information or bidirectional motion information is derived based on the motion information of the co-located block, and if the current frame in which the current block is located is a P frame, unidirectional motion information is derived based on the motion information of the co-located block.
[0320] As the method 22, a target position of a current block is determined according to a weighted prediction angle and a weighted prediction position of the current block, a time domain neighboring block corresponding to the target position is selected from a reference frame of the current block, and the motion information of the time domain neighboring block is determined as available motion information. For example, a target position of a current block can be determined according to a weighted prediction angle and a weighted prediction position of the current block, for example, a target position of a current block is determined according to an index value of a weighted prediction angle and a weighted prediction position of the current block. Then, a co-located block of a co-located reference frame can be determined according to a target position of a current block, and when a current frame in which a current block is located is a B frame, unidirectional motion information or bidirectional motion information is derived according to a co-located block of a co-located reference frame, and the unidirectional motion information or bidirectional motion information is available motion information. When a current frame is a P frame, unidirectional motion information is derived according to a co-located block of a co-located reference frame, and the unidirectional motion information is available motion information.
[0321] A co-located block is a time-domain neighboring block corresponding to a target position of a current block in a co-located reference frame, and the target position may be the top left corner pixel position, the top right corner pixel position, the bottom left corner pixel position, the bottom right corner pixel position, etc. of the current block.
[0322] For example, a weight matrix of the current block can be obtained based on the weight prediction angle of the current block and the weight prediction position of the current block. Referring to Figure 9B, since the proportion of the upper right weight portion is relatively small (black portion) and the correlation between the spatial domain motion information and the black portion is relatively low, the selection of time domain motion information is biased toward the upper right weight portion, thereby providing appropriate candidate motion information. Furthermore, the co-located block may be a time domain adjacent block corresponding to the upper right corner pixel position of the current block (i.e., the weight portion with a relatively small proportion), that is, the target position of the current block is the upper right corner pixel position of the current block.
[0323] Similarly, referring to Figure 9C, it can be determined that the target position of the current block is the lower right corner pixel position of the current block based on the weighted prediction angle of the current block and the weighted prediction position of the current block.Referring to Figure 9D, it can be determined that the target position of the current block is the lower left corner pixel position of the current block based on the weighted prediction angle of the current block and the weighted prediction position of the current block.
[0324] After obtaining the available motion information, for each available motion information (e.g., spatial domain motion information, time domain motion information, etc.), one or a combination of the following methods can be adopted to add the available motion information to the motion information candidate list.
[0325] In method 31, no duplication check process is performed. For example, if the available motion information is unidirectional motion information, the unidirectional motion information is added to the motion information candidate list. If the available motion information is bidirectional motion information, the bidirectional motion information is clipped to the first unidirectional motion information and the second unidirectional motion information, and a certain unidirectional motion information after clipping is added to the motion information candidate list, for example, the first unidirectional motion information can be added to the motion information candidate list.
[0326] Method 32 performs a half overlap check process, i.e., the remaining half of the bidirectional motion information is not checked for overlap. For example, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with the candidate motion information already existing in the motion information candidate list, the unidirectional motion information is added to the motion information candidate list. If the available motion information is bidirectional motion information, the bidirectional motion information is clipped to the first unidirectional motion information and the second unidirectional motion information, and a unidirectional motion information is added to the motion information candidate list, for example, if the first unidirectional motion information in the bidirectional motion information does not overlap with the candidate motion information already existing in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list.
[0327] As the method 33, a complete overlap check process is performed. For example, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with the candidate motion information already existing in the motion information candidate list, the unidirectional motion information is added to the motion information candidate list. If the available motion information is bidirectional motion information, the bidirectional motion information is clipped to the first unidirectional motion information and the second unidirectional motion information, and a certain unidirectional motion information is added to the motion information candidate list. For example, if the first unidirectional motion information in the bidirectional motion information does not overlap with the candidate motion information already existing in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list; if the first unidirectional motion information overlaps with the candidate motion information already existing in the motion information candidate list, and the second unidirectional motion information in the bidirectional motion information does not overlap with the candidate motion information already existing in the motion information candidate list, the second unidirectional motion information is added to the motion information candidate list.
[0328] In methods 31, 32 and 33, the first unidirectional motion information may be unidirectional motion information pointing to a reference frame in a first reference frame list, and the second unidirectional motion information may be unidirectional motion information pointing to a reference frame in a second reference frame list.
[0329] Exemplarily, if the total number of candidate motion information already present in the motion information candidate list (i.e., when adding available motion information to the motion information candidate list, the total number of candidate motion information currently already present in the motion information candidate list) is an even number, the first reference frame list is List0 and the second reference frame list is List1, and if the total number of candidate motion information already present in the motion information candidate list is an odd number, the first reference frame list is List1 and the second reference frame list is List0. Alternatively, if the total number of candidate motion information already present in the motion information candidate list is an odd number, the first reference frame list is List0 and the second reference frame list is List1, and if the total number of candidate motion information already present in the motion information candidate list is an even number, the first reference frame list is List1 and the second reference frame list is List0. Alternatively, the first reference frame list is List0 and the second reference frame list is List1. Alternatively, the first reference frame list is List1 and the second reference frame list is List0.
[0330] The above embodiment relates to an overlap check operation for unidirectional motion information (e.g., unidirectional motion information, first unidirectional motion information, second unidirectional motion information, etc.) and candidate motion information already existing in the motion information candidate list, and the overlap check operation results in overlap or no overlap. It also relates to an overlap check for motion information of two spatial domain adjacent blocks, and the overlap check operation results in overlap or no overlap. The following embodiment 19 also relates to an overlap check operation for bidirectional motion information and candidate motion information already existing in the motion information candidate list, and the overlap check operation results in overlap or no overlap.
[0331] For convenience of explanation, the two motion information subjected to the overlap check operation are called motion information 1 and motion information 2, and if motion information 1 is unidirectional motion information to be checked for overlap, motion information 2 is candidate motion information already present in the motion information candidate list, and if motion information 1 is bidirectional motion information to be checked for overlap, motion information 2 is candidate motion information already present in the motion information candidate list, and if motion information 1 is motion information of a spatial domain adjacent block whose availability needs to be determined, motion information 2 is motion information of a spatial domain adjacent block whose availability has been determined. Refer to method 12, for example, when motion information of F is available, when it needs to determine whether motion information of G is available, motion information 1 is the motion information of G and motion information 2 is the motion information of F.
[0332] The duplication check operation can be realized by adopting the following method.
[0333] Method 41 performs a duplication check operation based on List+refIdx+MV_x+MV_y. For example, first check whether the pointed-to Lists are the same (i.e., whether they point to List0, List1, or both List0 and List1), then check whether the refidx are the same, and then check whether the MVs are the same (i.e., whether the horizontal components are the same, and whether the vertical components are the same).
[0334] For example, first inquire whether the reference frame list pointed to by motion information 1 and the reference frame list pointed to by motion information 2 are the same, and if they are different, it is determined that motion information 1 does not overlap with motion information 2. If they are the same, it inquires whether the refIdx of motion information 1 and the refIdx of motion information 2 are the same, and if they are different, it is determined that motion information 1 does not overlap with motion information 2. If they are the same, it inquires whether the motion vector of motion information 1 and the motion vector of motion information 2 are the same, and if not, it is determined that motion information 1 does not overlap with motion information 2, and if so, it is determined that motion information 1 overlaps with motion information 2.
[0335] For example, if the reference frame list pointed to by motion information 1 and the reference frame list pointed to by motion information 2 are both List0, then they are the same; alternatively, if the reference frame list pointed to by motion information 1 and the reference frame list pointed to by motion information 2 are both List1, then they are the same; alternatively, if the reference frame list pointed to by motion information 1 is List0 and the reference frame list pointed to by motion information 2 is List1, then they are different; alternatively, if the reference frame list pointed to by motion information 1 is List1 and the reference frame list pointed to by motion information 2 is List0, then they are different; alternatively, if the reference frame list pointed to by motion information 1 is List0 and the reference frame list pointed to by motion information 2 is List0, then they are different; or when the reference frame list pointed to by motion information 1 is List1 and the reference frame list pointed to by motion information 2 is List0 and List1, the two are different; or when the reference frame index in the reference frame list List0 of motion information 1 points to the reference frame of refIdx0 and the reference frame index in List1 points to the reference frame of refIdx1, and the reference frame index in the reference frame list of motion information 2 points to the reference frame of refIdx2 and the reference frame index in List1 points to the reference frame of refIdx3, and refIdx0 is not equal to refIdx2 or refIdx1 is not equal to refIdx3, the two are different. Of course, the above are merely some examples of comparing reference frame lists, and are not limited thereto.
[0336] For example, if the horizontal component of the motion vector of motion information 1 is the same as the horizontal component of the motion vector of motion information 2, and the vertical component of the motion vector of motion information 1 is the same as the vertical component of the motion vector of motion information 2, it represents that the motion vector of motion information 1 is the same as the motion vector of motion information 2.
[0337] As method 42, a duplication check operation is performed based on POC+MV_x+MV_y.
[0338] For example, first it queries whether the POCs of the reference frames pointed to are the same (i.e., if a POC pointing to a reference frame with a reference frame index of refIdx0 in List0 is equal to a POC pointing to a reference frame with a reference frame index of refIdx1 in List1, it is determined that they are the same, and this applies to both the overlap check for unidirectional motion information and unidirectional motion information, and the overlap check for bidirectional motion information and bidirectional motion information), and then it queries whether the MVs are the same (i.e., whether the horizontal components are the same, and whether the vertical components are the same).
[0339] For example, first inquire whether the POC of the reference frame indicated by motion information 1 is the same as the POC of the reference frame indicated by motion information 2, and if they are different, it is determined that motion information 1 does not overlap with motion information 2. If they are the same, it then inquires whether the motion vector of motion information 1 is the same as the motion vector of motion information 2, and if they are different, it is determined that motion information 1 does not overlap with motion information 2, and if they are the same, it is determined that motion information 1 overlaps with motion information 2.
[0340] Exemplarily, the POC of the reference frames pointed to is the same may include the following: Motion information 1 points to a reference frame in List0 whose reference frame index is refIdx0, and motion information 2 points to a reference frame in List0 whose reference frame index is refIdx0, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Or, motion information 1 points to a reference frame in List1 whose reference frame index is refIdx1, and motion information 2 points to a reference frame in List1 whose reference frame index is refIdx1, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Or, motion information 1 points to a reference frame in List0 whose reference frame index is refIdx0, and motion information 2 points to a reference frame in List1 whose reference frame index is refIdx1, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2. Alternatively, motion information 1 points to a reference frame in List1 whose reference frame index is refIdx1, and motion information 2 points to a reference frame in List0 whose reference frame index is refIdx0, and the POC of the reference frame pointed to by motion information 1 is the same as the POC of the reference frame pointed to by motion information 2.Or, the reference frame index of the motion information 1 in List0 refers to the reference frame of refIdx0, and the reference frame index of the motion information 2 in List0 refers to the reference frame of refIdx2, and the reference frame index of the motion information 2 in List1 refers to the reference frame of refIdx3, the POC of the reference frame of refIdx0 in List0 pointed to by the motion information 1 is the same as the POC of the reference frame of refIdx3 in List1 pointed to by the motion information 2, and the POC of the reference frame of refIdx1 in List1 pointed to by the motion information 1 is the same as the POC of the reference frame of refIdx2 in List0 pointed to by the motion information 2. Of course, the above are only some examples in which the POC of the reference frames is the same, and are not limited thereto.
[0341] For example, the above process is a process of performing a duplication check on the POC of the reference frame, and the POC of the reference frame is merely an example of a duplication check operation, and other attributes such as the DOC of the reference frame that can check whether the reference frames are the same may be adopted in addition to the POC, and there is no limitation thereto. As described above, the POC can be replaced with the DOC.
[0342] In the above manner, a motion information candidate list can be obtained, and the motion information candidate list can also be called AwpUniArray. The following describes the process of obtaining the motion information candidate list with reference to some specific application scenarios. In the following application scenarios, assume that the length of the motion information candidate list is X, that is, X pieces of available motion information need to be added, and after the available motion information is added to the motion information candidate list, the motion information that has been added is called candidate motion information.
[0343] Application scene 1: Add spatial domain motion information to the motion information candidate list, and if the list length is equal to X, terminate the adding process; if the list length is less than X, add pre-set motion information to the motion information candidate list until the list length becomes X.
[0344] Exemplarily, firstly, determine available motion information (i.e., spatial domain motion information) to be added to the motion information candidate list. For example, determine available motion information by adopting method 11, or determine available motion information by adopting method 12, or determine available motion information by adopting method 13. When determining available motion information by adopting method 12 or method 13, for the overlap check operation of the motion information of two spatial domain adjacent blocks, the overlap check operation can be performed by adopting method 41, or the overlap check operation can be performed by adopting method 42.
[0345] 9A, the available motion information is added to the motion information candidate list according to the order (the order is variable) of the available motion information in F, G, C, A, B, and D. For each available motion information, method 31 may be adopted to add the available motion information to the motion information candidate list, method 32 may be adopted to add the available motion information to the motion information candidate list, or method 33 may be adopted to add the available motion information to the motion information candidate list.
[0346] Exemplarily, when the available motion information is added to the motion information candidate list by adopting method 32 or method 33, a duplication check operation can also be performed on the unidirectional motion information and the candidate motion information already present in the motion information candidate list, for example, the duplication check operation can be performed by adopting method 41, or the duplication check operation can be performed by adopting method 42.
[0347] Application scene 2: Add time domain motion information to the motion information candidate list, and if the list length is equal to X, terminate the adding process; if the list length is less than X, add pre-set motion information to the motion information candidate list until the list length becomes X.
[0348] Exemplarily, first determine available motion information (i.e., time-domain motion information) to be added to the motion information candidate list. For example, adopt method 21 to determine available motion information, or adopt method 22 to determine available motion information.
[0349] For example, for each available motion information, method 31 may be adopted to add the available motion information to the motion information candidate list, method 32 may be adopted to add the available motion information to the motion information candidate list, or method 33 may be adopted to add the available motion information to the motion information candidate list.
[0350] Exemplarily, when the available motion information is added to the motion information candidate list by adopting method 32 or method 33, a duplication check operation can also be performed on the unidirectional motion information and the candidate motion information already present in the motion information candidate list, for example, the duplication check operation can be performed by adopting method 41, or the duplication check operation can be performed by adopting method 42.
[0351] Application scene 3: Add both spatial domain motion information and temporal domain motion information to the motion information candidate list (spatial domain motion information may be located before the temporal domain motion information, or the temporal domain motion information may be located before the spatial domain motion information; for convenience of explanation, the latter takes the spatial domain motion information as an example being located before the temporal domain motion information), and if the list length is equal to X, terminate the adding process; if the list length is less than X, add the pre-set motion information to the motion information candidate list until the list length becomes X.
[0352] Exemplarily, determine available motion information (i.e., spatial domain motion information and time domain motion information) to be added to motion information candidate list. For example, adopt method 11 and method 21 to determine available motion information, or adopt method 11 and method 22 to determine available motion information, or adopt method 12 and method 21 to determine available motion information, or adopt method 12 and method 22 to determine available motion information, or adopt method 13 and method 21 to determine available motion information, or adopt method 13 and method 22 to determine available motion information. Of course, the above are only some examples, and are not limited thereto.
[0353] When determining available motion information by adopting method 12 or method 13, with respect to the overlap check operation of the motion information of two spatial domain adjacent blocks, the overlap check operation can be performed by adopting method 41, or the overlap check operation can be performed by adopting method 42.
[0354] Exemplarily, the available motion information is added to the motion information candidate list according to the order of the available motion information in F, G, C, A, B, and D and the order of the time-domain motion information (i.e., the available motion information). For each available motion information, method 31 is adopted to add the available motion information to the motion information candidate list, or method 32 is adopted to add the available motion information to the motion information candidate list, or method 33 is adopted to add the available motion information to the motion information candidate list.
[0355] Exemplarily, when the available motion information is added to the motion information candidate list by adopting method 32 or method 33, a duplication check operation can also be performed on the unidirectional motion information and the candidate motion information already present in the motion information candidate list, for example, the duplication check operation can be performed by adopting method 41, or the duplication check operation can be performed by adopting method 42.
[0356] As described above, based on the order of the spatial domain motion information and the temporal domain motion information, both the spatial domain motion information and the temporal domain motion information can be added to the motion information candidate list until the list length is equal to X, or when the traversal is completed, if the list length is less than X, predetermined motion information is added to the motion information candidate list until the list length is X.
[0357] Application scene 4: After adding spatial domain motion information to motion information candidate list, at least Y positions are reserved in time domain motion information, and the time domain motion information is bidirectional motion information or unidirectional motion information. Illustratively, add spatial domain motion information to motion information candidate list, and end the process of adding spatial domain motion information when the list length is equal to XY, or end the traversal of spatial domain motion information and end the process of adding spatial domain motion information when the list length is less than XY. Then, add time domain motion information to motion information candidate list, and end the process of adding time domain motion information when the list length is equal to X, or end the traversal of time domain motion information and end the process of adding time domain motion information when the list length is less than X, and add pre-set motion information to motion information candidate list until the list length is X.
[0358] Exemplarily, determine available motion information (i.e., spatial domain motion information and time domain motion information) to be added to motion information candidate list. For example, adopt method 11 and method 21 to determine available motion information, or adopt method 11 and method 22 to determine available motion information, or adopt method 12 and method 21 to determine available motion information, or adopt method 12 and method 22 to determine available motion information, or adopt method 13 and method 21 to determine available motion information, or adopt method 13 and method 22 to determine available motion information. Of course, the above are only some examples, and are not limited thereto.
[0359] When determining available motion information by adopting method 12 or method 13, with respect to the overlap check operation of the motion information of two spatial domain adjacent blocks, the overlap check operation can be performed by adopting method 41, or the overlap check operation can be performed by adopting method 42.
[0360] Exemplarily, according to the order of available motion information (i.e., spatial domain motion information) in F, G, C, A, B, and D, add the available motion information to the motion information candidate list until the list length is equal to XY or the traversal of the spatial domain motion information is terminated. Then, add the time domain motion information (i.e., available motion information) to the motion information candidate list until the list length is equal to X or the traversal of the time domain motion information is terminated. In the process of adding available motion information, for each available motion information, adopt method 31 to add the available motion information to the motion information candidate list, or adopt method 32 to add the available motion information to the motion information candidate list, or adopt method 33 to add the available motion information to the motion information candidate list.
[0361] Exemplarily, when the available motion information is added to the motion information candidate list by adopting method 32 or method 33, a duplication check operation can also be performed on the unidirectional motion information and the candidate motion information already present in the motion information candidate list, for example, the duplication check operation can be performed by adopting method 41, or the duplication check operation can be performed by adopting method 42.
[0362] In each of the above application scenarios, X can be any positive integer, for example, the value of X may be 4, 5, etc.
[0363] In each of the above application scenes, it is possible to add pre-set motion information (which may also be referred to as default motion information) to the motion information candidate list, and the method of realizing the pre-set motion information may include, but is not limited to, the following methods.
[0364] In the manner 51, the preset motion information is zero motion information, for example, a zero motion vector pointing to ListX and refIdx is less than the number of reference frames in ListX. For example, zero padding can be performed, that is, the motion information can be (0, 0, ref_idx3, ListZ).
[0365] Method 52 derives default motion information based on candidate motion information already present in the motion information candidate list.
[0366] For example, the absolute value in the x-axis or y-axis direction that needs to be enlarged or reduced is denoted as temp_val, and the result is denoted as result.
[0367] 1. If temp_val<8, then result=8; alternatively, result=-8.
[0368] Exemplarily, if the temp_val in the x-axis direction of the candidate motion information is less than 8, the motion vector in the x-axis direction of the default motion information is 8, or the motion vector in the x-axis direction of the default motion information is −8.
[0369] If the temp_val in the y-axis direction of the candidate motion information is less than 8, the motion vector in the y-axis direction of the default motion information is 8, or the motion vector in the y-axis direction of the default motion information is −8.
[0370] 2. Assuming that the above 1 is not satisfied, if temp_val<=64, then result=(temp_val*5+2)>>2, or result=(temp_val*3+2)>>2, and the sign is the same as the sign of the motion vector of the candidate motion information.
[0371] For example, if the motion vector in the x-axis direction of the candidate motion information is positive and the absolute value of the motion vector in the x-axis direction (i.e., temp_val) is 64 or less, the motion vector in the x-axis direction of the default motion information is (temp_val*5+2)>>2, and if the motion vector in the x-axis direction of the candidate motion information is negative and the absolute value of the motion vector in the x-axis direction (i.e., temp_val) is 64 or less, the motion vector in the x-axis direction of the default motion information is result=(temp_val*3+2)>>2.
[0372] The y-axis motion vectors for the default motion information are similar to the x-axis motion vectors.
[0373] 3. Assuming that 1 and 2 above are not satisfied, if temp_val<=128, then result=(temp_val*9+4)>>3, or result=(temp_val*7+4)>>3, and the sign is the same as the sign of the motion vector of the candidate motion information.
[0374] 4. Assuming that 1, 2, and 3 above are not satisfied, then result=(temp_val*33+16)>>5, or result=(temp_val*31+16)>>5, and the sign is the same as the sign of the motion vector of the candidate motion information.
[0375] Method 53 derives default motion information based on candidate motion information already present in the motion information candidate list.
[0376] For example, based on any valid candidate motion information (x, y, ref_idx, ListX) in the motion information candidate list, ref_idx and ListX are respectively a reference frame index and a reference frame list, and both are collectively referred to as reference frame information, at least one of the following motion information can be added: (x+a, y+b, ref_idx, ListX), where a and b are any integers; (k1*x, k1*y, ref_idx_new1, ListX), where k1 is any positive integer other than 0, i.e., a scale operation is performed on the motion vector; and (k2*x, k2*y, ref_idx_new2, ListY), where k2 is any positive integer other than 0, i.e., a scale operation is performed on the motion vector.
[0377] In method 54, the preset motion information is candidate motion information already present in the motion information candidate list, i.e., when performing a padding operation, the filling operation can be repeated using candidate motion information already present in the motion information candidate list. For example, the last unidirectional motion information already present in the motion information candidate list can be used to perform duplicate filling.
[0378] As described above, when the list length is smaller than X and it is necessary to add the preset motion information to the motion information candidate list, the preset motion information of the method 51 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the method 52 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the method 53 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the methods 51 and 52 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the methods 51 and 53 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the methods 52 and 53 can be added to the motion information candidate list until the list length becomes X. Alternatively, the preset motion information of the methods 51, 52, and 53 can be added to the motion information candidate list until the list length becomes X.
[0379] Exemplarily, after adopting the above method to add the pre-defined motion information to the motion information candidate list, if the list length is still less than X, the pre-defined motion information of method 54 can be added to the motion information candidate list, that is, the filling operation is repeated by adopting the candidate motion information already present in the motion information candidate list until the list length becomes X.
[0380] In another possible embodiment, when the list length is smaller than X and pre-defined motion information needs to be added to the motion information candidate list, the pre-defined motion information of the direct method 54 can be added to the motion information candidate list, that is, the filling operation is repeated by adopting the candidate motion information already existing in the motion information candidate list until the list length becomes X.
[0381] In the above embodiment, the preset motion information may be unidirectional motion information or bidirectional motion information. If the preset motion information is unidirectional motion information, when the preset motion information is added to the motion information candidate list, a duplication check operation may be performed or not. If the duplication check operation is not performed, the preset motion information is directly added to the motion information candidate list. If the duplication check operation is performed, the duplication check operation can be performed by adopting method 41, or the duplication check operation can be performed by adopting method 42. If the duplication check operation results in no duplication, the preset motion information is added to the motion information candidate list. If the duplication check operation results in duplication, the preset motion information is not added to the motion information candidate list.
[0382] Example 15: In Examples 1 to 3, the encoding side / decoding side can obtain a motion information candidate list (see Examples 13 and 14), and then obtain the first target motion information and the second target motion information of the current block based on the motion information candidate list. The method of obtaining the first target motion information and the second target motion information can be achieved by adopting the following method.
[0383] In the first method, one candidate motion information is selected from the motion information candidate list as the first target motion information of the current block, and another candidate motion information is selected from the motion information candidate list as the second target motion information of the current block.
[0384] For example, both the encoding side and the decoding side can obtain a motion information candidate list, and the motion information candidate list on the encoding side is the same as the motion information candidate list on the decoding side, and there are no restrictions on this motion information candidate list.
[0385] At the encoding side, based on rate-distortion optimization, one candidate motion information can be selected from the motion information candidate list as the first target motion information of the current block, and another candidate motion information can be selected from the motion information candidate list as the second target motion information of the current block, and there is no restriction on the first target motion information and the second target motion information, which are different from each other.
[0386] In one possible embodiment, when the encoding side transmits the encoded bitstream to the decoding side, the encoding bitstream may be added with indication information a and indication information b, 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 candidate motion information 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 candidate motion information the second target motion information is in the motion information candidate list. Exemplarily, index value 1 and index value 2 may be different.
[0387] After receiving the encoded bitstream, the decoding side analyzes the indication information a and the indication information b from the encoded bitstream. According to the indication information a, the decoding side selects candidate motion information corresponding to index value 1 from the motion information candidate list, and sets the candidate motion information as the first target motion information of the current block. According to the indication information b, the decoding side selects candidate motion information corresponding to index value 2 from the motion information candidate list, and sets the candidate motion information as the second target motion information of the current block.
[0388] In another possible embodiment, when the encoding side transmits the encoded bitstream to the decoding side, the indication information a and the indication information c can be added to the encoded bitstream, and the indication information a can 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 candidate motion information of the first target motion information in the motion information candidate list. The indication information c can be used to indicate the difference value between the index value 2 and the index value 1, and the index value 2 represents the number of the candidate motion information of the second target motion information in the motion information candidate list. Exemplarily, the index value 1 and the index value 2 can be different.
[0389] After receiving the encoded bitstream, the decoding side can analyze the indication information a and the indication information c from the encoded bitstream. The decoding side may select candidate motion information corresponding to the index value 1 from the motion information candidate list according to the indication information a, and set the candidate motion information as the first target motion information of the current block. The decoding side may obtain a difference value between the index value 2 and the index value 1 according to the indication information c, and determine the index value 2 according to the difference value and the index value 1, and the decoding side may select candidate motion information corresponding to the index value 2 from the motion information candidate list, and set the candidate motion information as the second target motion information of the current block.
[0390] Exemplarily, the indication information of the first target motion information and the indication information of the second target motion information are exchangeable, and it is sufficient that the encoding side and the decoding side are consistent. Here, it is an exchange of indication information, and does not affect the analysis process, that is, there is no analysis dependency. The indication information of the first target motion information and the indication information of the second target motion information are not equal, and two index values are encoded, and assuming that the value of index value a is 1 and the value of index value b is 3, when the index value a is encoded first, the index value b can be encoded as 2 (i.e., 3-1), and when the index value b is encoded first, the index value b needs to be encoded as 3. As described above, by encoding the indication information with a small index value first, the encoding cost of a large index value can be reduced. For example, the indication information of the first target motion information, for example, the index value a, is encoded first, and the indication information of the second target motion information, for example, the index value b, is encoded later. The indication information of the second target motion information, for example, the index value b, may be encoded first, and the indication information of the first target motion information, for example, the index value a, may be encoded later. For example, if index value a is 1 and index value b is 3, index value a is coded first and index value b is coded second. Alternatively, if index value b is 1 and index value a is 3, index value b is coded first and index value a is coded second.
[0391] As the second method, select a candidate motion information from the motion information candidate list as the first original motion information of the current block, and select a candidate motion information from the motion information candidate list as the second original motion information of the current block, and for example, the first original motion information and the second original motion information can be different, i.e., select two different candidate motion information from the motion information candidate list as the first original motion information and the second original motion information, or the first original motion information and the second original motion information can be the same, i.e., select the same candidate motion information from the motion information candidate list as the first original motion information and the second original motion information. Then, determine a first target motion information of the current block according to the first original motion information, and determine a second target motion information of the current block according to the second original motion information. For example, the first target motion information and the second target motion information can be different.
[0392] Regarding how to determine the target motion information based on the original motion information, this embodiment provides a means for superimposing a motion vector difference (Angular Weighted Prediction with Motion Vector Refinement, AWP_MVR) on the unidirectional motion information, for example, the first original motion information includes a first original motion vector, the first target motion information includes a first target motion vector, the second original motion information includes a second original motion vector, and the second target motion information includes a second target motion vector, and then, a first motion vector difference (i.e., MVD) corresponding to the first original motion vector can be obtained, and a first target motion vector (i.e., the sum of the first motion vector difference and the first original motion vector is the first target motion vector) can be determined based on the first motion vector difference and the first original motion vector. A second motion vector difference corresponding to the second original motion vector can be obtained, and a second target motion vector (i.e., the sum of the second motion vector difference and the second original motion vector is the second target motion vector) can be determined based on the second motion vector difference and the second original motion vector.
[0393] Exemplarily, when determining the first target motion vector, the first motion vector difference may not be superimposed, i.e., the first original motion vector is determined as the first target motion vector, but when determining the second target motion vector, the second motion vector difference may be superimposed, i.e., the second target motion vector is determined based on the second motion vector difference and the second original motion vector.
[0394] Alternatively, when determining the second target motion vector, the second motion vector difference may not be superimposed, i.e. the second original motion vector is determined as the second target motion vector. However, when determining the first target motion vector, the first motion vector difference may be superimposed, i.e. the first target motion vector is determined based on the first motion vector difference and the first original motion vector.
[0395] Alternatively, when determining the first target motion vector, a first motion vector difference may be superimposed, i.e., the first target motion vector is determined based on the first motion vector difference and the first original motion vector, and when determining the second target motion vector, a second motion vector difference may be superimposed, i.e., the second target motion vector is determined based on the second motion vector difference and the second original motion vector.
[0396] For example, direction information and amplitude information of a first motion vector difference can be obtained, and the first motion vector difference can be determined based on the direction information and amplitude information of the first motion vector difference; and direction information and amplitude information of a second motion vector difference can be obtained, and the second motion vector difference can be determined based on the direction information and amplitude information of the second motion vector difference.
[0397] For example, the decoding side may obtain the direction information of the first motion vector difference in the following manner: the decoding side analyzes the direction information of the first motion vector difference from the encoded bit stream of the current block, or the decoding side derives the direction information of the first motion vector difference based on the weighted prediction angle of the current block. The decoding side may obtain the direction information of the second motion vector difference in the following manner: the decoding side analyzes the direction information of the second motion vector difference from the encoded bit stream of the current block, or the decoding side derives the direction information of the second motion vector difference based on the weighted prediction angle of the current block.
[0398] For example, the decoding side may obtain the amplitude information of the first motion vector difference by analyzing the amplitude information of the first motion vector difference from the encoded bitstream of the current block, and may obtain the amplitude information of the second motion vector difference by analyzing the amplitude information of the second motion vector difference from the encoded bitstream of the current block.
[0399] In one possible embodiment, the encoding side and the decoding side can agree on direction information and amplitude information of the motion vector difference, and if the direction information represents the direction as rightward and the amplitude information represents the amplitude as A, the motion vector difference is (A, 0); if the direction information represents the direction as downward and the amplitude information represents the amplitude as A, the motion vector difference is (0, -A); if the direction information represents the direction as leftward and the amplitude information represents the amplitude as A, the motion vector difference is (-A, 0); if the direction information represents the direction as upward and the amplitude information represents the amplitude as A, the motion vector difference is (-A, 0); When the direction information represents the direction as upward and to the right and the amplitude information represents the amplitude as A, the motion vector difference is (0,A), when the direction information represents the direction as upward and to the left and the amplitude information represents the amplitude as A, the motion vector difference is (-A,A), when the direction information represents the direction as downward and to the left and the amplitude information represents the amplitude as A, the motion vector difference is (-A,-A), when the direction information represents the direction as downward and to the right and the amplitude information represents the amplitude as A, the motion vector difference is (A,-A). Of course, the above are merely some examples and are not limited to this direction information and amplitude information.
[0400] For example, the motion vector difference may support some or all of the above-mentioned direction information, and the range of values of the amplitude A supported by the motion vector difference may be empirically set and may be at least one value, but is not limited thereto. For example, the motion vector difference supports directions such as up, down, left, and right, and the motion vector difference supports five types of step configurations of 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, that is, the values of the amplitude A are 1, 2, 4, 8, and 16. As described above, when the direction is upward, the motion vector difference may be (0,1), (0,2), (0,4), (0,8), and (0,16). When the direction is downward, the motion vector difference may be (0,-1), (0,-2), (0,-4), (0,-8), and (0,-16). If the direction is leftward, the motion vector difference may be (-1,0), (-2,0), (-4,0), (-8,0), (-16,0).If the direction is rightward, the motion vector difference may be (1,0), (2,0), (4,0), (8,0), (16,0).
[0401] For example, the motion vector difference supports directions such as up, down, left, and right, and the motion vector difference supports six types of step configurations, namely, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, i.e., the values of amplitude A may be 1, 2, 4, 8, 12, and 16.
[0402] For example, the motion vector difference supports eight directions, including up, down, left, right, top left, bottom left, top right, and bottom right, and the motion vector difference supports three step configurations, including 1 / 4-pel, 1 / 2-pel, and 1-pel, that is, the values of the amplitude A may be 1, 2, and 4.
[0403] For example, the motion vector difference supports four directions, such as up, down, left, and right, and the motion vector difference supports four types of step configurations, such as 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, that is, the values of the amplitude A may be 1, 2, 4, and 8.
[0404] Of course, the above are merely some examples, and are not limited thereto. For example, the direction supported by the motion vector difference can be arbitrarily selected, and six directions such as up, down, left, right, up-left, and down-left may be supported, or two directions such as up and down may be supported. For example, the step configuration supported by the motion vector difference is variable, and flexible setting is possible. For example, the step configuration can be adaptively set based on coding parameters such as the quantization parameter QP, and for example, 1-pel, 2-pel, 4-pel, and 8-pel are adopted for a large QP, and 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel are adopted for a small QP. For example, an appropriate step configuration can be set for the sequence level, image level, frame level, slice level, tile level, patch level, CTU level, etc., so that the decoding side can perform a decoding operation based on the step configuration analyzed from the sequence level, image level, frame level, slice level, tile level, patch level, and CTU level.
[0405] For ease of explanation, in the following embodiments, it is assumed that the motion vector difference supports directions such as up, down, etc., and step configurations such as 1-pel, 2-pel, etc., and when described with 1 / 4-pel accuracy, the motion vector difference may be (0,4), (0,8), (0,-4), (0,-8), i.e., (0,1<<2), (0,1<<3), (0,-1<<2), (0,-1<<3).
[0406] In the encoding side, after obtaining the motion information candidate list, each candidate motion information combination in the motion information candidate list is sequentially traversed, the candidate motion information combination includes two candidate motion information, one candidate motion information is the first original motion information, and the other candidate motion information is the second original motion information. Note that the first original motion information and the second original motion information may be the same (i.e., the two candidate motion information selected from the motion information candidate list are the same), or may be different. If the first original motion information and the second original motion information are the same, it can be ensured that the first target motion information and the second target motion information are different by superimposing different motion vector differences. For each candidate motion information combination, the motion vector difference combination is sequentially traversed, the motion vector difference combination includes a first motion vector difference and a second motion vector difference, and the first motion vector difference and the second motion vector difference may be the same or different. For example, there are two motion vector differences, which are motion vector difference 1 and motion vector difference 2, motion vector difference combination 1 is motion vector difference 1 and motion vector difference 1, motion vector difference combination 2 is motion vector difference 1 (i.e., the first motion vector difference) and motion vector difference 2, motion vector difference combination 3 is motion vector difference 2 (i.e., the first motion vector difference) and motion vector difference 1, and motion vector difference combination 4 is motion vector difference 2 and motion vector difference 2.
[0407] Exemplarily, for the currently traversed candidate motion information combination and motion vector difference combination, if the first original motion information and the second original motion information are different, the first motion vector difference and the second motion vector difference may be the same or different. If the first original motion information and the second original motion information are the same, the first motion vector difference and the second motion vector difference may be different.
[0408] For the currently traversed candidate motion information combination and motion vector difference combination, the sum of the motion vector of the first original motion information and the first motion vector difference is taken as the first target motion vector, and the sum of the motion vector of the second original motion information and the second motion vector difference is taken as the second target motion vector, and a rate-distortion cost value is determined according to the first target motion vector and the second target motion vector, and there is no restriction on this determination method. The above process is performed for each candidate motion information combination and each motion vector difference combination, and a rate-distortion cost value is obtained for each. Then, the minimum rate-distortion cost value is selected from all the rate-distortion cost values, and the information of the candidate motion information combination (the first original motion information and the second original motion information) and the information of the motion vector difference combination (the first motion vector difference and the second motion vector difference) corresponding to the minimum rate-distortion cost value are coded in the coding bit stream of the current block.
[0409] For example, the following are coded into the coded bitstream of the current block: an index value in the motion information candidate list of the first original motion information corresponding to the minimum rate-distortion cost value, an index value in the motion information candidate list of the second original motion information corresponding to the minimum rate-distortion cost value, direction information and amplitude information of the first motion vector difference corresponding to the minimum rate-distortion cost value, and direction information and amplitude information of the second motion vector difference corresponding to the minimum rate-distortion cost value. For example, for the direction information of the first motion vector difference or the direction information of the second motion vector difference, the indication information of the direction information may be 0, which is used to represent the first direction in the direction list. For the amplitude information of the first motion vector difference or the amplitude information of the second motion vector difference, the indication information of the amplitude information may be 0, which represents the first step configuration in the step configuration list.
[0410] For example, if the motion vector difference supports four directions, such as up, down, left, and right, and five step configurations, such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, the direction information of the motion vector difference can be coded with a 2-bin fixed-length code (four values in total), and the four values of the 2-bin fixed-length code represent the four directions, namely up, down, left, and right. The amplitude information of the motion vector difference can be coded with a truncated unary, that is, the truncated unary represents five step configurations.
[0411] For example, if the motion vector difference supports four directions, namely up, down, left, and right, and six step configurations, namely 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, 3-pel, and 4-pel, the direction information of the motion vector difference can be coded using a 2-bin fixed-length code (a total of four values), and the amplitude information of the motion vector difference can be coded using a truncated unary code.
[0412] For example, if the motion vector difference supports eight directions, namely, up, down, left, right, upper left, lower left, upper right, and lower right, and supports three types of step configurations, such as 1 / 4-pel, 1 / 2-pel, and 1-pel, the direction information of the motion vector difference can be coded using a 3-bin fixed-length code (a total of eight types of values), and the amplitude information of the motion vector difference can be coded using a truncated unary code.
[0413] For example, if the motion vector difference supports four directions, namely up, down, left, and right, and supports four types of step configurations, namely 1 / 4-pel, 1 / 2-pel, 1-pel, and 2-pel, then based on this, the direction information of the motion vector difference can be coded using a truncated unary, and the amplitude information of the motion vector difference can be coded using a 2-bin fixed-length code (a total of four types of values).
[0414] Of course, the above are only some examples of the encoding methods, and are not limited to the encoding methods.
[0415] As described above, the encoding side searches for an optimal motion vector (i.e., a target motion vector) within a certain region, and then the difference between the optimal motion vector and the original motion vector is taken as a motion vector difference (MVD), and the amplitude information and direction information of the motion vector difference are coded into a bitstream. When searching for an optimal motion vector within a certain region, the encoding side needs to determine the direction and amplitude of the motion vector difference, that is, the optimal motion vector is searched for within a limited range of the motion vector difference such as (A,0), (0,-A), (-A,0), (0,A), (A,A), (-A,A), (-A,-A), (A,-A).
[0416] After receiving the encoded bitstream of the current block, the decoding side can analyze the index value in the motion information candidate list of the first original motion information from the encoded bitstream, and select the candidate motion information corresponding to the index value from the motion information candidate list, and set the candidate motion information as the first original motion information of the current block. The decoding side can analyze the index value in the motion information candidate list of the second original motion information from the encoded bitstream, and select the candidate motion information corresponding to the index value from the motion information candidate list, and set the candidate motion information as the second original motion information of the current block.
[0417] The decoding side can analyze the direction information and amplitude information of the first motion vector difference from the encoded bitstream, and determine the first motion vector difference according to the direction information and the amplitude information. And the decoding side can also analyze the direction information and amplitude information of the second motion vector difference from the encoded bitstream, and determine the second motion vector difference according to the direction information and the amplitude information.
[0418] Then, the decoding side can determine a first target motion information of the current block based on the first motion vector difference and the first original motion information, and determine a second target motion information of the current block based on the second motion vector difference and the second original motion information.
[0419] For example, when determining the first motion vector difference based on the direction information of the first motion vector difference and the amplitude information of the first motion vector difference, if the direction information of the first motion vector difference represents the direction as rightward and the amplitude information of the first motion vector difference represents the amplitude as A, the first motion vector difference is (A, 0); if the direction information of the first motion vector difference represents the direction as downward and the amplitude information of the first motion vector difference represents the amplitude as A, the first motion vector difference is (0, -A); if the direction information of the first motion vector difference represents the direction as leftward and the amplitude information of the first motion vector difference represents the amplitude as A, the first motion vector difference is (-A, 0); and if the direction information of the first motion vector difference represents the direction as upward and the amplitude information of the first motion vector difference represents the amplitude as A, the first motion vector difference is (0, A). When determining the second motion vector difference based on the direction information of the second motion vector difference and the amplitude information of the second motion vector difference, if the direction information of the second motion vector difference represents the direction as rightward and the amplitude information of the second motion vector difference represents the amplitude as A, the second motion vector difference is (A, 0); if the direction information of the second motion vector difference represents the direction as downward and the amplitude information of the second motion vector difference represents the amplitude as A, the second motion vector difference is (0, -A); if the direction information of the second motion vector difference represents the direction as leftward and the amplitude information of the second motion vector difference represents the amplitude as A, the second motion vector difference is (-A, 0); and if the direction information of the second motion vector difference represents the direction as upward and the amplitude information of the second motion vector difference represents the amplitude as A, the second motion vector difference is (0, A).
[0420] 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 directional information of the motion vector difference, and therefore the decoding side can adopt a method such as a fixed-length code, a truncated unary code, etc., to decode the directional information of the motion vector difference and obtain the directional information of the motion vector difference, for example, up, down, left, right, upper left, lower left, upper right, lower right, etc.
[0421] Referring to the above embodiment, the encoding side can adopt a method such as fixed-length code, truncated unary, etc. when encoding the amplitude information of the motion vector difference, and therefore the decoding side can adopt a method such as fixed-length code, truncated unary, etc. to decode the amplitude information of the motion vector difference to obtain the amplitude information of the motion vector difference, for example, a step configuration such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc., and then determine the value of the amplitude A of the motion vector difference based on the step configuration such as 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, etc.
[0422] In one possible embodiment, the encoding side can also encode a first sub-mode flag and a second sub-mode flag of the enhancement angle weighted prediction mode in the encoded bitstream, where the first sub-mode flag indicates whether to superimpose a motion vector difference on the first original motion information or not to superimpose a motion vector difference on the first original motion information, and the second sub-mode flag indicates whether to superimpose a motion vector difference on the second original motion information or not to superimpose a motion vector difference on the second original motion information.
[0423] After receiving the encoded bitstream of the current block, the decoding side can first analyze the first sub-mode flag and the second sub-mode flag of the emphasis angle weighting prediction mode from the encoded bitstream of the current block. If the first sub-mode flag indicates that the motion vector difference is superimposed on the first original motion information, the decoding side can analyze the direction information and the amplitude information of the first motion vector difference from the encoded bitstream of the current block, and determine the first motion vector difference according to the direction information and the amplitude information of the first motion vector difference, and then determine the first target motion information of the current block according to the first original motion information and the first motion vector difference. If the first sub-mode flag indicates that the motion vector difference is not superimposed on the first original motion information, the decoding side can directly take the first original motion information as the first target motion information of the current block without analyzing the direction information and the amplitude information of the first motion vector difference. If the second sub-mode flag indicates that the motion vector difference is superimposed on the second original motion information, the direction information and amplitude information of the second motion vector difference are analyzed from the coding bitstream of the current block, and the second motion vector difference is determined according to the direction information and amplitude information of the second motion vector difference, and then the second target motion information of the current block is determined according to the second original motion information and the second motion vector difference. If the second sub-mode flag indicates that the motion vector difference is not superimposed on the second original motion information, the direction information and amplitude information of the second motion vector difference are not analyzed, and the second original motion information can be directly taken as the second target motion information of the current block.
[0424] Exemplarily, when the first sub-mode flag of the emphasis angle weighted prediction mode is a first value, it indicates that the motion vector difference is superimposed on the first original motion information, and when the first sub-mode flag of the emphasis angle weighted prediction mode is a second value, it indicates that the motion vector difference is not superimposed on the first original motion information. When the second sub-mode flag of the emphasis angle weighted prediction mode is a first value, it indicates that the motion vector difference is superimposed on the second original motion information, and when the second sub-mode flag of the emphasis angle weighted prediction mode is a second value, it indicates that the motion vector difference is not superimposed on the second original motion information. The first value and the second value may be empirically set, for example, the first value is 1 and the second value is 0, or, for example, the first value is 0 and the second value is 1.
[0425] In the above embodiment, the decoding side analyzes the direction information of the first motion vector difference and the direction information of the second motion vector difference from the encoded bitstream of the current block, and in actual application, the direction information of the first motion vector difference can also be derived based on the weighted prediction angle of the current block, and the direction information of the second motion vector difference can also be derived based on the weighted prediction angle of the current block.
[0426] For example, the weighted prediction angle of the current block represents an angular direction, and refers to the eight types of angular directions shown in FIG. 6. The weighted prediction angle of the current block represents a certain angular direction among the eight types of angular directions. For the decoding side, direction information matching the angular direction can be selected from all direction information (e.g., up, down, left, right, upper left, lower left, upper right, lower right, etc.), and the direction information can be directly used as the direction information of the first motion vector difference and the direction information of the second motion vector difference.
[0427] The direction information matching the angular direction may include that the angle difference between the direction information and the angular direction is a preset angle or is close to a preset angle, or that the difference value between the angle difference between the direction information and the angular direction and the preset angle is the smallest among all the direction information. The preset angle may be empirically set, for example, the preset angle may be 90 degrees.
[0428] For example, the encoding side does not need to determine the direction information of the first motion vector difference and the direction information of the second motion vector difference by adopting a rate-distortion cost value method, and may derive the direction information of the first motion vector difference based on a weighted prediction angle of the current block, and may derive the direction information of the second motion vector difference based on a weighted prediction angle of the current block. When the encoding side transmits the encoded bitstream of the current block to the decoding side, the direction information of the first motion vector difference and the direction information of the second motion vector difference may not be encoded, and the direction information of the first motion vector difference and the direction information of the second motion vector difference may be derived by the decoding side.
[0429] Example 16: In Example 15, the decoding side can analyze the amplitude information of the first motion vector difference and the amplitude information of the second motion vector difference from the encoding bitstream, and in one possible embodiment, the encoding side and the decoding side can build the same motion vector difference amplitude list, and the encoding side determines the amplitude index in the motion vector difference amplitude list of the amplitude information of the first motion vector difference, and the encoding bitstream includes the amplitude index of the first motion vector difference. The decoding side analyzes the amplitude index of the first motion vector difference from the encoding bitstream of the current block, and selects the amplitude information corresponding to the amplitude index from the motion vector difference amplitude list, and the amplitude information is the amplitude information of the first motion vector difference. The encoding side determines the amplitude index in the motion vector difference amplitude list of the amplitude information of the second motion vector difference, and the encoding bitstream includes the amplitude index of the second motion vector difference. The decoding side analyzes the amplitude index of the second motion vector difference from the encoding bitstream of the current block, and selects the amplitude information corresponding to the amplitude index from the motion vector difference amplitude list, and the amplitude information is the amplitude information of the second motion vector difference.
[0430] In another possible embodiment, the encoding side and the decoding side can construct the same at least two motion vector difference amplitude lists, for example, the encoding side and the decoding side construct the same motion vector difference amplitude list 1 and the same motion vector difference amplitude list 2. The encoding side first selects a target motion vector difference amplitude list from all motion vector difference amplitude lists according to the motion vector difference amplitude list indication information, the encoding side determines an amplitude index in the target motion vector difference amplitude list of the first motion vector difference amplitude information, and the encoded bitstream includes the amplitude index of the first motion vector difference.
[0431] The encoding side can also determine an amplitude index in the target motion vector difference amplitude list of the amplitude information of the second motion vector difference, and the encoding bitstream can include the amplitude index of the second motion vector difference. The decoding side can analyze the amplitude index of the second motion vector difference from the encoding bitstream of the current block, and select the amplitude information corresponding to the amplitude index from the target motion vector difference amplitude list, where the amplitude information is the amplitude information of the second motion vector difference.
[0432] Exemplarily, the indication information of the motion vector difference amplitude list may be indication information of any level, for example, indication information of a sequence level motion vector difference amplitude list, indication information of a frame level motion vector difference amplitude list, indication information of a slice level motion vector difference amplitude list, indication information of a tile level motion vector difference amplitude list, indication information of a patch level motion vector difference amplitude list, indication information of a CTU level motion vector difference amplitude list, indication information of a LCU level motion vector difference amplitude list, indication information of a block level motion vector difference amplitude list, indication information of a CU level motion vector difference amplitude list, or indication information of a PU level motion vector difference amplitude list, and without being limited thereto, for convenience of explanation, taking the indication information of the frame level motion vector difference amplitude list as an example, the indication information of the frame level motion vector difference amplitude list may be awp_umve_offset_list_flag, and the switching of the motion vector difference amplitude list is controlled by awp_umve_offset_list_flag.
[0433] For example, the encoding side and the decoding side can construct a motion vector difference amplitude list 1 and a motion vector difference amplitude list 2, see Table 3 and Table 4. The motion vector difference amplitude list 1 can be binarized, and the motion vector difference amplitude list 2 can be binarized, and there is no restriction on this processing method. For example, a truncated unary format can be adopted for the motion vector difference amplitude list 1, and a truncated unary format can be adopted for the motion vector difference amplitude list 2, or a truncated unary format can be adopted for the motion vector difference amplitude list 1 and a fixed-length code can be adopted for the motion vector difference amplitude list 2, or a fixed-length code can be adopted for the motion vector difference amplitude list 1 and a truncated unary format can be adopted for the motion vector difference amplitude list 2, and there is no restriction on this, see Table 5 and Table 6. [Table 3] [Table 4] [Table 5] [Table 6]
[0434] In the above application scene, switching of the motion vector difference amplitude list is controlled by awp_umve_offset_list_flag, that is, whether to adopt the motion vector difference amplitude list shown in Table 3 or the motion vector difference amplitude list shown in Table 4 is controlled. For example, when the value of awp_umve_offset_list_flag is a first value, the motion vector difference amplitude list shown in Table 3 is a target motion vector difference amplitude list, when the value of awp_umve_offset_list_flag is a second value, the motion vector difference amplitude list shown in Table 4 is a target motion vector difference amplitude list, or when the value of awp_umve_offset_list_flag is the second value, the motion vector difference amplitude list shown in Table 3 is a target motion vector difference amplitude list, and when the value of awp_umve_offset_list_flag is a first value, the motion vector difference amplitude list shown in Table 4 is a target motion vector difference amplitude list.
[0435] When the target motion vector difference amplitude list is Table 3, the encoding side employs the binarization method shown in Table 5 for encoding, and the decoding side employs the binarization method shown in Table 5 for decoding. When the target motion vector difference amplitude list is Table 4, the encoding side employs the binarization method shown in Table 6 for encoding, and the decoding side employs the binarization method shown in Table 6 for decoding.
[0436] Example 17: In addition to Example 15 or Example 16, for the first motion vector difference and the second motion vector difference, the following describes the syntax related to superimposing the motion vector difference AWP_MVR on the unidirectional motion information with reference to specific application scenarios.
[0437] Application scene 1: Referring to Table 7, an example of related syntax is shown, 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.
[0438] 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 is not present in the bitstream, the value of AwpIdx is equal to 0.
[0439] awp_cand_idx0 (first motion information index of angle weighted prediction mode): the first motion information index value of the angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx0 is equal to the value of awp_cand_idx0, and if awp_cand_idx0 does not exist in the bitstream, the value of AwpCandIdx0 is equal to 0.
[0440] awp_cand_idx1 (second motion information index of angle weighted prediction mode): the second motion information index value of the angle weighted prediction mode in skip mode or direct mode. The value of AwpCandIdx1 is equal to the value of awp_cand_idx1, and if awp_cand_idx1 does not exist in the bitstream, the value of AwpCandIdx1 is equal to 0.
[0441] awp_mvd_flag (emphasis angle weighted prediction mode flag) is a binary variable, and when awp_mvd_flag is a first value (e.g., 1), it indicates that the current block is in the emphasis angle weighted prediction mode, and when awp_mvd_flag is a second value (e.g., 0), it indicates that the current block is in the non-emphasis angle weighted prediction mode. Exemplarily, the value of AwpMvdFlag may be equal to the value of awp_mvd_flag, and when awp_mvd_flag is not present in the bitstream, the value of AwpMvdFlag is equal to 0.
[0442] awp_mvd_sub_flag0 (first submode flag of the emphasis angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag0 is a first value, it may indicate that a motion information difference needs to be superimposed on the first motion information of the angle weighted prediction mode, and when awp_mvd_sub_flag0 is a second value, it may indicate that a motion information difference does not need to be superimposed on the first motion information of the angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag0 may be equal to the value of awp_mvd_sub_flag0, and when awp_mvd_sub_flag0 is not present in the bitstream, the value of AwpMvdSubFlag0 is equal to 0.
[0443] awp_mvd_sub_flag1 (second submode flag of the emphasis angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may represent that a motion information difference needs to be superimposed on the second motion information of the angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may represent that a motion information difference does not need to be superimposed on the second motion information of the angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and when awp_mvd_sub_flag1 does not exist in the bitstream, the following case may exist: when AwpMvdFlag is equal to 1, the value of AwpMvdSubFlag1 may be equal to 1, and otherwise, the value of AwpMvdSubFlag1 may be equal to 0.
[0444] awp_mvd_dir0 (the direction index value of the motion vector difference of the first motion information) is the direction index value of the motion vector difference of the first motion information of the 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.
[0445] awp_mvd_step0 (step index value of the motion vector difference of the first motion information), the step index value of the motion vector difference of the first motion information of the angle weighting prediction mode. Exemplarily, the value of AwpMvdStep0 may be equal to the value of awp_mvd_step0, and if awp_mvd_step0 is not present in the bitstream, the value of AwpMvdStep0 may be equal to 0.
[0446] awp_mvd_dir1 (a direction index value of the motion vector difference of the second motion information), a direction index value of the motion vector difference of the second motion information of the angle weighted prediction mode. Illustratively, the value of AwpMvdDir1 may be equal to the value of awp_mvd_dir1. If awp_mvd_dir1 is not present in the bitstream, the value of AwpMvdDir1 may be equal to 0.
[0447] awp_mvd_step1 (step index value of motion vector difference of second motion information), a step index value of motion vector difference of second motion information of angle weighted prediction mode. Exemplarily, the value of AwpMvdStep1 may be equal to the value of awp_mvd_step1. If awp_mvd_step1 is not present in the bitstream, the value of AwpMvdStep1 may be equal to 0. [Table 7]
[0448] Application Scenario 2: Referring to Table 8, an example of related syntax is shown, 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.
[0449] For awp_idx, awp_cand_idx0, and awp_cand_idx1, refer to application scene 1, and the explanation thereof will be omitted here.
[0450] awp_mvd_sub_flag0 (first submode flag of the emphasis angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag0 is a first value, it may indicate that a motion information difference needs to be superimposed on the first motion information of the angle weighted prediction mode, and when awp_mvd_sub_flag0 is a second value, it may indicate that a motion information difference does not need to be superimposed on the first motion information of the angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag0 may be equal to the value of awp_mvd_sub_flag0, and when awp_mvd_sub_flag0 is not present in the bitstream, the value of AwpMvdSubFlag0 is equal to 0.
[0451] awp_mvd_sub_flag1 (second submode flag of the emphasis angle weighted prediction mode) may be a binary variable, and when awp_mvd_sub_flag1 is a first value, it may indicate that a motion information difference needs to be superimposed on the second motion information of the angle weighted prediction mode, and when awp_mvd_sub_flag1 is a second value, it may indicate that a motion information difference does not need to be superimposed on the second motion information of the angle weighted prediction mode. Exemplarily, the value of AwpMvdSubFlag1 may be equal to the value of awp_mvd_sub_flag1, and when awp_mvd_sub_flag1 is not present in the bitstream, the value of AwpMvdSubFlag1 may be equal to 0.
[0452] For information on awp_mvd_dir0, awp_mvd_step0, awp_mvd_dir1, and awp_mvd_step1, please refer to application scene 1. [Table 8]
[0453] For example, the difference between application scene 1 and application scene 2 is that the syntax awp_mvd_flag exists in application scene 1, and the syntax awp_mvd_flag does not exist in application scene 2. In application scene 1, the emphasis angle weighted prediction mode is controlled by awp_mvd_flag, that is, the emphasis angle weighted prediction mode can be controlled by the total switch.
[0454] Application scene 3: Application scene 1 and application scene 2 are derived, and the AWP mode and the AWP_MVR mode are combined, i.e., the span is increased by 0 span, so that there is no need to code the flag bit indicating whether it is enabled or not. For example, the motion vector difference supports directions such as up, down, left, and right, and the motion vector difference supports step configurations such as 0-pel, 1 / 4-pel, 1 / 2-pel, 1-pel, 2-pel, and 4-pel, i.e., the step configuration 0-pel is added. In addition, Table 7 / Table 8 may be updated to Table 9, and the related syntax is referred to as Table 7. [Table 9]
[0455] Illustratively, for each application scenario, the order of the syntax elements in the associated syntax can be adjusted accordingly. For example, for the associated syntax shown in Table 8, the order of the syntax elements can be adjusted accordingly to obtain the associated syntax shown in Table 10. [Table 10]
[0456] As can be seen from Tables 8 and 10, the order of awp_cand_idx0 and awp_cand_idx1 can be adjusted, and illustratively, in Table 10, the analysis manner of awp_cand_idx0 and awp_cand_idx1 can be adjusted based on one or more values of AwpMvdSubFlag0, AwpMvdSubFlag1, AwpMvdDir0, AwpMvdStep0, AwpMvdDir1, and AwpMvdStep1. For example, if at least one value of AwpMvdSubFlag0 and AwpMvdSubFlag1 is 1, the analysis manner of awp_cand_idx0 and awp_cand_idx1 is completely consistent, and if not, the analysis manner is not consistent.
[0457] For example, AwpMvdSubFlag0 indicates whether to superimpose MVD on the first original motion information, and if so, the MVD value corresponding to the first original motion information is determined based on AwpMvdDir0 and AwpMvdStep0, and AwpMvdSubFlag1 indicates whether to superimpose MVD on the second original motion information, and if so, the MVD value corresponding to the second original motion information is determined based on AwpMvdDir1 and AwpMvdStep1. Obviously, when MVD is superimposed on one original motion information and not on the other original motion information, or the MVD values superimposed on the two original motion information are different, the first original motion information and the second original motion information are allowed to be the same, and awp_cand_idx0 represents the index value of the first original motion information, and awp_cand_idx1 represents the index value of the second original motion information, so the analysis methods of awp_cand_idx0 and awp_cand_idx1 are completely consistent, that is, the first original motion information corresponding to awp_cand_idx0 is analyzed from the complete motion information candidate list, and the second original motion information corresponding to awp_cand_idx1 is analyzed from the complete motion information candidate list.
[0458] If neither of the two original motion information has MVD superimposed thereon, or if the MVD values superimposed on the two original motion information are the same, the first original motion information is different from the second original motion information, and based on this, the analysis methods of awp_cand_idx0 and awp_cand_idx1 are not consistent, so the first original motion information corresponding to awp_cand_idx0 is analyzed from the complete motion information candidate list, and since the second original motion information is different from the first original motion information, instead of analyzing the second original motion information correspon...
Claims
1. An encoding / decoding method, comprising: When it is determined to start weighted prediction for a current block, obtaining a weighted prediction angle and a weight setting parameter for the current block; setting a reference weight value for a peripheral position outside the current block based on the weight setting parameter; For each pixel position of the current block, determining a surrounding matching position to which the pixel position points from surrounding positions outside the current block based on the weighted prediction angle, 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; obtaining a motion information candidate list including at least one candidate motion information; and obtaining first target motion information and second target motion information of the current block based on the motion information candidate list; for each pixel location of the current block, determining a first predicted value for the pixel location based on first target motion information of the current block, determining a second predicted value for the pixel location based on second target motion information 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; determining a weighted prediction value of the current block based on weighted prediction values of all pixel positions of the current block; The step of obtaining the motion information candidate list includes: obtaining at least one available motion information to be added to a motion information candidate list; and obtaining the motion information candidate list based on the at least one available motion information; The available motion information is At least one of spatial domain motion information, time domain motion information, and predefined motion information; The step of obtaining the motion information candidate list based on the at least one available motion information includes: For available motion information currently to be added to the motion information candidate list, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with candidate motion information already present in the motion information candidate list, adding the unidirectional motion information to the motion information candidate list; if the available motion information is bidirectional motion information, clipping the bidirectional motion information to first unidirectional motion information and second unidirectional motion information; and if the first unidirectional motion information does not overlap with candidate motion information already present in the motion information candidate list, adding the first unidirectional motion information to the motion information candidate list; The operation of checking whether the unidirectional motion information overlaps with candidate motion information already existing in the motion information candidate list includes: If a display order POC of a reference frame indicated by the unidirectional motion information is the same as a POC of a reference frame indicated by the candidate motion information, and a motion vector of the unidirectional motion information is the same as a motion vector of the candidate motion information, determining that the unidirectional motion information and the candidate motion information overlap, and if not, determining that the unidirectional motion information and the candidate motion information do not overlap. Encoding and decoding methods.
2. The step of obtaining at least one available motion information to be added to the motion information candidate list includes: For a spatial domain neighboring block of the current block, if the spatial domain neighboring block exists and the spatial domain neighboring block adopts an inter prediction mode, determining motion information of the spatial domain neighboring block as available motion information; or selecting a time-domain neighboring block corresponding to the preset position from a reference frame of the current block according to a preset position of the current block, and determining motion information of the time-domain neighboring block as available motion information; or determining pre-defined motion information as available motion information; The preset motion information is including default motion information derived based on candidate motion information already present in the motion information candidate list; 2. The method of claim 1 .
3. The step of obtaining the motion information candidate list based on the at least one available motion information includes: For available motion information to be currently added to the motion information candidate list, if the available motion information is preset motion information, the method further includes adding the available motion information to the motion information candidate list.
3. The method of claim 2 .
4. the first unidirectional motion information is unidirectional motion information pointing to a reference frame in a first reference frame list; the second unidirectional motion information is unidirectional motion information pointing to a reference frame in a second reference frame list; Wherein the first reference frame list is List0 and the second reference frame list is List1, or the first reference frame list is List1, and the second reference frame list is List0; 4. The method according to claim 3 .
5. obtaining first target motion information and second target motion information of the current block based on the motion information candidate list, selecting a candidate motion information from the motion information candidate list as a first original motion information of the current block, and selecting a candidate motion information from the motion information candidate list as a second original motion information of the current block; determining first target motion information of the current block based on the first original motion information; determining second target motion information for the current block based on the second original motion information; 2. The method of claim 1 .
6. 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 first motion vector difference corresponding to the first original motion vector, and determining the first target motion vector based on the first motion vector difference and the first original motion vector; or determining the first original motion vector as the first target motion vector; The second original motion information includes a second original motion vector, and the second target motion information includes a second target motion vector, and the step of determining second target motion information of the current block based on the second original motion information includes: obtaining a second motion vector difference corresponding to the second original motion vector, and determining the second target motion vector based on the second motion vector difference and the second original motion vector; or determining the second original motion vector as the second target motion vector; The step of obtaining a first motion vector difference corresponding to the first original motion vector includes: obtaining direction information and amplitude information of the first motion vector difference; determining the first motion vector difference based on directional information and amplitude information of the first motion vector difference; The step of obtaining a second motion vector difference corresponding to the second original motion vector includes: obtaining direction information and amplitude information of the second motion vector difference; determining the second motion vector difference based on directional information and amplitude information of the second motion vector difference; 6. The method of claim 5 .
7. The weight setting parameters include a weight conversion rate and a start position of the weight conversion, and the start position of the weight conversion is determined by at least one parameter among a weight prediction angle of the current block, a weight prediction position of the current block, and a size of the current block; the weighted prediction angle is a horizontal angle, or the weighted prediction angle is a vertical angle, or the absolute value of the slope of the weighted prediction angle is 2 to the power of n, where n is an integer; If the current block supports a weight conversion rate switching mode, Obtaining weight conversion rate indication information for the current block; determining a weight transformation rate of the current block according to the weight transformation rate indication information; determining a weighting factor of the current block based on the weighting factor indication information, When the weight conversion ratio instruction information is first instruction information, the weight conversion ratio is a first weight conversion ratio, and when the weight conversion ratio instruction information is second instruction information, the weight conversion ratio is a second weight conversion ratio; The weight transformation rate indication information of the current block is a weight transformation rate switching identifier corresponding to the current block, the first indication information is used to indicate that the current block does not need a weight transformation rate switching, and the second indication information is used to indicate that the current block needs a weight transformation rate switching.
7. The method according to any one of claims 1 to 6.
8. The number of the 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, and the peripheral positions outside the current block include peripheral positions in one upper row outside the current block or peripheral positions in one left column outside the current block; The reference weight value of the peripheral position outside the current block is monotonically increasing or decreasing, The reference weight values of the peripheral positions outside the current block include a reference weight value of a target area, a reference weight value of a first adjacent area of the target area, and a reference weight value of a second adjacent area of the target area; The reference weight values of the first adjacent region are all second reference weight values, the reference weight values of the second adjacent region are all third reference weight values, and the second reference weight values are different from the third reference weight values; The target region includes one reference weight value or at least two reference weight values, and when the target region includes at least two reference weight values, the at least two reference weight values of the target region are monotonically increasing or monotonically decreasing; The neighboring positions outside the current block include integer pixel positions, or sub-pixel positions, or integer pixel positions and sub-pixel positions, and determining a target weight value for the pixel position based on a reference weight value associated with the neighboring matching positions includes: When the neighboring matching position is an integer pixel position and a reference weight value has already been 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 determining a target weight value of the pixel position based on the reference weight value of the sub-pixel position when the neighboring matching position is a sub-pixel position and a reference weight value has already been set for the sub-pixel position; 8. The method of claim 7.
9. An encoding / decoding device, comprising: an obtaining module for obtaining a weighted prediction angle and a weight setting parameter of the current block when it is determined to start weighted prediction for the current block; a setting module for setting reference weight values at peripheral positions outside the current block based on the weight setting parameters; and a determination module for, for each pixel position of the current block, determining a surrounding matching position to which the pixel position points from surrounding positions outside the current block based on the weighted prediction angle, 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 obtaining module is further used for obtaining a motion information candidate list including at least one candidate motion information, and obtaining a first target motion information and a second target motion information of the current block according to the motion information candidate list; the determination module is further used for determining, for each pixel position of the current block, a first predicted value for the pixel position based on first target motion information of the current block, determining a second predicted value for the pixel position based on second target motion information 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. It is characterized by: In obtaining the motion information candidate list, the obtaining module: Obtaining at least one available motion information to be added to a motion information candidate list; configured to obtain the motion information candidate list based on the at least one available motion information; The available motion information is At least one of spatial domain motion information, time domain motion information, and predefined motion information; In obtaining the motion information candidate list based on the at least one available motion information, the obtaining module: For available motion information currently to be added to the motion information candidate list, if the available motion information is unidirectional motion information and the unidirectional motion information does not overlap with candidate motion information already present in the motion information candidate list, the unidirectional motion information is added to the motion information candidate list, if the available motion information is bidirectional motion information, the bidirectional motion information is clipped to first unidirectional motion information and second unidirectional motion information, and if the first unidirectional motion information does not overlap with candidate motion information already present in the motion information candidate list, the first unidirectional motion information is added to the motion information candidate list; The operation of checking whether the unidirectional motion information overlaps with candidate motion information already existing in the motion information candidate list includes: If a display order POC of a reference frame indicated by the unidirectional motion information is the same as a POC of a reference frame indicated by the candidate motion information, and a motion vector of the unidirectional motion information is the same as a motion vector of the candidate motion information, determining that the unidirectional motion information and the candidate motion information overlap, and if not, determining that the unidirectional motion information and the candidate motion information do not overlap. Encoding and decoding device.
10. A decoding device, comprising: a processor; and a machine-readable storage medium having machine-executable instructions executable by the processor; The processor executes the machine-executable instructions to perform the method of any one of claims 1 to 8. A decoding device characterized by:
11. A coding device comprising: a processor; and a machine-readable storage medium having machine-executable instructions executable by the processor; The processor executes the machine-executable instructions to perform the method of any one of claims 1 to 8.
1. An encoding device comprising:
12. A machine-readable storage medium having machine-executable instructions stored thereon that are executable by a processor, comprising: The processor is adapted to carry out the method according to any one of claims 1 to 8 by executing the machine-executable instructions. A machine-readable storage medium comprising:
Citation Information
Patent Citations
Encoding and decoding method, device and equipment
CN112543323A
Encoding and decoding method, device and equipment
CN112584142A
Side information signaling for inter prediction with geometric partitioning
WO2020094052A1
Method for encoding / decoding image signal, and apparatus therefor
WO2020096388A1
