Encoding and decoding methods, apparatus and devices

The motion vector adjustment mode for bidirectional blocks in video encoding technologies addresses the issue of low prediction quality and errors by fine-tuning motion vectors, enhancing coding performance and efficiency.

JP7842932B2Active Publication Date: 2026-04-08HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2025-10-01
Publication Date
2026-04-08

AI Technical Summary

Technical Problem

Existing video encoding technologies face reduced encoding performance for bidirectional blocks due to the lack of effective methods to adjust first and second original motion vectors, leading to low prediction quality and prediction errors.

Method used

A motion vector adjustment mode is activated for bidirectional blocks, where motion vectors from two different directions are adjusted based on local search methods to obtain target motion vectors, improving prediction quality and efficiency.

Benefits of technology

This approach enhances coding performance and coding efficiency by reducing prediction errors and improving prediction quality for bidirectional blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007842932000006
    Figure 0007842932000006
  • Figure 0007842932000007
    Figure 0007842932000007
  • Figure 0007842932000008
    Figure 0007842932000008
Patent Text Reader

Abstract

To provide an encoding and decoding method, apparatus and device for improving encoding performance.SOLUTION: A decoding method includes the steps of determining, for each subblock among at least one subblock included in the current block, a first reference block on the basis of a first original motion vector of the subblock and a second reference block on the basis of a second original motion vector of the subblock when it is determined to use a motion vector adjustment mode for a current block, adjusting the first original motion vector and the second original motion vector to obtain a first target motion vector and a second target motion vector, determining a predicted value of the subblock on the basis of the first target motion vector and the second target motion vector, and determining a predicted value of the current block on the basis of the predicted values of all the subblocks.SELECTED DRAWING: Figure 4
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of encoding and decoding technologies, and particularly relates to encoding and decoding methods, apparatuses, and devices.

Background Art

[0002] In order to achieve the purpose of saving space, all video images are encoded and then transmitted. A complete video encoding method can include processes such as prediction, transformation, quantization, entropy encoding, filtering, etc. Prediction encoding includes intra encoding and inter encoding. Inter encoding utilizes the correlation in the video time domain to predict the pixels of the current image using the pixels of neighboring encoded images, thereby achieving the purpose of effectively removing the redundancy in the video time domain. In inter encoding, a motion vector (MV) can be used to represent the relative displacement between the current block of the current picture and the reference block of the reference picture. For example, if the time domain correlation between the current picture A and the reference picture B is high and it is necessary to transmit the current block A1 of the current picture A, motion search is performed in the reference picture B to find the block B1 (i.e., the reference block) that best matches the current block A1, determine the relative displacement between the current block A1 and the reference block B1, and this relative displacement is the motion vector of the current block A1. Instead of transmitting the current block A1 to the decoding side, the encoding side transmits the motion vector to the decoding side, and the decoding side can obtain the current block A1 based on the motion vector and the reference block B1. Obviously, the number of bits occupied by the motion vector is smaller than the number of bits occupied by the current block A1, so a large amount of bits can be saved.

[0003] In related technologies, if the current block is a unidirectional block, the motion vector of the current block (hereinafter referred to as the original motion vector) can be obtained, the original motion vector can be adjusted, and then encoded / decoded based on the adjusted motion vector, thereby improving encoding performance. However, if the current block is a bidirectional block, after obtaining the first and second original motion vectors of the current block, there is currently no reasonable solution for how to adjust the first and second original motion vectors. In other words, in the case of bidirectional blocks, encoding performance is reduced due to problems such as low prediction quality and prediction errors. [Overview of the project]

[0004] This invention provides coding and decoding methods, apparatus, and devices that can improve coding performance.

[0005] The present invention provides an encoding and decoding method, and the said method is As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then it is decided to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, the step includes performing motion compensation for the current block.

[0006] The present invention provides an encoding and decoding device, and the device is As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such as the size of both reference pictures in the current block being the same as the size of the current picture, then a decision module is used to determine whether to activate motion vector adjustment mode for the current block. If you decide to activate motion vector adjustment mode for the current block, this includes a motion compensation module for performing motion compensation for the current block.

[0007] The present invention provides an encoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor. The aforementioned processor is used to accomplish the following steps by executing machine-executable instructions. As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then it is decided to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, the step of performing motion compensation for the current block.

[0008] The present invention provides a decoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor. The aforementioned processor is used to accomplish the following steps by executing machine-executable instructions. As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then it is decided to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, the step of performing motion compensation for the current block. [Effects of the Invention]

[0009] As can be seen from the above technical solutions, in the embodiments of the present invention, when it is decided to activate the motion vector adjustment mode for the current block, instead of determining the predicted value based on the first original motion vector and the second original motion vector, the first target motion vector and the second target motion vector are obtained based on the first original motion vector and the second original motion vector, and the predicted value is determined based on the first target motion vector and the second target motion vector, thereby solving problems such as low prediction quality and prediction error, and improving coding performance and coding efficiency. [Brief explanation of the drawing]

[0010] [Figure 1A] This is a schematic diagram of interpolation in one embodiment of the present invention. [Figure 1B] It is a schematic diagram of a video encoding framework in an embodiment of the present invention. [Figure 2] It is a flowchart of an encoding and decoding method in an embodiment of the present invention. [Figure 3] It is a flowchart of an encoding and decoding method in an embodiment of the present invention. [Figure 4] It is a flowchart of an encoding and decoding method in an embodiment of the present invention. [Figure 5] It is a schematic diagram of a reference block obtained in an embodiment of the present invention. [Figure 6] It is a schematic diagram of the repetition of motion vectors in an embodiment of the present invention. [Figure 7A] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7B] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7C] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7D] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7E] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7F] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. [Figure 7G] It is a schematic diagram of the order of candidate points in an embodiment of the present invention. <00照00105>It is a schematic diagram of expanding a reference block in an embodiment of the present invention. <00001照7>It is a structural diagram of an encoding and decoding device in an embodiment of the present invention. [Figure 9B] It is a hardware architecture diagram of a decoding device in an embodiment of the present invention. [Figure 9C] It is a hardware architecture diagram of an encoding device in an embodiment of the present invention. [Modes for carrying out the invention]

[0011] The terms used in embodiments of the present invention are not intended to limit the embodiments of the present invention, but are used solely for the purpose of describing specific embodiments. The singular forms “one,” “described,” and “this” used in the embodiments and claims of this application are also intended to include the plural form unless the context clearly indicates otherwise. It should also be understood that “and / or” in the terms used herein means any or all possible combination including one or more items listed in relation. In embodiments of the present invention, the terms first, second, and third may be applied to describe a variety of information, but it should be understood that this information should not be limited to these. These terms are used solely to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may be referred to as second information, and similarly, second information may be referred to as first information. Depending on the context, further use of the word “if” may be interpreted as “when,” “if,” or “in response to.”

[0012] Embodiments of the present invention provide encoding and decoding methods, apparatus, and devices, relating to the following concepts.

[0013] Intra-prediction and inter-prediction techniques: Intra-prediction (within a frame) aims to eliminate spatial redundancy in video by using the spatial relationships of video to predict the current pixel using the pixels of the encoded block of the current image. Inter-prediction (between frames) aims to effectively eliminate temporal redundancy in video by using the temporal relationships of video, as video sequences have a higher temporal relationship than usual, and predicting the pixels of the current image using neighboring encoded image pixels. The inter-prediction portion of major video encoding standards uses block-based motion compensation techniques, and the main principle is to search for one optimal matching block from the previous encoded image for each pixel block of the current image; this process is called motion estimation.

[0014] Motion Vector (MV): In intercoding, the motion vector is used to represent the relative displacement between the current block and the optimal matching block in the reference picture. Each divided block has a corresponding motion vector transmitted to the decoding side, and the motion vector of each block is encoded and transmitted independently, which requires a very large number of bits, especially when divided into small blocks. To reduce the number of bits used to encode the motion vector, the spatial relationship between neighboring image blocks is used to predict the motion vector of the current block based on the motion vector of the neighboring encoded block, and then the predicted difference is encoded, thereby effectively reducing the number of bits used to represent the motion vector. When encoding the motion vector of the current block, the motion vector of the current block is predicted using the motion vector of the neighboring encoded block, and the difference between the predicted value of the motion vector (MVP) and the actual estimated value of the motion vector (MVD) is encoded, effectively reducing the number of encoded bits.

[0015] Motion Information: The motion vector represents the positional offset of the current block relative to the reference block. Therefore, in order to accurately obtain information about the image block being faced, in addition to the motion vector, reference picture index information is required to indicate which reference picture to use. A reference picture list is created for the image of the current picture, and the reference picture index information indicates which reference picture in the reference picture list the current block is using. Many encoding techniques further support multiple reference picture lists, and therefore, a single index value called the reference direction can be used to indicate which reference picture list to use. Motion-related information such as the motion vector, reference picture index, and reference direction is called motion information.

[0016] Interpolation: If the current motion vector has non-integer pixel precision, it is not possible to directly copy existing pixel values ​​from the reference picture corresponding to the current block. The required pixel values ​​for the current block can only be obtained through interpolation. As shown in Figure 1A, the pixel value Y is 1 / 2 pixels offset. 1 / 2 If it is necessary to obtain a specific value, it can be obtained by interpolating the surrounding existing pixel values ​​X. For example, if an interpolation filter with N taps is used, it is necessary to interpolate the surrounding N integer pixels to obtain the value.

[0017] Motion compensation: Motion compensation is the process of obtaining all pixel values ​​in the current block by interpolation or copying.

[0018] Merge mode includes: normal merge mode (also called regular merge mode), subblock merge mode (a merge mode using subblock motion information, also called Subblock merge mode), MMVD mode (a merge mode that encodes motion differences, also called merge with MVD mode), CIIP mode (a merge mode that generates new predicted values ​​by combining inter-intra predictions, also called combine inter-intra prediction mode), TPM mode (a merge mode for triangular prediction, also called triangular prediction mode), and GEO mode (a merge mode based on arbitrary geometric partition shapes, also called Geometrical Partitioning).

[0019] Skip mode: Skip mode is a special fusion mode, and the difference between skip mode and regular fusion mode is that in skip mode, it is not necessary to encode the residual difference. When a block is currently in skip mode, CIIP mode is off by default, but regular fusion mode, subblock fusion mode, MMVD mode, TPM mode, and GEO mode are still applicable.

[0020] For example, the method for generating predicted values ​​is determined based on modes such as normal fusion mode, subblock fusion mode, MMVD mode, CIIP mode, TPM mode, and GEO mode. After generating predicted values, in fusion mode, the reconstructed values ​​can be obtained using the predicted values ​​and residuals. In skip mode, there are no residuals, and the reconstructed values ​​are obtained directly using the predicted values.

[0021] Sequence parameter set (SPS): The sequence parameter set contains flags that determine whether enabling or disabling a tool is permitted throughout the entire sequence. If the flag value is 1, the tool corresponding to that flag is permitted to be enabled in the video sequence; if the flag value is 0, the tool corresponding to that flag is not permitted to be enabled in the encoding process in the video sequence.

[0022] Normal fusion mode: Select one motion information from the candidate motion information list and generate a predicted value for the current block based on that motion information. The candidate motion information list includes candidate motion information for blocks that are spatially close, candidate motion information for blocks that are temporally close, candidate motion information for blocks that are spatially not close, motion information obtained by combining existing motion information, default motion information, etc.

[0023] MMVD mode: Based on the candidate motion information list for normal fusion mode, one motion information is selected from the candidate motion information list for normal fusion mode as the reference motion information, and the motion information difference is obtained using a table lookup method. The final motion information is obtained based on the reference motion information and the motion information difference, and the predicted value of the current block is generated based on this final motion information.

[0024] CIIP mode: Combines intra-predicted values ​​and inter-predicted values ​​to obtain a new predicted value for the current block.

[0025] Subblock fusion mode: Subblock fusion mode includes Affine fusion mode and subblock TMVP mode.

[0026] The Affine fusion mode is similar to the normal fusion mode in that it selects one motion information from a list of candidate motion information and generates a predicted value for the current block based on that motion information. The difference from the normal fusion mode is that while the motion information in the candidate motion information list of the normal fusion mode is a two-parameter translational motion vector, the motion information in the candidate motion information list of the Affine fusion mode is either four-parameter Affine motion information or six-parameter Affine motion information.

[0027] The subblock-based temporal motion vector prediction (TMVP) mode directly reuses motion information from a block in a time-domain reference picture to generate a predicted value for the current block, and the motion information of each subblock within that block does not necessarily have to be the same.

[0028] TPM mode: One block is divided into two triangular subblocks (there are two triangular subblocks with angles of 45 degrees and 135 degrees), and these two triangular subblocks have different unidirectional motion information. TPM mode is used only in the prediction process and does not affect the subsequent conversion and quantization processes, and the unidirectional motion information here is also obtained directly from the candidate motion information list.

[0029] GEO Mode: GEO mode is similar to TPM mode, but the division shape is different. In GEO mode, one quadrilateral block is divided into two subblocks of any shape (any other shape except the two triangular subblocks of TPM, for example, one triangular subblock and one pentagonal subblock, or one triangular subblock and one quadrilateral subblock, or two trapezoidal subblocks), and this division shape is not limited. These two subblocks divided in GEO mode have different unidirectional motion information.

[0030] As can be seen from the above examples, the fusion mode and skip mode in this embodiment are prediction modes that directly select one motion information from a list of candidate motion information and generate a predicted value for the current block. These prediction modes do not require a motion search process on the encoding side, and modes other than the MMVD mode do not require encoding the motion information difference.

[0031] Video Encoding Framework: As shown in Figure 1B, the encoding-side processing process of the embodiment of the present invention can be implemented using the video encoding framework, and the schematic diagram of the video decoding framework is the same as in Figure 1B and is omitted here. The decoding-side processing process of the embodiment of the present invention can be implemented using the video decoding framework. Specifically, the video encoding framework and the video decoding framework include modules such as intra prediction, motion estimation / motion compensation, reference picture buffer, loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, and entropy encoder. On the encoding side, the encoding-side processing process can be implemented through the cooperation of these modules, and on the decoding side, the decoding-side processing process can be implemented through the cooperation of these modules.

[0032] In related technologies, if the current block is a bidirectional block, there is no reasonable solution for how to adjust the first and second original motion vectors after obtaining the first and second original motion vectors of the current block.

[0033] In embodiments of the present invention, considering that when the current block is a bidirectional block, motion vectors from two different directions often have a mirror-symmetric relationship, redundancy can be further eliminated based on this characteristic. For example, a motion vector adjustment mode can be provided, in which a predicted value is obtained based on the original motion vector, and the motion vector is fine-tuned by a local search method on the decoding side to obtain a better motion vector in order to generate a predicted value with less distortion.

[0034] For example, when it is decided to activate (enable) motion vector adjustment mode for the current block, for each subblock of the current block, a first reference block corresponding to the subblock is determined based on the first original motion vector of the subblock, a second reference block corresponding to the subblock is determined based on the second original motion vector of the subblock, the first original motion vector and the second original motion vector are adjusted based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector and a second target motion vector, and the predicted value of the subblock is determined based on the first target motion vector and the second target motion vector. This method solves problems such as low prediction quality and prediction errors, and improves coding performance and coding efficiency.

[0035] The encoding and decoding methods of the present invention will be described in detail below in relation to several specific embodiments.

[0036] Example 1: As shown in Figure 2, this is a flowchart of an encoding and decoding method provided in an embodiment of the present invention, which can be applied to either the decoding side or the encoding side, and which may include steps 201 and 202.

[0037] In step 201, As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. The step may include determining to activate motion vector adjustment mode for the current block if all conditions are met, such as the size of both reference pictures in the current block being the same as the size of the current picture.

[0038] In one possible embodiment, As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If either of the following conditions is not met—that the sizes of both reference pictures in the current block are the same as the size of the current picture—then it is decided not to activate motion vector adjustment mode for the current block.

[0039] In the above embodiment, seven conditions are given, and based on these seven conditions, it is determined whether or not to activate the motion vector adjustment mode for the current block. In actual applications, some of the seven conditions may be selected, and based on the selected conditions, it may be determined whether or not to activate the motion vector adjustment mode for the current block. For example, five conditions may be selected from the seven conditions, and this selection method is not limited to any five conditions. If all five selected conditions are met, it is decided to activate the motion vector adjustment mode for the current block. If any of the five selected conditions are not met, it is decided not to activate the motion vector adjustment mode for the current block. Of course, any other number of conditions may be selected from the seven conditions, and this is not limited.

[0040] In the above embodiment, the fusion mode or skip mode includes normal fusion mode, subblock fusion mode, MMVD mode, CIIP mode, TPM mode, and GEO mode. The fact that the prediction mode of the current block is not any mode other than normal fusion mode means that the prediction mode is not subblock fusion mode, MMVD mode, CIIP mode, TPM mode, or GEO mode, etc.

[0041] For example, if the current block prediction mode is fusion mode or skip mode, it is neither MMVD mode nor CIIP mode.

[0042] If we determine that the current block's prediction mode is either fusion mode or skip mode, and that the current block's prediction mode is not MMVD mode, nor CIIP mode, nor subblock fusion mode, nor TPM mode, nor GEO mode, then we can determine that the current block's prediction mode is not any mode other than normal fusion mode. In other words, we determine that the current block's prediction mode is normal fusion mode by elimination.

[0043] In the above embodiment, the fact that the predicted value of the current block is obtained by weighting the reference blocks from the two reference pictures means that the current block uses a bidirectional prediction mode, i.e., the predicted value of the current block is obtained by weighting the reference blocks from the two reference pictures.

[0044] In the above embodiment, the current block may correspond to motion information in two lists, which are designated as the first motion information and the second motion information. The first motion information includes a first reference picture and a first original motion vector, and the second motion information includes a second reference picture and a second original motion vector. The two reference pictures may be the first reference picture and the second reference picture. The display order of the two reference pictures being before and after the current picture, respectively, means that the first reference picture is before the current picture containing the current block, and the second reference picture is after the current picture. Exemplarily, the first reference picture is also called the forward reference picture in the first list (e.g., list0), and the second reference picture is also called the backward reference picture in the second list (e.g., list1).

[0045] In the above embodiment, the fact that the width, height, and area of ​​the block are currently within the limiting range includes the condition that the width is greater than or equal to a first threshold, the height is greater than or equal to a second threshold, and the area is greater than or equal to a third threshold, or that the width is greater than or equal to a first threshold, the height is greater than or equal to a second threshold, and the area is greater than a fourth threshold. Exemplarily, the third threshold may be greater than the fourth threshold. For example, the first threshold may be 8, the second threshold may be 8, the third threshold may be 128, and the fourth threshold may be 64. Of course, the above values ​​are merely examples and are not limiting.

[0046] In the above embodiment, the control information allowing the current block to use the move vector adjustment mode may include, but is not limited to, the sequence level control information (e.g., multi-picture control information) allowing the current block to use the move vector adjustment mode, and / or the picture level control information (e.g., single-picture control information) allowing the current block to use the move vector adjustment mode.

[0047] In step 202, if it is decided to activate motion vector adjustment mode for the current block, motion compensation is performed for the current block.

[0048] In one possible embodiment, when it is decided to activate motion vector adjustment mode for the current block, for each of the at least one subblocks contained in the current block, a first reference block corresponding to the subblock is determined based on the first original motion vector of the subblock, a second reference block corresponding to the subblock is determined based on the second original motion vector of the subblock, the first original motion vector and the second original motion vector are adjusted based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector, and the predicted value of the subblock is determined based on the first target motion vector and the second target motion vector. After obtaining the predicted value of each subblock, the predicted value of the current block can be determined based on the predicted value of each subblock.

[0049] Exemplary, the steps of determining a first reference block corresponding to the subblock based on a first original motion vector of the subblock, and determining a second reference block corresponding to the subblock based on a second original motion vector of the subblock, are: A step of determining a first reference block corresponding to the subblock from a first reference picture based on a first original motion vector of the subblock, wherein the pixel value of each pixel point in the first reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the first reference block, or by copying the pixel values ​​of neighboring pixel points in the first reference block. The method may include, but is not limited to, the step of determining a second reference block corresponding to the subblock from a second reference picture based on a second original motion vector of the subblock, wherein the pixel value of each pixel point in the second reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the second reference block, or by copying the pixel values ​​of neighboring pixel points in the second reference block.

[0050] For example, the size of the first reference block is the same as the size of the second reference block, the width of the first reference block is determined based on the width and search range of the subblock, and the height of the first reference block is determined based on the height and search range of the subblock.

[0051] For example, for each subblock currently contained in the block, the first original motion vector and the second original motion vector of the subblock are adjusted based on the first pixel value of the first reference block corresponding to the subblock and the second pixel value of the second reference block corresponding to the subblock, thereby obtaining the first target motion vector corresponding to the first original motion vector and the second target motion vector corresponding to the second original motion vector, i.e., the first target motion vector and the second target motion vector of the subblock.

[0052] In one possible embodiment, an initial motion vector is used as the center, and some or all motion vectors are selected from motion vectors around the initial motion vector that include the initial motion vector, and the selected motion vectors are determined to be candidate motion vectors, the initial motion vector being either a first original motion vector or a second original motion vector. Next, based on a first pixel value of a first reference block and a second pixel value of a second reference block, one motion vector is selected from the initial motion vector and each candidate motion vector as the optimal motion vector. Then, the first original motion vector is adjusted based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector, and the second original motion vector is adjusted based on the optimal motion vector to obtain a second target motion vector corresponding to the second original motion vector.

[0053] For example, the steps of adjusting a first original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector, adjusting a second original motion vector based on the optimal motion vector to obtain a second target motion vector corresponding to the second original motion vector may include the steps of determining a first integer pixel motion vector adjustment value, a second integer pixel motion vector adjustment value, a first decimal pixel motion vector adjustment value, and a second decimal pixel motion vector adjustment value of a subblock based on the optimal motion vector, adjusting the first original motion vector based on the first integer pixel motion vector adjustment value and the first decimal pixel motion vector adjustment value to obtain a first target motion vector of a subblock, and adjusting a second original motion vector based on the second integer pixel motion vector adjustment value and the second decimal pixel motion vector adjustment value to obtain a second target motion vector of a subblock.

[0054] For example, for each subblock among at least one subblock currently contained in a block, a predicted value for the subblock can be determined based on the first target motion vector and the second target motion vector of the subblock, a process that will not be described in detail.

[0055] In one possible embodiment, if the optimal motion vector is the same as the initial motion vector, a third reference block corresponding to the subblock is determined from a first reference picture based on the first target motion vector of the subblock, and a fourth reference block corresponding to the subblock is determined from a second reference picture based on the second target motion vector of the subblock. Next, the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block are weighted to obtain a predicted value for the subblock.

[0056] In another possible embodiment, if the optimal motion vector is not different from the initial motion vector, a fifth reference block is determined from the first reference picture, the fifth reference block is extended to obtain a sixth reference block, and then, based on the first target motion vector of the subblock, a third reference block corresponding to the subblock is selected from the sixth reference block. A seventh reference block is determined from the second reference picture, the seventh reference block is extended to obtain an eighth reference block, and based on the second target motion vector of the subblock, a fourth reference block corresponding to the subblock is selected from the eighth reference block. Next, the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block are weighted to obtain a predicted value for the subblock.

[0057] In the above embodiment, obtaining a predicted value of the subblock by weighting the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block includes, but is not limited to, performing a weighting process on the pixel values ​​of the third reference block, a first weight corresponding to the pixel values ​​of the third reference block, the pixel values ​​of the fourth reference block, and a second weight corresponding to the pixel values ​​of the fourth reference block to obtain a predicted value of the subblock. For example, the first weight and the second weight may be the same.

[0058] For example, one could obtain the predicted value for each subblock, then combine the predicted values ​​for each subblock to obtain the predicted value for the current block, but the process for determining the predicted value for the current block is not limited.

[0059] As can be seen from the above technical solutions, in the embodiments of the present invention, when it is decided to activate the motion vector adjustment mode for the current block, instead of determining the predicted value based on the first original motion vector and the second original motion vector, the first target motion vector and the second target motion vector are obtained based on the first original motion vector and the second original motion vector, and the predicted value is determined based on the first target motion vector and the second target motion vector. This solves problems such as low prediction quality and prediction error, and improves coding performance and coding efficiency.

[0060] Example 2: Based on a similar concept to the above method, Figure 3 shows a flowchart of another encoding and decoding method provided in an embodiment of the present invention, which can be applied to the encoding side and may include steps 301 to 305.

[0061] In step 301, the encoding side decides whether or not to activate motion vector adjustment mode for the current block. If so, step 302 is performed; otherwise, there is no need to use the motion vector adjustment method provided in the present invention, and the handling of this situation is not limited.

[0062] For example, if the encoding side decides to activate motion vector adjustment mode for the current block, it indicates that the motion information for the current block is not sufficiently accurate, so it activates motion vector adjustment mode for the current block (i.e., the technical solution of the present invention) and performs step 302.

[0063] If the encoding side decides not to activate motion vector adjustment mode for the current block, it indicates that the motion information for the current block is sufficiently accurate, and therefore, motion vector adjustment mode is not activated for the current block, and the motion vector adjustment method provided in the present invention does not need to be used.

[0064] In step 302, for each subblock among the at least one subblock currently contained in the block, the encoding side determines the first reference block corresponding to the subblock from the first reference picture based on the first original motion vector of the subblock, and determines the second reference block corresponding to the subblock from the second reference picture based on the second original motion vector of the subblock. For convenience of distinction, the pixel value of each pixel point in the first reference block is called the first pixel value, and the pixel value of each pixel point in the second reference block is called the second pixel value.

[0065] For example, if the current block is a block using bidirectional prediction, then each subblock of the current block may have bidirectional motion information. This bidirectional motion information may include two reference pictures and two original motion vectors, and the bidirectional motion information may include a first reference picture, a first original motion vector, a second reference picture, and a second original motion vector.

[0066] Based on the first original motion vector, the encoding side determines the first reference block corresponding to the subblock from the first reference picture, and the pixel value of each pixel point in the first reference block is called the first pixel value. Based on the second original motion vector, the encoding side determines the second reference block corresponding to the subblock from the second reference picture, and the pixel value of each pixel point in the second reference block is called the second pixel value.

[0067] In one example, the distance between the current picture where the current block is located and the first reference picture may be the same as the distance between the second reference picture and the current picture where the current block is located. For example, the first reference picture is in frame 1, the current picture is in frame 5, and the second reference picture is in frame 9.

[0068] In one example, the first original motion vector and the second original motion vector may be mirror-symmetric, for example, the first original motion vector may be (4,4) and the second original motion vector may be (-4,-4). Alternatively, the first original motion vector may be (2.5,3.5) and the second original motion vector may be (-2.5,-3.5). Of course, the above are merely examples and are not limiting.

[0069] The method for determining the first and second reference blocks can be found in subsequent embodiments and is therefore omitted here.

[0070] In step 303, the encoding side adjusts the first original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain the first target motion vector of the subblock, and adjusts the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain the second target motion vector of the subblock.

[0071] For example, when motion vector adjustment mode is activated for a block, the encoding side fine-tunes the first original motion vector and the second original motion vector using a local search method based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a better first target motion vector and a second target motion vector, and then uses the first target motion vector and the second target motion vector to generate a predicted value with less distortion.

[0072] In one example, the current block may contain at least one subblock. If the current block contains only one subblock, that subblock is the current block itself. Each subblock of the current block corresponds to a first original motion vector and a second original motion vector, and after adjustment, the subblock corresponds to a first target motion vector and a second target motion vector.

[0073] For example, if a block currently contains subblocks A and B, subblock A corresponds to the first original motion vector A1 and the second original motion vector A2, and after adjustment, subblock A will correspond to the first target motion vector A3 and the second target motion vector A4. Subblock B corresponds to the first original motion vector B1 and the second original motion vector B2, and after adjustment, subblock B will correspond to the first target motion vector B3 and the second target motion vector B4.

[0074] For example, the first original motion vector A1 corresponding to subblock A and the first original motion vector B1 corresponding to subblock B may be the same, and both are the first original motion vectors of the current block. The second original motion vector A2 corresponding to subblock A and the second original motion vector B2 corresponding to subblock B may be the same, and both are the second original motion vectors of the current block.

[0075] The first original motion vector of each subblock is adjusted accordingly, so that the first target motion vector A3 corresponding to subblock A and the first target motion vector B3 corresponding to subblock B may be the same or different.

[0076] The second original motion vector of each subblock is adjusted accordingly, so that the second target motion vector A4 corresponding to subblock A and the second target motion vector B4 corresponding to subblock B may be the same or different.

[0077] The method for adjusting the original motion vector can be found in later embodiments and is omitted here.

[0078] In step 304, the encoding side determines the predicted value of the subblock based on the first target motion vector and the second target motion vector.

[0079] In step 305, the encoding side determines the predicted value of the current block based on the predicted values ​​of each subblock.

[0080] For example, if the current block includes subblocks A and B, the predicted value of subblock A is determined using the first and second target motion vectors of subblock A, and the predicted value of subblock B is determined using the first and second target motion vectors of subblock B. The predicted values ​​of subblock A and subblock B are the predicted values ​​of the current block.

[0081] For example, the encoding side stores the first target motion vector and the second target motion vector of each subblock in the current block, or stores the first original motion vector and the second original motion vector of each subblock in the current block, or stores the first original motion vector, the second original motion vector, the first target motion vector and the second target motion vector of each subblock in the current block.

[0082] Example 3: Based on a similar idea to the above method, Figure 4 shows a flowchart of another encoding and decoding method provided in an embodiment of the present invention, which can be applied to the decoding side and may include steps 401 to 405.

[0083] In step 401, the decryption side decides whether or not to activate motion vector adjustment mode for the current block. If so, it performs step 402; otherwise, it is not necessary to employ the motion vector adjustment method provided in the present invention, and the processing in this case is not limited.

[0084] For example, if the decoding side decides to activate motion vector adjustment mode for the current block, it indicates that the motion information for the current block is inaccurate, so it activates motion vector adjustment mode for the current block (i.e., the technical solution of the present invention) and performs step 402.

[0085] If the decoding side decides not to activate motion vector adjustment mode for the current block, it indicates that the motion information of the current block is sufficiently accurate, and therefore, it is not necessary to activate motion vector adjustment mode for the current block and not to use the motion vector adjustment method provided in the present invention.

[0086] In step 402, for each subblock among the at least one subblock currently contained in the block, the decoding side determines the first reference block corresponding to the subblock from the first reference picture based on the first original motion vector of the subblock, and determines the second reference block corresponding to the subblock from the second reference picture based on the second original motion vector of the subblock. For convenience of distinction, the pixel value of each pixel point in the first reference block is called the first pixel value, and the pixel value of each pixel point in the second reference block is called the second pixel value.

[0087] In step 403, the decoding side adjusts the first original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain the first target motion vector of the subblock, and adjusts the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain the second target motion vector of the subblock.

[0088] In step 404, the decoding side determines the predicted value of the subblock based on the first target motion vector and the second target motion vector.

[0089] In step 405, the decryption side determines the predicted value of the current block based on the predicted values ​​of each subblock.

[0090] For example, the decoding side stores the first target motion vector and the second target motion vector of each subblock of the current block, or stores the first original motion vector and the second original motion vector of each subblock of the current block, or stores the first original motion vector, the second original motion vector, the first target motion vector and the second target motion vector of each subblock of the current block.

[0091] For example, steps 401 to 405 can refer to steps 301 to 305, which are omitted here.

[0092] Example 4: The above example concerns whether or not to activate the motion vector adjustment mode for the current block, and is described below.

[0093] In one possible embodiment, the following activation conditions can be given. Of course, these activation conditions below are merely examples, and in actual applications, these activation conditions can be combined in any way, and are not limited thereto. Exemplaryly, if all of the following activation conditions are met, it is decided to activate the motion vector adjustment mode for the current block.

[0094] 1. As control information, allow the current block to use the movement vector adjustment mode.

[0095] For example, the control information may include, but is not limited to, sequence-level control information and / or picture-level control information.

[0096] In one possible embodiment, sequence-level (e.g., multi-frame image) control information may include a control flag (e.g., sps_cur_tool_enabled_flag), and picture-level (e.g., single-frame image) control information may include a control flag (e.g., pic_cur_tool_disabled_flag). If sps_cur_tool_enabled_flag is a first value and pic_cur_tool_disabled_flag is a second value, it indicates that the current block is allowed to use the motion vector adjustment mode.

[0097] For example, sps_cur_tool_enabled_flag indicates whether all images in a sequence are allowed to use motion vector adjustment mode. pic_cur_tool_disabled_flag indicates whether each block in the current image is not allowed to use motion vector adjustment mode. A first value for sps_cur_tool_enabled_flag indicates that all images in a sequence are allowed to use motion vector adjustment mode. A second value for pic_cur_tool_disabled_flag indicates that each block in the current image is allowed to use motion vector adjustment mode.

[0098] For example, if sps_cur_tool_enabled_flag is the second value and / or pic_cur_tool_disabled_flag is the first value, it indicates that the block is currently not allowed to use the motion vector adjustment mode; that is, the control information indicates that the block is currently not allowed to use the motion vector adjustment mode.

[0099] In another possible embodiment, sequence-level (e.g., multi-frame image) control information may include a control flag (e.g., sps_cur_tool_disabled_flag), and picture-level (e.g., single-frame image) control information may include a control flag bit (e.g., pic_cur_tool_disabled_flag). If sps_cur_tool_disabled_flag is a second value and pic_cur_tool_disabled_flag is a second value, it indicates that the current block is allowed to use the move vector adjustment mode.

[0100] For example, sps_cur_tool_disabled_flag indicates whether all images in the sequence are not allowed to use motion vector adjustment mode. pic_cur_tool_disabled_flag indicates whether each block in the current image is not allowed to use motion vector adjustment mode. If sps_cur_tool_disabled_flag is a second value, it indicates that all images in the sequence are allowed to use motion vector adjustment mode. If pic_cur_tool_disabled_flag is a second value, it indicates that each block in the current image is allowed to use motion vector adjustment mode.

[0101] For example, if sps_cur_tool_disabled_flag is a first value and / or pic_cur_tool_disabled_flag is a first value, it indicates that the block is currently not allowed to use the motion vector adjustment mode; that is, the control information indicates that the block is currently not allowed to use the motion vector adjustment mode.

[0102] In another possible embodiment, sequence-level (e.g., multi-frame image) control information may include a control flag bit (e.g., sps_cur_tool_enabled_flag), and picture-level (e.g., single-frame image) control information may include a control flag bit (e.g., pic_cur_tool_enabled_flag). If sps_cur_tool_enabled_flag is a first value and pic_cur_tool_enabled_flag is a first value, it indicates that the current block is allowed to use the motion vector adjustment mode.

[0103] For example, sps_cur_tool_enabled_flag indicates whether all images in a sequence are allowed to use motion vector adjustment mode. pic_cur_tool_enabled_flag indicates whether each block in the current image is allowed to use motion vector adjustment mode. If sps_cur_tool_enabled_flag is value 1, it indicates that all images in a sequence are allowed to use motion vector adjustment mode. If pic_cur_tool_enabled_flag is value 1, it indicates that each block in the current image is allowed to use motion vector adjustment mode.

[0104] For example, if sps_cur_tool_enabled_flag is a second value and / or pic_cur_tool_enabled_flag is a second value, it indicates that the block is not currently allowed to use the motion vector adjustment mode; that is, the control information indicates that the block is not currently allowed to use the motion vector adjustment mode.

[0105] In another possible embodiment, sequence-level (e.g., multi-frame image) control information may include a control flag (e.g., sps_cur_tool_disabled_flag), and picture-level (e.g., single-frame image) control information may include a control flag (e.g., pic_cur_tool_enabled_flag). If sps_cur_tool_disabled_flag is a second value and pic_cur_tool_enabled_flag is a first value, it indicates that the current block is allowed to use the motion vector adjustment mode.

[0106] For example, sps_cur_tool_disabled_flag indicates whether all images in the sequence are not allowed to use motion vector adjustment mode. pic_cur_tool_enabled_flag indicates whether each block in the current image is allowed to use motion vector adjustment mode. If sps_cur_tool_disabled_flag is a second value, it indicates that all images in the sequence are allowed to use motion vector adjustment mode. If pic_cur_tool_enabled_flag is a first value, it indicates that each block in the current image is allowed to use motion vector adjustment mode.

[0107] For example, if sps_cur_tool_disabled_flag is the first value and / or pic_cur_tool_enabled_flag is the second value, it indicates that the block is currently not allowed to use the motion vector adjustment mode; that is, the control information indicates that the block is currently not allowed to use the motion vector adjustment mode.

[0108] In the above embodiment, the first value may be 1 and the second value may be 0, or the first value may be 0 and the second value may be 1. Of course, the above is merely an example and is not limiting.

[0109] Exemplary, a frame or picture in this specification corresponds to an image, where the current picture represents the current image, and the reference picture represents the reference image.

[0110] 2. The current block's prediction mode is normal fusion mode, or the current block's prediction mode is fusion mode or skip mode, and the current block's prediction mode is not any other mode other than normal fusion mode.

[0111] In one possible embodiment, it is shown that if the prediction mode of the current block (e.g., inter-prediction mode) is fusion mode or skip mode, and the prediction mode of the current block is not a mode other than normal fusion mode (e.g., sub-block fusion mode, MMVD mode, CIIP mode, TPM mode, GEO mode, etc.), then it is permitted that the current block may use motion vector adjustment mode. For example, if the prediction mode of the current block is fusion mode or skip mode, and the prediction mode of the current block is not MMVD mode, and the prediction mode of the current block is not CIIP mode, then it is shown that the current block may use motion vector adjustment mode.

[0112] Exemplary examples show that if the current block's prediction mode is not fusion mode and the current block's prediction mode is not skip mode, the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 2 is not met.

[0113] For example, if the current block's prediction mode is fusion mode or skip mode, and the current block's prediction mode is a mode other than normal fusion mode (e.g., subblock fusion mode, MMVD mode, CIIP mode, TPM mode, GEO mode, etc.), it is shown that the current block is not allowed to use motion vector adjustment mode, i.e., activation condition 2 is not met.

[0114] In another possible embodiment, it is shown that when the prediction mode of the current block is normal merge mode (e.g., regular merge mode), the current block is allowed to use motion vector adjustment mode. Exemplaryly, normal merge mode generates the prediction value of the current block by reusing some motion information in the current block motion information list as motion information for the current block.

[0115] For example, if the current block's prediction mode is not the normal fusion mode, it is shown that the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 2 is not met.

[0116] 3. The predicted value of the current block is obtained by weighting the reference blocks from the two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The fact that the predicted value of the current block is obtained by weighting the reference blocks from the two reference pictures means that the current block uses a bidirectional prediction mode, i.e., the predicted value of the current block is obtained by weighting the reference blocks from the two reference pictures. Exemplarily, the current block may correspond to motion information from two lists designated as first motion information and second motion information, where the first motion information includes the first reference picture and the first original motion vector, and the second motion information includes the second reference picture and the second original motion vector. The fact that the display order of the two reference pictures is before and after the current picture means that the first reference picture is before the current picture in which the current block is located, and the second reference picture is after the current picture.

[0117] In one possible embodiment, it is shown that if the current block has motion information (e.g., two reference pictures and two motion vectors) for two lists (e.g., list0 and list1), and the display order of the two reference pictures is before and after the current picture, respectively, and the distance from the two reference pictures to the current picture is the same, then the current block is allowed to use motion vector adjustment mode.

[0118] If the display order of the two reference pictures is before and after the current picture, respectively, and the distance from the two reference pictures to the current picture is the same, then the relative relationship between the display order number POC_Cur of the current picture, the display order number POC_0 of the reference picture in list0, and the display order number POC_1 of the reference picture in list1 can be expressed as follows: that is, (POC_0 - POC_Cur) is exactly equal to (POC_Cur - POC_0).

[0119] For example, the current block uses bidirectional prediction, and the two reference pictures corresponding to the current block are from different directions; that is, one reference picture corresponding to the current block is in front of the current picture, and the other reference picture corresponding to the current block is behind the current picture.

[0120] For example, the above condition, "there are currently two referenced pictures in the block, the display order of the two referenced pictures is before and after the current picture, and the distance from the two referenced pictures to the current picture is the same," can be expressed as follows:

[0121] For example, if the current block has only one reference picture, it is shown that the current block will not be allowed to use the move vector adjustment mode, i.e., activation condition 3 will not be met. Alternatively, if the current block has two reference pictures, but both reference pictures are displayed before the current picture, it is shown that the current block will not be allowed to use the move vector adjustment mode, i.e., activation condition 3 will not be met. Alternatively, if the current block has two reference pictures, but both reference pictures are displayed after the current picture, it is shown that the current block will not be allowed to use the move vector adjustment mode, i.e., activation condition 3 will not be met. Alternatively, if the current block has two reference pictures, and the two reference pictures are displayed before and after the current picture, respectively, but the distances from the two reference pictures to the current picture are different, it is shown that the current block will not be allowed to use the move vector adjustment mode, i.e., activation condition 3 will not be met.

[0122] 4. The two reference pictures in the current block have the same weighting.

[0123] In one possible embodiment, it is shown that if the weighting weights of two reference pictures in the current block are the same, the current block is allowed to use the motion vector adjustment mode. Exemplaryly, it is shown that the weighting weights of the two reference pictures in the current block are the same if the picture-level weighting weights of the two reference pictures are the same, for example, if the luminance weight of reference picture refIdxL0 (luma_weight_l0_flag[refIdxL0]) is equal to the luminance weight of reference picture refIdxL1 (luma_weight_l1_flag[refIdxL1]). Alternatively, it is shown that the weighting weights of the two reference pictures in the current block are the same if the block-level weighting weights of the two reference pictures are the same, for example, if the index BcwIdx[xCb][yCb] of the block-level weighting value of the current block is 0. Alternatively, if the two referenced pictures have the same picture-level weighting and the two referenced pictures have the same block-level weighting, then the two referenced pictures in the current block have the same weighting.

[0124] Exemplary, it is shown that if the weighting weights of two reference pictures in the current block are different, the current block will not be allowed to use the movement vector adjustment mode, i.e., activation condition 4 will not be met. For example, if the picture-level weighting weights of two reference pictures are different, it is shown that the weighting weights of the two reference pictures in the current block are different. Or, if the block-level weighting weights of two reference pictures are different, it is shown that the weighting weights of the two reference pictures in the current block are different. Or, if the picture-level weighting weights of two reference pictures are different and the block-level weighting weights of two reference pictures are different, it is shown that the weighting weights of the two reference pictures in the current block are different.

[0125] Exemplary, the weighting weights of the two reference pictures in the current block are the weights used in bidirectional weighting compensation. For example, for each subblock of the current block, it is necessary to obtain two predicted values ​​for each subblock (see subsequent examples for the acquisition process), and then weight these two predicted values ​​to obtain the final predicted value for the subblock. When weighting these two predicted values, the weights corresponding to these two predicted values ​​are the weighting weights of the two reference pictures in the current block, that is, the weights corresponding to these two predicted values ​​are the same.

[0126] 5. Both referenced pictures in the current block are short-term referenced pictures. Or, neither of the two referenced pictures in the current block are long-term referenced pictures.

[0127] In one possible embodiment, it is shown that if both reference pictures in the current block are short-term reference pictures, the current block is allowed to use motion vector adjustment mode. A short-term reference picture means a reference picture that is close to the current picture and is generally an actual image frame.

[0128] For example, if both referenced pictures in the current block are not short-term referenced pictures, the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 5 is not met. Or, if one referenced picture in the current block is not a short-term referenced picture, the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 5 is not met. Or, if both referenced pictures in the current block are not short-term referenced pictures, the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 5 is not met.

[0129] In another possible embodiment, it is shown that if neither of the two reference pictures in the current block is a long-range reference picture, the current block is allowed to use the motion vector adjustment mode. The display number POC for the long-range reference picture has no actual meaning, and the long-range reference picture means a reference picture that moves away from the current picture, or an image frame that is a composite of several frames of actual images.

[0130] For example, if one of the referenced pictures in the current block is a long-running referenced picture, it is shown that the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 5 is not met. Or, if both of the referenced pictures in the current block are long-running referenced pictures, it is shown that the current block is not allowed to use the motion vector adjustment mode, i.e., activation condition 5 is not met.

[0131] 6. Currently, the width, height, and area of ​​the block are all within the specified limits.

[0132] In one possible embodiment, it is shown that if the width cbWidth of the current block is greater than or equal to a first threshold (e.g., 8), the height cbHeight of the current block is greater than or equal to a second threshold (e.g., 8), and the area (cbHeight * cbWidth) of the current block is greater than or equal to a third threshold (e.g., 128), then the current block is allowed to use the motion vector adjustment mode.

[0133] For example, it is shown that if the current block width cbWidth is less than the first threshold, the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met. Or, if the current block height cbHeight is less than the second threshold, the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met. Or, if the current block area is less than the third threshold, the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met.

[0134] In another possible embodiment, it is shown that if the width cbWidth of the current block is greater than or equal to a first threshold (e.g., 8), the height cbHeight of the current block is greater than or equal to a second threshold (e.g., 8), and the area of ​​the current block (cbHeight * cbWidth) is greater than a fourth threshold (e.g., 64), then the current block is allowed to use the movement vector adjustment mode.

[0135] For example, if the current block width cbWidth is less than the first threshold, it is shown that the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met. Or, if the current block height cbHeight is less than the second threshold, it is shown that the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met. Or, if the current block area is less than or equal to the fourth threshold, it is shown that the current block is not allowed to use the movement vector adjustment mode, i.e., activation condition 6 is not met.

[0136] 7. The size of the two referenced pictures in the current block is the same as the size of the current picture.

[0137] In one possible embodiment, it is shown that if the size of the reference picture in list0 is the same as the size of the current picture, for example, the width of the reference picture in list0 is the same as the width of the current picture, the height of the reference picture in list0 is the same as the height of the current picture, and the size of the reference picture in list1 is the same as the size of the current picture, for example, the width of the reference picture in list1 is the same as the width of the current picture, the height of the reference picture in list1 is the same as the height of the current picture, then the current block is allowed to use the move vector adjustment mode.

[0138] For example, if the size of at least one of the two referenced pictures in the current block is different from the size of the current picture, the current block will not be allowed to use the move vector adjustment mode, i.e., activation condition 7 will not be met. For instance, if the width of the referenced picture in list0 is different from the width of the current picture, the current block will not be allowed to use the move vector adjustment mode. Or, if the height of the referenced picture in list0 is different from the height of the current picture, the current block will not be allowed to use the move vector adjustment mode. Or, if the width of the referenced picture in list1 is different from the width of the current picture, the current block will not be allowed to use the move vector adjustment mode. Or, if the height of the referenced picture in list1 is different from the height of the current picture, the current block will not be allowed to use the move vector adjustment mode.

[0139] Example 5: In the above embodiment, for each subblock of the current block, a first reference block corresponding to the subblock is determined from a first reference picture based on the first original motion vector of the subblock, and the pixel value of each pixel point in the first reference block is called the first pixel value. A second reference block corresponding to the subblock is determined from a second reference picture based on the second original motion vector of the subblock, and the pixel value of each pixel point in the second reference block is called the second pixel value. This will be explained below.

[0140] The first pixel value of each pixel point in the first reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the first reference block, or by copying the pixel values ​​of neighboring pixel points in the first reference block.

[0141] The second pixel value of each pixel point in the second reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the second reference block, or by copying the pixel values ​​of neighboring pixel points in the second reference block.

[0142] The size of the first reference block is the same as the size of the second reference block, the width of the first / second reference block is determined based on the width of the subblock and the search range, and the height of the first / second reference block is determined based on the height of the subblock and the search range.

[0143] For example, for each of the dx*dy subblocks of the current block (for example, a 16*16 subblock, or a smaller subblock, or a larger subblock. A smaller subblock may be 8*8, and a larger subblock may be 32*32, but this is not limited. Illustratively, the size of a subblock may be the same as the size of the current block; that is, a subblock is the current block. For example, if the current block is 8*16, it contains only one subblock of size 8*16. On the other hand, the size of a subblock may be different from the size of the current block. For example, if the current block is 8*32, it can contain two 8*16 subblocks. Of course, the above are just examples, and for the sake of explanation, we will use a 16*16 subblock as an example below), the width of the subblock is dx, the height of the subblock is dy, the first original motion vector is MV0, and the second original motion vector is MV1.

[0144] Based on the corresponding position of the first original motion vector MV0 in the first reference picture, an integer pixel block with area (dx + filtersize - 1) * (dy + filtersize - 1) is obtained, and this integer pixel block can be designated as integer pixel block A.

[0145] Based on the corresponding position of the second original motion vector MV1 in the second reference picture, an integer pixel block with area (dx + filtersize - 1) * (dy + filtersize - 1) is obtained, and this integer pixel block can be designated as integer pixel block B.

[0146] In one possible embodiment, an integer pixel block A with area (dx+filtersize-1)*(dy+filtersize-1) can be used as the base to obtain an initial reference pixel block of size (dx+2*IterNum)*(dy+2*IterNum) by bilinear interpolation, and this initial reference pixel block can be designated as the first reference block. An integer pixel block B with area (dx+filtersize-1)*(dy+filtersize-1) can be used as the base to obtain an initial reference pixel block of size (dx+2*IterNum)*(dy+2*IterNum) by bilinear interpolation, and this initial reference pixel block can be designated as the second reference block.

[0147] In another possible embodiment, an integer pixel block A with area (dx+filtersize-1)*(dy+filtersize-1) is used as the base, and an initial reference pixel block of size (dx+2*IterNum)*(dy+2*IterNum) is obtained by direct copying (no interpolation required), and this initial reference pixel block is designated as the first reference block. An integer pixel block B with area (dx+filtersize-1)*(dy+filtersize-1) is used as the base, and an initial reference pixel block of size (dx+2*IterNum)*(dy+2*IterNum) is obtained by direct copying, and this initial reference pixel block is designated as the second reference block.

[0148] For example, using only the luminance component (to reduce complexity by calculating the cost value using only the luminance component in the subsequent search process), an initial reference pixel block of size (dx + 2 * IterNum) * (dy + 2 * IterNum) is obtained based on integer pixel blocks of area (dx + filtersize - 1) * (dy + filtersize - 1) (e.g., integer pixel block A and integer pixel block B), where the initial reference pixel block is a first reference block (e.g., Pred_Inter0) and a second reference block (e.g., Pred_Inter1).

[0149] For example, `filtersize` could be the number of taps in the interpolation filter, such as 8, but it is not limited to this.

[0150] For example, obtaining the first / second reference block by bilinear interpolation means that the pixel value of each pixel point in the first / second reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the first / second reference block. Obtaining the first / second reference block by copying means that the pixel value of each pixel point in the first / second reference block is obtained by copying the pixel values ​​of neighboring pixel points in the first / second reference block.

[0151] Referring to the above embodiment, the area of ​​the first reference block is (dx + 2 * IterNum) * (dy + 2 * IterNum), and the area of ​​the second reference block is (dx + 2 * IterNum) * (dy + 2 * IterNum). For example, the width value of the first reference block / second reference block is dx + 2 * IterNum, and the height value of the first reference block / second reference block is dy + 2 * IterNum. dx is the width of the subblock, dy is the height of the subblock, IterNum may be the search range SR, such as the number of iterations in a subsequent embodiment, and IterNum may be the maximum horizontal / vertical component interpolation between the target motion vector and the original motion vector. For example, IterNum may be 2.

[0152] As shown in Figure 5, for a 16*16 subblock, an integer pixel block A with an area of ​​23 (i.e., 16+8-1)*23 is obtained based on the corresponding position of the first original motion vector MV0 in the first reference picture. Using the integer pixel block A with an area of ​​23*23 as a base, a first reference block with a size of 20 (i.e., 16+2*2)*20 can be obtained by bilinear interpolation. Similarly, for a 16*16 subblock, an integer pixel block B with an area of ​​23*23 is obtained based on the corresponding position of the second original motion vector MV1 in the second reference picture. Using the integer pixel block B with an area of ​​23*23 as a base, a second reference block with a size of 20*20 is obtained.

[0153] The first and second reference blocks are used to adjust the motion vectors in subsequent processes.

[0154] Example 6: The above embodiment relates to adjusting a first original motion vector for each subblock of the current block based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector for the subblock, and adjusting a second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a second target motion vector for the subblock. The process of adjusting the original motion vector will be described using the processing process of one subblock (for example, each of the subblocks of the current block with size dx*dy) as an example.

[0155] In step a1, the first original motion vector or the second original motion vector is determined as the central motion vector.

[0156] For example, let the first original motion vector be (4,4) and the second original motion vector be (-4,-4), and determine either the first original motion vector (4,4) or the second original motion vector (-4,-4) as the center motion vector.

[0157] For the sake of clarity, we will use the example of determining the first original motion vector (4,4) as the central motion vector, and the process of determining the second original motion vector (-4,-4) as the central motion vector is similar and will not be explained in detail here.

[0158] In step a2, the edge motion vectors corresponding to the central motion vectors are determined.

[0159] For example, by offsetting the central motion vector (x,y) by S in a different direction, we obtain edge motion vectors (x,y+S), edge motion vector (x,yS), edge motion vector (x+S,y), edge motion vector (xS,y), and edge motion vector (x+right,y+down) in different directions. Exemplaryly, right may be S or -S, and down may be S or -S, and the method for determining right and down can be found in subsequent embodiments. As shown in Figure 6, taking the central motion vector (x,y) as the center, that is, the central motion vector is (0,0), S is 1, and both right and down are 1, the edge motion vectors corresponding to the central motion vector (0,0) include edge motion vector (0,1), edge motion vector (0,-1), edge motion vector (1,0), edge motion vector (-1,0), and edge motion vector (1,1).

[0160] In step a3, a first cost value corresponding to the center motion vector and a second cost value corresponding to each edge motion vector are obtained based on the first pixel value of the first reference block and the second pixel value of the second reference block.

[0161] For example, a sub-reference block A1 corresponding to the central motion vector (0,0) is obtained by copying from the first reference block, and sub-reference block A1 is the sub-reference block in the first reference block for the central motion vector (0,0). A sub-reference block B1 corresponding to the central motion vector (0,0) is obtained by copying from the second reference block, and sub-reference block B1 is the sub-reference block in the second reference block for the central motion vector (0,0). Next, a cost value 1 corresponding to the central motion vector (0,0) is obtained using the first pixel value of sub-reference block A1 and the second pixel value of sub-reference block B1, and the method for determining the cost value can be found in subsequent embodiments.

[0162] Subreference block A2 corresponding to the edge motion vector (0,1) is obtained by copying from the first reference block, and subreference block A2 is the subreference block of the first reference block for the edge motion vector (0,1). Subreference block B2 corresponding to the symmetric motion vector (0,-1) of the edge motion vector (0,1) is obtained by copying from the second reference block, and subreference block B2 is the subreference block of the second reference block for the symmetric motion vector (0,-1). Using the first pixel value of subreference block A2 and the second pixel value of subreference block B2, a cost value 2 corresponding to the edge motion vector (0,1) is obtained, and the method for determining the cost value can be found in subsequent embodiments.

[0163] The cost value 2 corresponding to the edge motion vector (0,1) can be determined according to the method for determining the cost value 3 corresponding to the edge motion vector (0,-1), the cost value 4 corresponding to the edge motion vector (1,0), the cost value 5 corresponding to the edge motion vector (-1,0), and the cost value 6 corresponding to the edge motion vector (1,1), but this will not be explained in detail here.

[0164] In step a4, based on the first and second cost values, one motion vector is selected as the optimal motion vector from the center motion vector and the edge motion vector. For example, the motion vector with the smallest cost value can be selected as the optimal motion vector.

[0165] For example, if the cost value 2 corresponding to the edge motion vector (0,1) is the smallest, then the edge motion vector (0,1) corresponding to cost value 2 can be considered the optimal motion vector. Of course, this is just one example and is not limited to this case.

[0166] In step a5, it is determined whether the termination condition is met. If not, the optimal motion vector is determined as the central motion vector, and the process can return to step a2. If it is met, step a6 can be performed.

[0167] In one example, the termination condition is met when the number of iterations / search range reaches a threshold, but not when the number of iterations / search range does not reach the threshold. For example, if SR is 2, i.e., the threshold is 2, and the number of iterations / search range has reached 2, i.e., steps a2 to a4 have been performed 2 times, the termination condition is met. Otherwise, the termination condition is not met.

[0168] In another example, the termination condition can be met by selecting one motion vector as the optimal motion vector from the center motion vector and the edge motion vector, and then selecting the center motion vector as the optimal motion vector.

[0169] In step a6, a first integer pixel motion vector adjustment value (used to adjust the first original motion vector) and a second integer pixel motion vector adjustment value (used to adjust the second original motion vector) are determined based on the optimal motion vector.

[0170] In one example, a first integer pixel motion vector adjustment value is determined based on the optimal motion vector and the first original motion vector, and a second integer pixel motion vector adjustment value is determined based on the first integer pixel motion vector adjustment value. Exemplaryly, the second integer pixel motion vector adjustment value may be symmetrical to the first integer pixel motion vector adjustment value.

[0171] For example, in the first iteration, the optimal motion vector is the edge motion vector (0,1). A second iteration is performed with the edge motion vector (0,1) as the center. In the second iteration, the optimal motion vector is the edge motion vector (0,1). Assuming that the iteration process is completed up to this point, the first integer pixel motion vector adjustment value is (0,2), which is the sum of the edge motion vectors (0,1) and (0,1). Based on this, if the first original motion vector is (4,4), then in the first iteration, the optimal motion vector is the edge motion vector (0,1), which corresponds to the optimal motion vector (4,5). A second iteration is performed with the edge motion vector (0,1) as the center. In the second iteration, the optimal motion vector is the edge motion vector (0,1), which corresponds to the optimal motion vector (4,6). As described above, a first integer pixel motion vector adjustment value is determined based on the optimal motion vector (4,6) and the first original motion vector (4,4). The first integer pixel motion vector adjustment value is the difference between the optimal motion vector (4,6) and the first original motion vector (4,4), i.e., the first integer pixel motion vector adjustment value is (0,2). A second integer pixel motion vector adjustment value is determined based on the first integer pixel motion vector adjustment value (0,2). The second integer pixel motion vector adjustment value may be (0,-2), i.e., a symmetric value of (0,2).

[0172] In step a7, a first fractional pixel motion vector adjustment value (used to adjust the first original motion vector) and a second fractional pixel motion vector adjustment value (used to adjust the second original motion vector) are determined based on the optimal motion vector.

[0173] In one example, a first fractional pixel motion vector adjustment value is determined based on the cost value corresponding to the optimal motion vector and the cost value corresponding to the edge motion vector corresponding to the optimal motion vector. Then, a second fractional pixel motion vector adjustment value is determined based on the first fractional pixel motion vector adjustment value. For example, x0 = N*(E(-1,0)-E(1,0)) / (E(-1,0)+E(1,0)-2*E(0,0)) and y0 = N*(E(0,-1)-E(0,1)) / (E(0,-1)+E(0,1)-2*E(0,0)). For motion vector pixel accuracies of 1 / 2, 1 / 4, 1 / 8, and 1 / 16, N is 1, 2, 4, and 8. Next, the value of (x0,y0) is given to deltaMv, and SPMV = deltaMv / 2N. Currently, with a motion vector pixel accuracy of 1 / 16, SPMV is (x0 / 16, y0 / 16).

[0174] In the above formula, SPMV may be a first fractional pixel motion vector adjustment value, and N may be related to the motion vector pixel precision, for example, the motion vector pixel precision is 1 / 2 and N is 1; the motion vector pixel precision is 1 / 4 and N is 2; the motion vector pixel precision is 1 / 8 and N is 4; the motion vector pixel precision is 1 / 16 and N is 8.

[0175] In the above formula, E(0,0) represents the cost value of the optimal motion vector. E(-1,0) is the cost value of the edge motion vector (-1,0) of the optimal motion vector (0,0) centered around the optimal motion vector. E(1,0) is the cost value of the edge motion vector (1,0) of the optimal motion vector (0,0) centered around the optimal motion vector. E(0,-1) is the cost value of the edge motion vector (0,-1) of the optimal motion vector (0,0) centered around the optimal motion vector. E(0,1) is the cost value of the edge motion vector (0,1) of the optimal motion vector (0,0) centered around the optimal motion vector. The method for determining the cost value of each motion vector is explained in detail here, but please refer to the example above.

[0176] After determining the first decimal pixel motion vector adjustment value using the above method, a second decimal pixel motion vector adjustment value, which is the symmetric value of the first decimal pixel motion vector adjustment value, can be determined based on the first decimal pixel motion vector adjustment value. For example, if the first decimal pixel motion vector adjustment value is (1,0), the second decimal pixel motion vector adjustment value may be (-1,0), that is, the symmetric value of the first decimal pixel motion vector adjustment value (1,0).

[0177] In step a8, the first original motion vector is adjusted based on the first integer pixel motion vector adjustment value and / or the first decimal pixel motion vector adjustment value to obtain the first target motion vector. For example, the first target motion vector = first original motion vector + first integer pixel motion vector adjustment value + first decimal pixel motion vector adjustment value.

[0178] In step a9, the second original motion vector is adjusted based on the second integer pixel motion vector adjustment value and / or the second decimal pixel motion vector adjustment value to obtain the second target motion vector. For example, the second target motion vector = second original motion vector + second integer pixel motion vector adjustment value + second decimal pixel motion vector adjustment value.

[0179] Example 7: The above example relates to adjusting a first original motion vector for each subblock of the current block based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector for the subblock, and adjusting a second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a second target motion vector for the subblock. The process of adjusting the original motion vector will be described using the processing process of one subblock (for example, each of the subblocks of the current block with size dx*dy) as an example.

[0180] In this embodiment, the first original motion vector is defined as Org_MV0, and the second original motion vector as Org_MV1. After adjusting the first original motion vector Org_MV0, the resulting first target motion vector is defined as Refined_MV0. After adjusting the second original motion vector Org_MV1, the resulting second target motion vector is defined as Refined_MV1.

[0181] In step b1, SR iterations are performed to obtain the integer pixel offset of the optimal integer pixel MV point, which is set as IntegerDeltaMV, and IntegerDeltaMV is the first integer pixel motion vector adjustment value in the above embodiment. For example, first, IntegerDeltaMV is initialized to (0,0), and in each iteration, the following process is performed.

[0182] In step b11, deltaMV is set to (0,0). In the first iteration, based on the reference pixels in the first reference block of the first original motion vector, a predicted value block A1 (i.e., the dx*dy block at the very center of the first reference block) is copied, and based on the reference pixels in the second reference block of the second original motion vector, a predicted value block B1 (i.e., the dx*dy block at the very center of the second reference block) is copied. Based on predicted value blocks A1 and B1, an initial cost value cost is obtained (the initial cost value is the SAD (sum of abstract distortion) based on predicted value blocks A1 and B1, and the determination method is described in subsequent examples). If the initial cost value cost is less than dx*dy (where dx and dy are the width and height of the current subblock), the subsequent search process is skipped directly, step b2 is performed, and notZeroCost is set to false.

[0183] In step b12, for example as shown in Figure 6, five offset MVs (all five of which are called MVOffsets) are obtained in the order {Mv(0,1), Mv(0,-1), Mv(1,0), Mv(-1,0), Mv(right, down)} centered on the initial point, and the cost values ​​of these five offset MVs are calculated and compared. For example, based on a certain MVOffset (e.g., Mv(0,1)), the first and second reference blocks obtain two predicted value blocks (e.g., a dx*dy block with a center position offset MVOffset applied in the first reference block, and a dx*dy block with a center position offset -MVOffset (the inverse of MVOffset) applied in the second reference block) using this MVOffset, and the downsampled SAD of the two predicted value blocks is calculated as the cost value of the MVOffset.

[0184] Next, we retain the MVOffset with the smallest cost value, update it to the value of deltaMV, and make the MVOffset with the smallest cost value the new center offset point for the next iteration.

[0185] The value of IntegerDeltaMV is updated based on deltaMV, so that the updated IntegerDeltaMV = the original IntegerDeltaMV + deltaMV, which means that deltaMV is added to the current IntegerDeltaMV.

[0186] In step b13, if, after iteration, the optimal MV remains the initial MV (i.e., not MVOffset) or the minimum cost value is 0, the next iterative search process is skipped, step b2 is performed, and notZeroCost is set to false.

[0187] Otherwise, when the number of iterations reaches the SR, step b2 is performed; if the number of iterations does not reach the SR, the next iterative search process is performed, centering on the optimal MV, i.e., returning to step b11.

[0188] After the iterative search process is complete, the value of IntegerDeltaMV, that is, the final value of IntegerDeltaMV which is the first integer pixel motion vector adjustment value, is obtained and then set as IntegerDeltaMV.

[0189] In step b2, the optimal decimal pixel offset MV is obtained centered on the optimal integer pixel MV point from step b1, and this is defined as SPMV. SPMV is the first decimal pixel motion vector adjustment value in the above embodiment.

[0190] For example, first initialize SPMV to (0,0), then perform the following process.

[0191] In step b21, subsequent processing can only be performed (i.e., SPMV must be obtained) if notZeroCost is not false and deltaMV is (0,0). Otherwise, the original motion vector is adjusted directly using IntegerDeltaMV, rather than adjusting the original motion vector using IntegerDeltaMV and SPMV.

[0192] In step b22, E(x,y) is expressed as the cost value (the cost value calculated in step b1) corresponding to the MV obtained by offsetting the optimal MV point obtained in step b1 by (x,y). Based on the E(x,y) of the center and the five points above, below, left, and right, we can obtain the offset (x0,y0) of the point with the smallest E(x,y): x0 = N*(E(-1,0)-E(1,0)) / (E(-1,0)+E(1,0)-2*E(0,0)), y0 = N*(E(0,-1)-E(0,1)) / (E(0,-1)+E(0,1)-2*E(0,0)). For example, for motion vector pixel accuracies of 1 / 2, 1 / 4, 1 / 8, and 1 / 16, N is 1, 2, 4, and 8. Next, we give the values ​​of (x0, y0) to deltaMv, and SPMV = deltaMv / 2N. Currently, for a motion vector pixel accuracy of 1 / 16, SPMV may also be (x0 / 16, y0 / 16).

[0193] If E(-1,0)=E(0,0), then offset horizontally to the left by half a pixel (deltaMv[0]=-N).

[0194] If E(1,0)=E(0,0), then offset horizontally to the right by half the pixels (deltaMv[0]=N).

[0195] If E(0,-1)=E(0,0), then offset vertically upwards by half the number of pixels (deltaMv[1]=-N).

[0196] If E(0,1)=E(0,0), then offset vertically downwards by half the number of pixels (deltaMv[1]=N).

[0197] Through the above process, the SPMV value, i.e., the first fractional pixel motion vector adjustment value, can be obtained.

[0198] In step b3, the optimal offset MV is obtained based on the integer pixel offset IntegerDeltaMV from step b1 and the fractional pixel offset SPMV from step b2, and this optimal offset MV can be defined as BestMVoffset. Also, BestMVoffset = IntegerDeltaMV + SPMV. Based on BestMVoffset, target motion vectors in two directions can be obtained: Refined_MV0 = Org_MV0 + BestMVoffset; Refined_MV1 = Org_MV1 - BestMVoffset.

[0199] Clearly, BestMVoffset = IntegerDeltaMV + SPMV, that is, the sum of the first integer pixel motion vector adjustment value and the first decimal pixel motion vector adjustment value. Also, -IntegerDeltaMV is the symmetric value of IntegerDeltaMV, i.e., the second integer pixel motion vector adjustment value, and -SPMV is the symmetric value of SPMV, i.e., the second decimal pixel motion vector adjustment value. Therefore, -BestMVoffset = (-IntegerDeltaMV) + (-SPMV), that is, the sum of the second integer pixel motion vector adjustment value and the second decimal pixel motion vector adjustment value.

[0200] Example 8: In this example, the implementation is the same as in Example 7, but the differences are as follows: Step b11, "If the initial cost value cost is less than dx*dy, skip the subsequent search process directly," is removed. In other words, even if the initial cost value cost is less than dx*dy, the subsequent search process is to continue without "skipping the subsequent search process directly," i.e., step b12 is to be performed.

[0201] Example 9: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Example 7, but the differences are as follows: The statement in step b11, "If the initial cost value cost is less than dx*dy, skip the subsequent search process directly," is removed. In other words, even if the initial cost value cost is less than dx*dy, the subsequent search process should continue without "skipping the subsequent search process directly," i.e., step b12 should be performed. The statement in step b13, "If the optimal MV is still the initial MV (i.e., not MVOffset) or the minimum cost value is 0, do not perform the next iterative search process," is removed. In other words, even if the optimal MV is still the initial MV or the minimum cost value is 0, the next iterative search process should be performed.

[0202] Example 10: In this example, the implementation is the same as in Example 7 for adjusting the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, but the differences are as follows: The related process for "notZeroCost" is removed, that is, the value of notZeroCost is not set and stored in steps b11 and b13. In step b21, the fractional pixel offset calculation process is not performed only when notZeroCost is not false and deltaMV is (0,0), but as long as deltaMV is (0,0), the fractional pixel offset calculation process (i.e., step b22) can be performed.

[0203] Example 11: In this example, the implementation is the same as in Example 7, but the differences are as follows: Step b21, "Perform subsequent processing only if notZeroCost is not false and deltaMV is (0,0); otherwise, adjust the original motion vector directly using IntegerDeltaMV" is changed to "Perform subsequent processing only if notZeroCost is not false and the cost values ​​of the four points separated by one integer pixel above, below, left, and right of the current optimal integer pixel are calculated and obtained in step b1; otherwise, adjust the original motion vector directly using IntegerDeltaMV". In this example, "subsequent processing" refers to the decimal pixel offset calculation process in step b22.

[0204] For example, in the decimal pixel offset calculation process in step b22, it is necessary to use the cost values ​​of four points separated by one integer pixel above, below, to the left, and to the right of the optimal integer pixel. Therefore, calculating and obtaining the "cost values ​​of four points separated by one integer pixel above, below, to the left, and to the right of the optimal integer pixel" in step b1 may be a necessary condition.

[0205] Example 12: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Example 7, but the differences are as follows: In step b21, "Perform subsequent processing only if notZeroCost is not false and deltaMV is (0,0); otherwise, adjust the original motion vector directly using IntegerDeltaMV" is changed to "Perform subsequent processing (i.e., the decimal pixel offset calculation process) only if the cost values ​​of four points separated by one integer pixel above, below, left, and right of the current optimal integer pixel are calculated and obtained in step b1; otherwise, adjust the original motion vector using IntegerDeltaMV."

[0206] Example 13: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Example 7, but the differences are as follows: In step b21, "Perform subsequent processing only if notZeroCost is not false and deltaMV is (0,0); otherwise, adjust the original motion vector directly using IntegerDeltaMV" is changed to "If the cost values ​​of four points separated by one integer pixel above, below, left, and right of the current optimal integer pixel are calculated and obtained in step b1, perform subsequent processing (the decimal pixel offset calculation process in step b22); otherwise, process using step b23."

[0207] In step b23, the current optimal integer pixel point MV_inter_org is defined as the integer pixel point MV_inter_nearest, which is obtained by calculating the cost values ​​of the four points closest to it, separated by one integer pixel on all sides (up, down, left, and right), in step b1. Next, the fractional pixel offset calculation process in step b22 is performed with MV_inter_nearest as the center, that is, the SPMV is obtained with MV_inter_nearest as the center. For example, if the cost values ​​of the four points separated by one integer pixel on all sides (up, down, left, and right) from the current optimal integer pixel point MV_inter_org were not all calculated and obtained in step b1, then one integer pixel point MV_inter_nearest is selected from around the optimal integer pixel point MV_inter_org, and the cost values ​​of the four points separated by one integer pixel on all sides (up, down, left, and right) from the integer pixel point MV_inter_nearest are all obtained by calculating and obtaining in step b1.

[0208] Next, the integer pixel point MV_inter_nearest is set as the current optimal integer pixel point, and SPMV is obtained centered on the integer pixel point MV_inter_nearest. For the specific acquisition method, refer to step b22. When obtaining SPMV centered on the integer pixel point MV_inter_nearest, refer to step b22, and when calculating x0 and y0, x0 and y0 can be restricted to the range [-2N, 2N]. If x0 / y0 is greater than 2N, give x0 / y0 a value of 2N. If x0 / y0 is less than -2N, give x0 / y0 a value of -2N. For motion vector pixel precision of 1 / 2, 1 / 4, 1 / 8, and 1 / 16, N is 1, 2, 4, and 8.

[0209] Example 14: In the above example, it is necessary to determine the edge motion vectors corresponding to the central motion vectors. For example, the central motion vector (x,y) is offset by S in a different direction to obtain edge motion vectors (x,y+S), (x,yS), (x+S,y), (xS,y), and (x+right,y+down) in different directions in order. Alternatively, the central motion vector (x,y) is offset by S in a different direction to obtain edge motion vectors (x,yS), (x,y+S), (xS,y), (x+S,y), and (x+right,y+down) in different directions in order. For example, if (x,y) is (0,0) and S is 1, five edge motion vectors are obtained in the order of (0,1), (0,-1), (1,0), (-1,0), and (right,down). Alternatively, obtain five edge motion vectors in the order of (0,-1), (0,1), (-1,0), (1,0), and (right,down).

[0210] Example 15: In the above example, the default value of the edge motion vector (x+right, y+down) is (xS, yS). If the cost value of the edge motion vector (x+S, y) is less than the cost value of the edge motion vector (xS, y), then right is S (changed from -S to S). If the cost value of the edge motion vector (x, y+S) is less than the cost value of the edge motion vector (x, yS), then down is S (changed from -S to S). Alternatively, if the cost value of the edge motion vector (x+S, y) is less than or equal to the cost value of the edge motion vector (xS, y), then right is S (changed from -S to S). If the cost value of the edge motion vector (x, y+S) is less than or equal to the cost value of the edge motion vector (x, yS), then down is S (changed from -S to S).

[0211] Five edge motion vectors are obtained in the order (0,1), (0,-1), (1,0), (-1,0), and (right,down), with the default value of (right,down) being (-1,-1). If the cost value of edge motion vector (1,0) is less than the cost value of edge motion vector (-1,0), then right is 1. If the cost value of edge motion vector (0,1) is less than the cost value of edge motion vector (0,-1), then down is 1. Alternatively, if the cost value of edge motion vector (1,0) is less than or equal to the cost value of edge motion vector (-1,0), then right is 1. If the cost value of edge motion vector (0,1) is less than or equal to the cost value of edge motion vector (0,-1), then down is 1. For example, five edge motion vectors are obtained in the order (0,-1), (0,1), (-1,0), (1,0), and (right,down), and the default value of (right,down) is (-1,-1). If the cost value of edge motion vector (1,0) is less than the cost value of edge motion vector (-1,0), then right is 1. If the cost value of edge motion vector (0,1) is less than the cost value of edge motion vector (0,-1), then down is 1. Alternatively, if the cost value of edge motion vector (1,0) is less than or equal to the cost value of edge motion vector (-1,0), then right is 1. If the cost value of edge motion vector (0,1) is less than or equal to the cost value of edge motion vector (0,-1), then down is 1.

[0212] Example 16: The above embodiment relates to adjusting a first original motion vector for each subblock of the current block based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector for the subblock, and adjusting a second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a second target motion vector for the subblock. The process of adjusting the original motion vector will be described using the processing process of one subblock (for example, each of the subblocks of the current block with size dx*dy) as an example.

[0213] In step c1, some or all motion vectors are selected from the motion vectors that include the initial motion vector, with the initial motion vector as the center, and these selected motion vectors are designated as candidate motion vectors. For example, the initial motion vector may be the first original motion vector or the second original motion vector. For instance, some or all motion vectors are selected as candidate motion vectors from the motion vectors that include the first original motion vector, with the first original motion vector as the center. This selection method may be explained in subsequent embodiments. Alternatively, some or all motion vectors may be selected as candidate motion vectors from the motion vectors that include the second original motion vector, with the second original motion vector as the center. This selection method will be explained in subsequent embodiments. For the sake of clarity, in subsequent embodiments, the first original motion vector is assumed to be the center, i.e., the initial motion vector is the first original motion vector.

[0214] For example, an initial motion vector is used as the center, and some or all motion vectors are selected from (2*SR+1)*(2*SR+1) motion vectors that include the initial motion vector, and the selected motion vectors are determined as candidate motion vectors, where SR is the search range. When selecting some or all motion vectors from (2*SR+1)*(2*SR+1) motion vectors that include the initial motion vector, and determining the selected motion vectors as candidate motion vectors, the search order of the motion vectors can include left-to-right or top-to-bottom.

[0215] If SR is 2, all motion vectors are selected from the 25 motion vectors around the initial motion vector, including the initial motion vector, and these selected motion vectors are determined as candidate motion vectors. The order of motion vector search is {Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1), Mv(-2,0), Mv(-1,0), Mv(0,0), Mv(1,0), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-2,2), Mv(-1,2), Mv(0,2), Mv(1,2), Mv(2,2)}. or {Mv(0,0),Mv(-2,-2),Mv(-1,-2),Mv(0,-2),Mv(1,-2),Mv(2,-2 ),Mv(-2,-1),Mv(-1,-1),Mv(0,-1),Mv(1,-1),Mv(2,-1),Mv(-2,0),Mv (-1,0),Mv(0,0),Mv(1,0),Mv(2,0),Mv(-2,1),Mv(-1,1),Mv(0,1),Mv (1,1),Mv(2,1),Mv(-2,2),Mv(-1,2),Mv(0,2),Mv(1,2),Mv(2,2)}.

[0216] If SR is 2, some motion vectors are selected from the 21 motion vectors around the initial motion vector, including the initial motion vector, and these selected motion vectors are determined as candidate motion vectors. The order of motion vector search is {Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1), Mv(-2,0), Mv(-1,0), Mv(0,0), Mv(1,0), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-1,2), Mv(0,2), Mv(1,2)}. or {Mv(0,0),Mv(-1,-2),Mv(0,-2),Mv(1,-2),Mv(-2,-1),Mv(-1,-1),Mv(0,-1),Mv(1,-1),Mv(2,-1),Mv(-2,0),Mv( -1,0),Mv(0,0),Mv(1,0),Mv(2,0),Mv(-2,1),Mv(-1,1),Mv(0,1),Mv(1,1),Mv(2,1),Mv(-1,2),Mv(0,2),Mv(1,2)}.

[0217] In step c2, based on the first pixel value of the first reference block and the second pixel value of the second reference block, a third cost value corresponding to the first original motion vector (i.e., the initial motion vector) and a fourth cost value corresponding to each candidate motion vector are obtained.

[0218] For example, a sub-reference block A1 corresponding to the first original motion vector can be obtained by copying from the first reference block, and this sub-reference block A1 may be a sub-reference block in the first reference block of the first original motion vector. Next, a sub-reference block B1 corresponding to the second original motion vector can be obtained by copying from the second reference block, and this sub-reference block B1 is a sub-reference block in the second reference block of the second original motion vector. Next, a third cost value corresponding to the first original motion vector can be obtained using the first pixel value of sub-reference block A1 and the second pixel value of sub-reference block B1. For each candidate motion vector, a sub-reference block A2 corresponding to the candidate motion vector can be obtained by copying from the first reference block, and this sub-reference block A2 is a sub-reference block in the first reference block of the candidate motion vector. Next, a sub-reference block B2 corresponding to the symmetric motion vector of the candidate motion vector can be obtained by copying from the second reference block, and this sub-reference block B2 is a sub-reference block in the second reference block of the symmetric motion vector. Using the first pixel value of subreference block A2 and the second pixel value of subreference block B2, a fourth cost value corresponding to the candidate motion vector is obtained.

[0219] In step c3, based on the third and fourth cost values, one motion vector is selected from the first original motion vector and each candidate motion vector, and the selected motion vector is determined to be the optimal motion vector. For example, the motion vector with the smallest cost value (e.g., the first original motion vector, or any of the candidate motion vectors) can be determined to be the optimal motion vector.

[0220] In step c4, a first integer pixel motion vector adjustment value (used to adjust the first original motion vector) and a second integer pixel motion vector adjustment value (used to adjust the second original motion vector) are determined based on the optimal motion vector. For example, the first integer pixel motion vector adjustment value is determined based on the optimal motion vector and the first original motion vector, and the second integer pixel motion vector adjustment value is determined based on the first integer pixel motion vector adjustment value, and the second integer pixel motion vector adjustment value and the first integer pixel motion vector adjustment value are symmetrical.

[0221] For example, if the optimal motion vector is (4,6) and the first original motion vector is (4,4), then the first integer pixel motion vector adjustment value is determined based on the optimal motion vector (4,6) and the first original motion vector (4,4). The first integer pixel motion vector adjustment value is the difference between the optimal motion vector (4,6) and the first original motion vector (4,4), i.e., the first integer pixel motion vector adjustment value is (0,2). Next, the second integer pixel motion vector adjustment value is determined based on the first integer pixel motion vector adjustment value (0,2). The second integer pixel motion vector adjustment value may be (0,-2), i.e., a symmetric value of (0,2).

[0222] In step c5, a first fractional pixel motion vector adjustment value (used to adjust the first original motion vector) and a second fractional pixel motion vector adjustment value (used to adjust the second original motion vector) are determined based on the optimal motion vector. For example, the first fractional pixel motion vector adjustment value is determined based on the cost value corresponding to the optimal motion vector and the cost value corresponding to the edge motion vector corresponding to the optimal motion vector, and then the second fractional pixel motion vector adjustment value is determined based on the first fractional pixel motion vector adjustment value.

[0223] For example, x0 = N*(E(-1,0)-E(1,0)) / (E(-1,0)+E(1,0)-2*E(0,0)) and y0 = N*(E(0,-1)-E(0,1)) / (E(0,-1)+E(0,1)-2*E(0,0)). For motion vector pixel precision of 1 / 2, 1 / 4, 1 / 8, and 1 / 16, N is 1, 2, 4, and 8. Next, the value of (x0,y0) is given to deltaMv, and SPMV = deltaMv / 2N. Currently, for motion vector pixel precision of 1 / 16, SPMV is (x0 / 16,y0 / 16). SPMV is the first fractional pixel motion vector adjustment value. E(0,0) represents the cost value of the optimal motion vector, E(-1,0) is the cost value of the edge motion vector (-1,0) of the optimal motion vector (0,0) centered on the optimal motion vector, E(1,0) is the cost value of the edge motion vector (1,0) of the optimal motion vector (0,0) centered on the optimal motion vector, E(0,-1) is the cost value of the edge motion vector (0,-1) of the optimal motion vector (0,0) centered on the optimal motion vector, and E(0,1) is the cost value of the edge motion vector (0,1) of the optimal motion vector (0,0) centered on the optimal motion vector. For the method of determining the cost value of each motion vector, refer to the above embodiment. After determining the first decimal pixel motion vector adjustment value using the above method, a second decimal pixel motion vector adjustment value, which is the symmetrical value of the first decimal pixel motion vector adjustment value, can be determined based on the first decimal pixel motion vector adjustment value. For example, if the first decimal pixel motion vector adjustment value is (1,0), then the second decimal pixel motion vector adjustment value is (-1,0), which is the symmetric value of (1,0).

[0224] In step c6, the first original motion vector is adjusted based on the first integer pixel motion vector adjustment value and / or the first decimal pixel motion vector adjustment value to obtain the first target motion vector corresponding to the first original motion vector. For example, the first target motion vector = first original motion vector + first integer pixel motion vector adjustment value + first decimal pixel motion vector adjustment value.

[0225] In step c7, the second original motion vector is adjusted based on the second integer pixel motion vector adjustment value and / or the second decimal pixel motion vector adjustment value to obtain a second target motion vector corresponding to the second original motion vector. For example, the second target motion vector = second original motion vector + second integer pixel motion vector adjustment value + second decimal pixel motion vector adjustment value.

[0226] Example 17: The above embodiment relates to adjusting a first original motion vector for each subblock of the current block based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector for the subblock, and adjusting a second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a second target motion vector for the subblock. The process of adjusting the original motion vector will be described using the processing process of one subblock (for example, each of the subblocks of the current block with size dx*dy) as an example.

[0227] The first original motion vector can be designated as Org_MV0, the second original motion vector as Org_MV1, the first target motion vector as Refined_MV0, and the second target motion vector as Refined_MV1.

[0228] In step d1, some or all motion vectors are selected from (2*SR+1)*(2*SR+1) points around the first original motion vector, including the first original motion vector. For example, if SR=2, some or all motion vectors are selected from 25 points around the first original motion vector that include the first original motion vector, and these selected motion vectors are designated as candidate motion vectors. The cost value of the first original motion vector is determined, and the cost value of each candidate motion vector is determined. The motion vector with the smallest cost value is designated as the optimal motion vector. Compared to step b1 of the above embodiment, in step d1, there is no need to perform an iterative process; that is, all candidate motion vectors to be processed can be selected in just one step without performing an iterative process of selecting some motion vectors in the first iteration and selecting the remaining motion vectors in the second iteration. As a result, all candidate motion vectors to be processed can be selected in just one step, and therefore these candidate motion vectors can be processed in parallel to obtain the cost value of each candidate motion vector, thereby reducing computational complexity and improving coding performance.

[0229] In step d2, the value of IntegerDeltaMV is determined based on the optimal motion vector. The final value of IntegerDeltaMV is the first integer pixel motion vector adjustment value. This determination method is not described in detail here, but you can refer to the above embodiment.

[0230] In step d3, the optimal fractional pixel offset MV is obtained with the optimal motion vector as the center, and this optimal fractional pixel offset is defined as SPMV. The value of SPMV is the first fractional pixel motion vector adjustment value.

[0231] The process for realizing step d3 can be found in step b2 above and will not be explained in detail here.

[0232] In step d4, BestMVoffset is obtained based on IntegerDeltaMV and SPMV. For example, BestMVoffset = IntegerDeltaMV + SPMV. Next, based on BestMVoffset, the target motion vectors Refined_MV0 = Org_MV0 + BestMVoffset and Refined_MV1 = Org_MV1 - BestMVoffset can be obtained.

[0233] Example 18: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Examples 16 and 17. In this example, all motion vectors can be selected from a total of (2*SR+1)*(2*SR+1) points around the original motion vector that include the original motion vector. For example, if SR=2, all motion vectors are selected from 25 points around the original motion vector that include the original motion vector, and the cost values ​​of these motion vectors are determined, and the cost value of each motion vector is determined. The motion vector with the smallest cost value is considered the optimal motion vector.

[0234] Example 19: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 to the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Examples 16 and 17. In this example, all candidate motion vectors to be processed are selected only once, and therefore these candidate motion vectors can be processed in parallel to obtain the cost value of each candidate motion vector, thereby reducing computational complexity and improving coding performance. In this example, a subset of motion vectors whose offset does not exceed the SR range is selected from a total of (2*SR+1)*(2*SR+1) points around the original motion vector that include the original motion vector, with the original motion vector as the center.

[0235] For example, from (2*SR+1)*(2*SR+1) points containing the original motion vector, N candidate points (where N is greater than or equal to 1 and less than or equal to (2*SR+1)*(2*SR+1)) are selected. Next, the cost values ​​of the motion vectors corresponding to these N points are determined. Exemplarily, the cost values ​​of these N points can be scanned in a fixed order, and the motion vector with the smallest cost value can be selected as the optimal motion vector. If the cost values ​​are the same, the candidate point earlier in the order is given priority. Exemplarily, the cost value can be determined based on the downsampling SAD of two predicted values ​​obtained from the candidate motion vectors.

[0236] For example, if SR=2, there may be 25 candidate points, and these candidate points can be ordered from left to right or from top to bottom. As shown in Figure 7A, the order of these candidate points may be {Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1), Mv(-2,0), Mv(-1,0), Mv(0,0), Mv(1,0), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-2,2), Mv(-1,2), Mv(0,2), Mv(1,2), Mv(2,2)}. Alternatively, as shown in Figure 7B, the order of these candidate points may be {Mv(0,0),Mv(-2,-2),Mv(-1,-2),Mv(0,-2),Mv(1,-2),Mv(2,-2),Mv(-2,-1),Mv(-1,-1),Mv(0,-1),Mv(1,-1),Mv(2,-1),Mv(-2,0),Mv(-1,0),Mv(0,0),Mv(1,0),Mv(2,0),Mv(-2,1),Mv(-1,1),Mv(0,1),Mv(1,1),Mv(2,1),Mv(-2,2),Mv(-1,2),Mv(0,2),Mv(1,2),Mv(2,2)}.

[0237] The cost values ​​corresponding to the motion vectors of these 25 points are determined, scanned in the order described above, and the motion vector with the smallest cost value is obtained as the optimal offset MV. Using the optimal offset MV, integer pixel motion vector adjustment values ​​and decimal pixel motion vector adjustment values ​​can be determined. The determination method is described in the above embodiment and will not be explained in detail here.

[0238] In another example, if SR=2, there may be 21 candidate points, and these candidate points can be ordered from left to right or from top to bottom. As shown in Figure 7C, the order of these candidate points may be {Mv(-1,-2),Mv(0,-2),Mv(1,-2),Mv(-2,-1),Mv(-1,-1),Mv(0,-1),Mv(1,-1),Mv(2,-1),Mv(-2,0),Mv(-1,0),Mv(0,0),Mv(1,0),Mv(2,0),Mv(-2,1),Mv(-1,1),Mv(0,1),Mv(1,1),Mv(2,1),Mv(-1,2),Mv(0,2),Mv(1,2)}. Alternatively, as shown in Figure 7D, the order of these candidate points may be {Mv(0,0),Mv(-1,-2),Mv(0,-2),Mv(1,-2),Mv(-2,-1),Mv(-1,-1),Mv(0,-1),Mv(1,-1),Mv(2,-1),Mv(-2,0),Mv(-1,0),Mv(0,0),Mv(1,0),Mv(2,0),Mv(-2,1),Mv(-1,1),Mv(0,1),Mv(1,1),Mv(2,1),Mv(-1,2),Mv(0,2),Mv(1,2)}.

[0239] The cost values ​​corresponding to the motion vectors of these 21 points are determined, scanned in the order described above, and the motion vector with the smallest cost value is obtained as the optimal offset MV. Using the optimal offset MV, integer pixel motion vector adjustment values ​​and decimal pixel motion vector adjustment values ​​can be determined. The determination method is described in the above embodiment and will not be explained in detail here.

[0240] In another example, if SR=2, there may be 25 candidate points, and these candidate points are ordered from closest to the center, with the motion vector (0,0) as the center. As shown in Figure 7E, the order of these candidate points may be {Mv(0,0),Mv(-1,0),Mv(0,-1),Mv(1,0),Mv(0,1),Mv(-1,1),Mv(-1,-1),Mv(1,-1),Mv(1,1),Mv(0,2),Mv(-2,0),Mv(0,-2),Mv(2,0),Mv(1,2),Mv(-1,2),Mv(-2,1),Mv(-2,-1),Mv(-1,-2),Mv(1,-2),Mv(2,-1),Mv(2,1),Mv(-2,2),Mv(-2,-2),Mv(2,-2),Mv(2,2)}. The cost values ​​corresponding to the motion vectors of these 25 points are determined, scanned in the order described above, and the motion vector with the smallest cost value is obtained as the optimal offset MV. Using the optimal offset MV, integer pixel motion vector adjustment values ​​and decimal pixel motion vector adjustment values ​​can be determined. The determination method is described in detail in the above embodiment and will not be explained here.

[0241] In another example, if SR=2, there may be 21 candidate points, and the order of these candidate points is based on the motion vector (0,0), with the order of points closest to the center being used. As shown in Figure 7F, the order of these candidate points is {Mv(0,0),Mv(-1,0),Mv(0,-1),Mv(1,0),Mv(0,1),Mv(-1,1),Mv(-1,-1),Mv(1,-1),Mv(1,1),Mv(0,2),Mv(-2,0),Mv(0,-2),Mv(2,0),Mv(1,2),Mv(-1,2),Mv(-2,1),Mv(-2,-1),Mv(-1,-2),Mv(1,-2),Mv(2,-1),Mv(2,1)}. The cost values ​​corresponding to the motion vectors of these 21 points are determined, scanned in the order described above, and the motion vector with the smallest cost value is obtained as the optimal offset MV. The integer pixel motion vector adjustment value and the decimal pixel motion vector adjustment value are then determined using the optimal offset MV. For the determination method, please refer to the embodiment described above.

[0242] In another example, when SR=2, there may be 13 candidate points, and the order of these candidate points is based on the motion vector (0,0), using the order of points closest to the center. As shown in Figure 7G, the order of these candidate points is {Mv(0,0),Mv(-1,0),Mv(0,-1),Mv(1,0),Mv(0,1),Mv(-1,1),Mv(-1,-1),Mv(1,-1),Mv(1,1),Mv(0,2),Mv(-2,0),Mv(0,-2),Mv(2,0)}. The cost values ​​corresponding to the motion vectors of these 13 points are determined, scanned in the above order, and the motion vector with the smallest cost value is obtained as the optimal offset MV. The integer pixel motion vector adjustment value and the decimal pixel motion vector adjustment value can then be determined using the optimal offset MV. For the determination method, please refer to the above example.

[0243] In the above embodiment, if the first candidate motion vector is Mv(0,0), the cost SAD(0,0) of the first candidate motion vector Mv(0,0) is processed as SAD(0,0) = SAD(0,0) - SAD(0,0) / 4, meaning it is forcibly reduced by 1 / 4, and the above processing is not performed on the costs SAD of the other candidate motion vectors.

[0244] In one possible embodiment, the following early termination methods exist in the candidate motion vector inspection process.

[0245] If the cost SAD(0,0) of the first candidate motion vector (Mv(0,0)) is less than the threshold dx*dy, then no further checks are performed on subsequent candidate motion vectors, meaning that the optimal integer pixel offset of the subblock is Mv(0,0).

[0246] If a candidate motion vector has a cost of 0, the system will not check subsequent candidate motion vectors and will use the current candidate motion vector as the optimal integer pixel offset.

[0247] In the candidate motion vector inspection process described above, if any of the above conditions for early termination occur, the subsequent calculation process for fractional pixel offsets is not performed; that is, the target motion vector of the subblock is obtained directly using integer pixel offsets.

[0248] Example 20: To adjust the first original motion vector Org_MV0 and the second original motion vector Org_MV1 into the first target motion vector Refined_MV0 and the second target motion vector Refined_MV1, the implementation is the same as in Examples 16 and 17. In this example, all candidate motion vectors to be processed are selected only once, and therefore these candidate motion vectors are processed in parallel to obtain the cost value of each candidate motion vector, thereby reducing computational complexity and improving coding performance. In this example, the original motion vector is the center, and some motion vectors whose offset does not exceed the SR range are selected from (2*SR+1)*(2*SR+1) points. For example, from (2*SR+1)*(2*SR+1) points including the original motion vector, N candidate points (where N is greater than or equal to 1 and less than or equal to (2*SR+1)*(2*SR+1)) are selected. The cost values ​​of the motion vectors corresponding to these N points are determined. The cost values ​​of these N points are scanned in a fixed order, and the motion vector with the smallest cost value is selected as the optimal motion vector. If the cost values ​​are the same, the candidate point earlier in the sequence is given priority.

[0249] Unlike Example 19, the positions of the candidate points in Example 19 are all fixed; that is, the positions of the candidate points in Example 20 are related to the original motion vector, regardless of the original motion vector. Several specific examples are explained below.

[0250] In one example, when SR=2, there may be 13 candidate points, and the order of these candidate points is based on the motion vector (0,0), using the order of points closest to the center. The order of candidate points in the first layer from the center is independent of the magnitude of the original motion vector, but the order of candidate points in the second layer from the center is related to the magnitude of the original motion vector. The order of these candidate points is {Mv(0,0),Mv(-1,0),Mv(0,-1),Mv(1,0),Mv(0,1),Mv(-1,1),Mv(-1,-1),Mv(1,1),Mv(sign_H*2,0),Mv(sign_H*2,sign_V*1),Mv(0,sign_V*2),Mv(0,sign_V*2)}. The first original motion vector is MV0, the horizontal component is MV0_Hor, and the vertical component is MV0_Ver. If MV0_Hor is greater than or equal to 0, then sign_H=1. Otherwise, sign_H=-1. If MV0_Ver is greater than or equal to 0, then sign_V=1. Otherwise, sign_V=-1. The cost values ​​corresponding to the motion vectors of these 13 points are determined, and the scan is performed in the above order. The motion vector with the smallest cost value is obtained as the optimal offset MV, and the integer pixel motion vector adjustment value and the decimal pixel motion vector adjustment value can be determined using the optimal offset MV. For the determination method, please refer to the above embodiment.

[0251] In another example, when SR=2, there may be 13 candidate points, and the order of these candidate points is based on the motion vector (0,0), with the order of points closest to the center being used. The order of candidate points in the first layer from the center is independent of the magnitude of the original motion vector, but the order of candidate points in the second layer from the center is related to the magnitude of the original motion vector. The order of these candidate points is {Mv(0,0),Mv(-1,0),Mv(0,-1),Mv(1,0),Mv(0,1),Mv(-1,1),Mv(-1,-1),Mv(1,1),Mv(sign_H*2,0),Mv(sign_H*2,sign_V*1),Mv(0,sign_V*2),Mv(0,sign_V*2)}. Let the first original motion vector be MV0, the horizontal component be MV0_Hor, and the vertical component be MV0_Ver. If MV0_Hor is greater than 0, sign_H=1. Otherwise, sign_H=-1. If MV0_Ver is greater than 0, sign_V=1. Otherwise, sign_V=-1. The cost values ​​corresponding to the motion vectors of these 13 points are determined, scanned in the above order, and the motion vector with the smallest cost value is obtained as the optimal offset MV. The integer pixel motion vector adjustment value and the decimal pixel motion vector adjustment value can then be determined using the optimal offset MV. For the determination method, please refer to the above embodiment.

[0252] Example 21: The above example relates to obtaining a first cost value corresponding to the center motion vector and a second cost value corresponding to the edge motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block, and obtaining a third cost value corresponding to the first original motion vector and a fourth cost value corresponding to the candidate motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block. In one example, a first cost value corresponding to the center motion vector, a second cost value corresponding to the edge motion vector, a third cost value corresponding to the first original motion vector, and a fourth cost value corresponding to the candidate motion vector are obtained based on a first pixel value that has not been downsampled and a second pixel value that has not been downsampled. Alternatively, a downsampling operation is performed on the first pixel value, and a downsampling operation is performed on the second pixel value. Based on the downsampled first and second pixel values, a first cost value corresponding to the center motion vector, a second cost value corresponding to the edge motion vector, a third cost value corresponding to the first original motion vector, and a fourth cost value corresponding to the candidate motion vector are obtained. Alternatively, a shift and downsampling operation is performed on the first pixel value, and a shift and downsampling operation is performed on the second pixel value. Then, based on the first and second pixel values ​​after the operation, a first cost value corresponding to the center motion vector, a second cost value corresponding to the edge motion vector, a third cost value corresponding to the first original motion vector, and a fourth cost value corresponding to the candidate motion vector are obtained.

[0253] If they are different, the method for determining the cost value is the same. For example, to obtain the cost value corresponding to the central motion vector, you can obtain sub-reference block A1 corresponding to the central motion vector by copying from the first reference block, obtain sub-reference block B1 corresponding to the symmetric motion vector of the central motion vector by copying from the second reference block, and use the first pixel value of sub-reference block A1 and the second pixel value of sub-reference block B1 to obtain the cost value corresponding to the central motion vector. To obtain the cost value corresponding to the edge motion vector, you can obtain sub-reference block A2 corresponding to the edge motion vector by copying from the first reference block, obtain sub-reference block B2 corresponding to the symmetric motion vector of the edge motion vector by copying from the second reference block, and use the first pixel value of sub-reference block A2 and the second pixel value of sub-reference block B2 to obtain the cost value corresponding to the edge motion vector, and so on.

[0254] As described above, in order to obtain the cost value corresponding to a motion vector, a subreference block corresponding to the motion vector is obtained from the first reference block, a subreference block corresponding to the symmetric motion vector of the motion vector is obtained from the second reference block, and then the cost value corresponding to the motion vector is obtained using the pixel values ​​of the two subreference blocks. This process will not be explained in detail.

[0255] Example 22: Based on Example 21, a cost value corresponding to the motion vector is obtained based on a first undownsampled pixel value (i.e., the undownsampled pixel value of the sub-reference block in the first reference block) and a second undownsampled pixel value (i.e., the undownsampled pixel value of the sub-reference block in the second reference block). For example, if the sub-reference block in the first reference block is pred0 and the sub-reference block in the second reference block is pred1, the cost value is determined based on the SAD of all pixel values ​​in sub-reference blocks pred0 and pred1 without performing vertical downsampling on the pixels of sub-reference blocks pred0 and pred1.

[0256] Based on all the pixel values ​​of subreference blocks pred0 and pred1, the formula for calculating the cost value is as follows:

[0257]

number

[0258] In the above formula, cost can represent the cost value, W may be the width value of the subreference block, H may be the height value of the subreference block, pred0(i,j) can represent the pixel value of the i-th column and j-th row of the subreference block pred0, pred1(i,j) can represent the pixel value of the i-th column and j-th row of the subreference block pred1, and abs(x) can represent the absolute value of x.

[0259] Example 23: Based on Example 21, a downsampling operation is performed on the first pixel value and on the second pixel value. Based on the downsampled first pixel value (i.e., the downsampled pixel value of the sub-reference block in the first reference block) and the downsampled second pixel value (i.e., the downsampled pixel value of the sub-reference block in the second reference block), a cost value corresponding to the motion vector can be obtained. For example, if the sub-reference block in the first reference block is pred0 and the sub-reference block in the second reference block is pred1, the cost value is determined based on the SAD of all pixel values ​​in sub-reference blocks pred0 and pred1. When determining the cost value using the SAD of all pixel values, the pixel values ​​of sub-reference blocks pred0 and pred1 are downsampled vertically by a factor of N (where N is an integer greater than 0, and may be 2).

[0260] Based on all the pixel values ​​of subreference blocks pred0 and pred1, the formula for calculating the cost value is as follows:

[0261]

number

[0262] In the above formula, cost can represent the cost value, W may be the width value of the subreference block, H may be the height value of the subreference block, N can represent the downsampling parameter and is an integer greater than 0, and may be 2, pred0(1+N(i-1),j) can represent the pixel value of the 1st+N(i-1)th column and jth row of the subreference block pred0, pred1(1+N(i-1),j) can represent the pixel value of the 1st+N(i-1)th column and jth row of the subreference block pred1, and abs(x) can represent the absolute value of x.

[0263] Example 24: Based on Example 21, perform a shift and downsampling operation on the first pixel value, perform a shift and downsampling operation on the second pixel value, and based on the first pixel value after the operation (the pixel value of the sub-reference block in the first reference block that is shifted and downsampled) and the second pixel value after the operation (the pixel value of the sub-reference block in the second reference block that is shifted and downsampled), obtain the cost value corresponding to the motion vector. For example, if the sub-reference block in the first reference block is pred0 and the sub-reference block in the second reference block is pred1, both pred0 and pred1 are stored in D bits, that is, each pixel value in pred0 is stored in D bits, and each pixel value in pred1 is stored in D bits.

[0264] When D is 8 or less, determine the cost value based on the SAD of all pixel values of the sub-reference block pred0 and the sub-reference block pred1. When determining the cost value using the SAD of all pixel values, vertically downsample the pixel values of the sub-reference block pred0 and the sub-reference block pred1 by N times (N is an integer greater than 0 and may be 2). Based on all pixel values of the sub-reference block pred0 and the sub-reference block pred1, the calculation formula for the cost value is as follows.

[0265]

Equation

[0266] In the above formula, cost represents the cost value, W is the width value of the subreference block, H is the height value of the subreference block, N represents the downsampling parameter, which is an integer greater than 0 and may be 2, pred0(1+N(i-1),j) represents the pixel value of the 1st+N(i-1)th column and jth row of the subreference block pred0, pred1(1+N(i-1),j) represents the pixel value of the 1st+N(i-1)th column and jth row of the subreference block pred1, abs(x) represents the absolute value of x, and thus it can be seen that the sum of the absolute values ​​of the differences between the 1st row, the N+1th row, the 2N+1th row, and so on is calculated.

[0267] If D is greater than 8, first, all pixel values ​​of subreference block pred0 and subreference block pred1 are shifted to 8 bits, and 8 bits of pred0 and 8 bits of pred1 are obtained, and pred 0-8bit(i,j) and pred 1-8bit(i,j) The aim is to reduce the memory cost of SAD calculations and enable 8-bit memory to achieve a higher degree of parallelism.

[0268]

number

[0269] Next, the pixel values ​​of 8-bit pred0 and 8-bit pred1 are vertically downsampled by a factor of N (where N is an integer greater than 0, and may be 2), and thus the formula for calculating the cost value may be as follows.

[0270]

number

[0271] In the above formula, the meaning of each expression is not explained in detail here, but rather by referring to the above example.

[0272] Example 25: In the above embodiment, for each subblock of the current block, the predicted value of the subblock is determined based on the first target motion vector and the second target motion vector of the subblock, and the predicted value of the current block is determined based on the predicted value of each subblock. For example, based on the first target motion vector and the second target motion vector of the subblock, two reference blocks in two directions (i.e., a third reference block and a fourth reference block containing predicted values ​​of three components, which need to be interpolated because the target motion vector may be a fraction of a pixel) are obtained by interpolation (e.g., 8-tap interpolation). Then, weights are applied based on the third pixel value of the third reference block and the fourth pixel value of the fourth reference block to obtain the final predicted value (e.g., predicted value of three components).

[0273] In one possible embodiment, if the optimal motion vector is the same as the initial motion vector (i.e., the first original motion vector or the second original motion vector), a third reference block corresponding to the subblock is determined from the first reference picture based on the first target motion vector of the subblock, and a fourth reference block corresponding to the subblock is determined from the second reference picture based on the second target motion vector of the subblock. The pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block are weighted to obtain a predicted value for the subblock.

[0274] For example, if the size of a subblock is dx*dy, a third reference block of size dx*dy is determined from the first reference picture based on the first target motion vector. For example, a reference block of size A*B is determined from the first reference picture, where the size of A*B is related to the interpolation method, for example, A is greater than dx and B is greater than dy, but this is not limited. A third reference block of size dx*dy can be obtained by interpolating the pixel values ​​in this reference block, but this interpolation method is not limited. A fourth reference block of size dx*dy is determined from the second reference picture based on the second target motion vector. For example, a reference block of size A*B is determined from the second reference picture, where the size of A*B is related to the interpolation method, for example, A is greater than dx and B is greater than dy, but this is not limited. A fourth reference block of size dx*dy can be obtained by interpolating the pixel values ​​in this reference block, but this interpolation method is not limited.

[0275] In another possible embodiment, if the optimal motion vector differs from the initial motion vector, a fifth reference block is determined from the first reference picture, the fifth reference block is extended to obtain a sixth reference block, and then, based on the first target motion vector of the subblock, a third reference block corresponding to the subblock is selected from the sixth reference block. A seventh reference block is determined from the second reference picture, the seventh reference block is extended to obtain an eighth reference block, and based on the second target motion vector of the subblock, a fourth reference block corresponding to the subblock is selected from the eighth reference block. Next, the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block are weighted to obtain a predicted value for the subblock.

[0276] For example, if the size of the subblock is dx*dy, a fifth reference block of size dx*dy is determined from the first reference picture based on the first original motion vector. For example, a reference block of size A*B is determined from the first reference picture, where the size of A*B is related to the interpolation method, for example, A is greater than dx and B is greater than dy, but this is not limited. A fifth reference block of size dx*dy can be obtained by interpolating the pixel values ​​in this reference block, but this interpolation method is not limited. Next, the fifth reference block is extended to obtain a sixth reference block, and for example, by copying neighboring values, it is filled above, below, left, and right of the fifth reference block, and the filled reference block becomes a sixth reference block of size greater than dx*dy. Next, based on the first target motion vector of the subblock, a third reference block of size dx*dy corresponding to the subblock is selected from the sixth reference block.

[0277] If the size of the subblock is dx*dy, a seventh reference block with size dx*dy is determined from the second reference picture based on the second original motion vector. For example, a reference block with size A*B is determined from the second reference picture, where the size of A*B is related to the interpolation method, for example, A is greater than dx and B is greater than dy, but this is not limited. A seventh reference block with size dx*dy can be obtained by interpolating the pixel values ​​in this reference block, but this interpolation method is not limited. Next, the seventh reference block is extended to obtain an eighth reference block, and for example, by copying neighboring values, it is filled above, below, left, and right of the seventh reference block, and the filled reference block is an eighth reference block with size greater than dx*dy. Next, based on the second target motion vector of the subblock, a fourth reference block with size dx*dy corresponding to the subblock is selected from the eighth reference block.

[0278] Example 26: After obtaining the target motion vector, predictive values ​​in two directions (i.e., the three components of YUV, i.e., the predictive value of the third reference block and the predictive value of the fourth reference block) are obtained using an 8-tap interpolation filter based on the target motion vector of each subblock, and then weighted to obtain the final predictive value. Alternatively, predictive values ​​in two directions (i.e., the three components of YUV, i.e., the predictive value of the third reference block and the predictive value of the fourth reference block) are obtained using a bilinear interpolation filter (not an 8-tap interpolation filter in this case) based on the target motion vector of each subblock, and then weighted to obtain the final predictive value.

[0279] Example 27: After obtaining predicted values ​​in two directions, the final predicted value is obtained by weighting and averaging the mean values ​​(i.e., the weights of the predicted values ​​in the two directions are the same). Alternatively, after obtaining predicted values ​​in two directions, the final predicted value is obtained by weighting and averaging, and the weights of the two predicted values ​​may be different. For example, the weight ratios of the two predicted values ​​may be 1:2, 1:3, 2:1, etc. On the encoding side, the weight table may include weight ratios such as 1:2, 1:3, 2:1, etc. The encoding side can determine the cost value of each weight ratio and determine the weight ratio with the smallest cost value. In this way, the encoding side obtains the final predicted value by weighting and averaging based on the weight ratio with the smallest cost value. When the encoding side sends the encoded bitstream to the decoding side, the encoded bitstream contains the index values ​​of the weight ratios in the weight table. In this way, the decoding side parses the index values ​​of the encoded bitstream to obtain the weight ratios corresponding to the index values ​​from the weight table and obtains the final predicted value by weighting and averaging based on the weight ratios.

[0280] For example, the weight table may include, but is not limited to, {-2, 3, 4, 5, 10}. Exemplarily, the sum of two weights may be 8. Each weight may be a negative value, as long as the sum of the two weights is 8.

[0281] For example, the weight "-2" is a negative value. If the weight of one predicted value is -2 and the weight of the other predicted value is 10, that is, the sum of the two weights is 8. In this case, the final predicted value = (predicted value 1 * (-2) + predicted value 2 * (8 - (-2))).

[0282] Also for example, the weight "10" means that the weight of one predicted value is 10 while the weight of the other predicted value is -2, that is, the sum of the two weights is 8. In this case, the final predicted value = (predicted value 1 * (10) + predicted value 2 * (-2)).

[0283] Also for example, the weight "3" means that the weight of one predicted value is 3 while the weight of the other predicted value is 5, that is, the sum of the two weights is 8. In this case, the final predicted value = (predicted value 1 * (3) + predicted value 2 * (5)).

[0284] Also for example, the weight "5" means that the weight of one predicted value is 5 while the weight of the other predicted value is 3, that is, the sum of the two weights is 8. In this case, the final predicted value = (predicted value 1 * (5) + predicted value 2 * (3)).

[0285] Also for example, the weight "4" means that the weight of one predicted value is 4 while the weight of the other predicted value is 4, that is, the sum of the two weights is 8. In this case, the final predicted value = (predicted value 1 * (4) + predicted value 2 * (4)).

[0286] In one possible embodiment, for each subblock of the current block, the third pixel value of the third reference block and the fourth pixel value of the fourth reference block are obtained by referring to the above embodiment, and then weighted based on the third pixel value of the third reference block and the fourth pixel value of the fourth reference block to obtain the final predicted value. For example, weighting is performed on the third pixel value, a first weight corresponding to the third pixel value, the fourth pixel value, and a second weight corresponding to the fourth pixel value to obtain the predicted value of the subblock. The final predicted value is obtained by weighting the mean values ​​(i.e., the two weights are the same), so the first weight is the same as the second weight.

[0287] Example 28: In the above embodiment, the first target motion vector and the second target motion vector of each subblock of the current block are stored, or the first original motion vector and the second original motion vector of each subblock of the current block are stored, or the first original motion vector, the second original motion vector, the first target motion vector and the second target motion vector of each subblock of the current block are stored. The stored motion vectors are used for encoding / decoding reference of subsequent blocks.

[0288] For example, let us describe the storage of the first and second target motion vectors of each subblock of the current block, where the first and second target motion vectors are used for loop filtering of the current picture, the first and second target motion vectors are used for time-domain referencing of subsequent frames, and / or the first and second target motion vectors are used for spatial-domain referencing of the current picture. For example, the first and second target motion vectors of each subblock of the current block may be used for motion compensation of the current block, or for time-domain referencing of subsequent frames. Also, for example, the first and second target motion vectors of each subblock of the current block may be used for motion compensation of the current block, or for the loop filtering process of the current block, or for time-domain referencing of subsequent frames. For example, the first and second target motion vectors of each subblock of the current block may be used for motion compensation of the current block, for loop filtering of the current block, for time-domain referencing of subsequent frames, or for spatial-domain referencing of the current picture. This will be explained below.

[0289] The first and second target motion vectors of each subblock of the current block may be used for spatial domain referencing of blocks within a given LCU (Largest Coding Unit) in the spatial domain. The coding and decoding order is from top to bottom and left to right; therefore, the motion vector of the current block may be referenced by other blocks in the current LCU, or by subsequent blocks in neighboring LCUs. Because the computational cost required to obtain the target motion vector is large, subsequent blocks referencing the current block's target motion vector must wait for a long time. To avoid delays caused by excessive waiting, only a small number of spatially neighboring blocks can reference the current block's target motion vector, while other blocks reference the current block's original motion vector.

[0290] For example, these few blocks include subblocks located within the lower LCU and the lower right LCU, which are situated below the current LCU, but the subblocks located within the right LCU and the left LCU cannot reference the target motion vector of the current block.

[0291] Example 29: The motion vector adjustment process will be explained below with reference to a specific example. The specific steps for adjusting the motion vector may be as follows. The following "copy" shows that it can be obtained without interpolation, and if the MV (i.e., motion vector) is an integer pixel offset, it can be copied directly from the reference picture; otherwise, interpolation is necessary.

[0292] In step e1, when the motion vector adjustment mode is activated for the current block, the following process is performed.

[0293] In step e2, prepare the reference pixel values ​​(let the current block width be W and height be H).

[0294] Prepare integer pixel blocks for step e3: As shown in Figure 8, based on the original motion vectors (let's call the original motion vector of list0 Org_MV0 and the original motion vector of list1 Org_MV1), copy two integer pixel blocks with an area of ​​(W+FS-1)*(H+FS-1) and three components from the corresponding positions of the corresponding reference picture. Also, prepare integer pixel blocks for step e4: Using the above (W+FS-1)*(H+FS-1) integer pixel block as a base, expand the integer pixel block with (W+FS-1)*(H+FS-1) and three components by SR rows / columns in the up, down, left, and right directions respectively. After expansion, obtain integer pixel blocks with an area of ​​(W+FS-1+2*SR)*(H+FS-1+2*SR) and three components, and designate them as Pred_Inter0 and Pred_Inter1. For example, the size of the inner black region is the current block size, the outer extended white region is the additional reference pixels needed to interpolate the original motion vector with an 8-tap filter, and the outer black region is the additional reference pixels needed to interpolate the target motion vector with an 8-tap filter.

[0295] The black and white regions of the inner layer W*H obtain pixel values ​​from a reference picture, while the pixel values ​​of the outer layer black region do not need to be obtained from a reference picture and can be obtained by copying neighboring pixel values. In one example, the W+FS-1 pixel values ​​in the first row of the white region are copied to the pixel values ​​of the first SR row of the outer layer black region. The W+FS-1 pixel values ​​in the last row of the white region are copied to the pixel values ​​of the last SR row of the outer layer black region. Next, the H+FS-1 pixel values ​​in the first column of the white region and the SR values ​​of the obtained outer layer black region above and below are copied to the pixel values ​​of the first SR column of the outer layer black region. The H+FS-1 pixel values ​​in the last column of the white region and the SR values ​​of the obtained outer layer black region above and below are copied to the pixel values ​​of the last SR column of the outer layer black region. In another example, the H+FS-1 pixel values ​​in the first column of the white region are copied to the pixel values ​​of the first SR column of the outer layer black region. Copy the H+FS-1 pixel values ​​from the last column of the white region to the pixel values ​​in the last SR column of the outer black region. Next, copy the W+FS-1 pixel values ​​from the first row of the white region and the SR values ​​of the acquired outer black region on each side to the pixel values ​​in the first SR row of the outer black region. Copy the W+FS-1 pixel values ​​from the last row of the white region and the SR values ​​of the acquired outer black region on each side to the pixel values ​​in the last SR row of the outer black region.

[0296] The initial motion compensation is performed based on motion information from two different directions. For example, for the luminance component (which is used to calculate the cost value in the subsequent search process), two initial reference prediction value blocks of size (W+2*SR)*(H+2*SR) are obtained by bilinear interpolation based on two integer pixel reference blocks with area (W+FS-1)*(H+FS-1) (referred to as Pred_Bilinear0 and Pred_Bilinear1), where FS is the number of filter taps, which defaults to 8, and SR is the search range, i.e., the maximum horizontal / vertical component interpolation between the target motion vector and the original motion vector, which defaults to 2. Pred_Bilinear0 / 1 are used in step e3.

[0297] In step e3, the target motion vector is obtained for each of the dx*dy subblocks of the current block (the target motion vectors in the two directions are designated as Refined_MV0 and Refined_MV1, respectively).

[0298] In step e31, SR iterations are performed to obtain the integer pixel offset of the optimal integer pixel MV point, set it as IntegerDeltaMV, initialize IntegerDeltaMV to (0,0), and in each iteration, the following process is performed.

[0299] In step e311, deltaMV is set to (0,0). In the first iteration, based on the original motion vector, two predicted value blocks (the W*H block at the very center of Pred_Bilinear0 / 1) are obtained by copying at the reference pixel Pred_Bilinear0 / 1, and based on these two predicted value blocks, the initial cost value, i.e., the SAD obtained by vertically downsampling the two predicted value blocks by a factor of 2, is obtained. If this initial cost value is less than dx*dy (where dx and dy are the width and height of the current subblock), the subsequent search process is skipped directly, step e32 is performed, and notZeroCost is set to false.

[0300] In step e312, centered on the initial point mentioned above, 24 offsets MV (all 24 of these offsets MV are called MVOffset) are obtained in the order {Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-2,2), Mv(-1,2), Mv(0,2), Mv(1,2), Mv(2,2)}, and a cost value calculation and comparison process is performed for these offsets MV. For example, based on a certain MVOffset, two predicted value blocks are obtained for the reference pixel Pred_Bilinear0 / 1 using the MVOffset (i.e., a W*H block with the center position offset MVOffset applied in Pred_Bilinear0, and a W*H block with the center position offset -MVOffset (the reverse of list0) applied in Pred_Bilinear1). The downsampled SAD of these two blocks is then calculated as the cost value of the MVOffset. The MVOffset with the smallest cost value is retained (stored in deltaMV).

[0301] Update IntegerDeltaMV:IntegerDeltaMV=deltaMV based on the deltaMV value.

[0302] In step e313, if, after one iteration, the optimal MV remains the initial MV or the minimum cost value is 0, the next iterative search process is not performed, and step e32 is executed, setting notZeroCost to false.

[0303] In step e32, the optimal integer pixel MV point from step e31 is used as the center, the optimal decimal pixel offset MV is obtained, and this is set as SPMV (i.e., subMV). SPMV is initialized to (0,0), and then the following process is performed.

[0304] In step e321, if notZeroCost is not false and deltaMV is (0,0), the subsequent processing is performed; otherwise, the original motion vector is adjusted directly using IntegerDeltaMV.

[0305] In step e322, E(x,y) is expressed as the cost value (the cost value calculated in step e31) corresponding to the MV obtained by offsetting the optimal MV point obtained in step e31 by (x,y). Based on the E(x,y) of the center and the five points above, below, left, and right, we can obtain the offset (x0,y0) of the point with the smallest E(x,y): x0 = N*(E(-1,0)-E(1,0)) / (E(-1,0)+E(1,0)-2*E(0,0)), y0 = N*(E(0,-1)-E(0,1)) / (E(0,-1)+E(0,1)-2*E(0,0)). For example, for motion vector pixel accuracies of 1 / 2, 1 / 4, 1 / 8, and 1 / 16, N is 1, 2, 4, and 8. Next, we give the values ​​of (x0, y0) to deltaMv, and SPMV = deltaMv / 2N. Currently, for a motion vector pixel accuracy of 1 / 16, SPMV may also be (x0 / 16, y0 / 16).

[0306] If E(-1,0)=E(0,0), then offset horizontally to the left by half a pixel (deltaMv[0]=-N).

[0307] If E(1,0)=E(0,0), then offset horizontally to the right by half the pixels (deltaMv[0]=N).

[0308] If E(0,-1)=E(0,0), then offset vertically upwards by half the number of pixels (deltaMv[1]=-N).

[0309] If E(0,1)=E(0,0), then offset vertically downwards by half the number of pixels (deltaMv[1]=N).

[0310] In step e33, the optimal offset MV is obtained based on the integer pixel offset IntegerDeltaMV from step e31 and the fractional pixel offset SPMV from step e32, and this optimal offset MV is defined as BestMVoffset. BestMVoffset = IntegerDeltaMV + SPMV. Based on BestMVoffset, the target motion vectors in two directions are obtained: Refined_MV0 = Org_MV0 + BestMVoffset and Refined_MV1 = Org_MV1 - BestMVoffset.

[0311] In step e4, based on the target motion vector of each subblock, 8-tap interpolation is performed to obtain predicted values ​​for three components in two directions, and these are weighted to obtain the final predicted value (e.g., predicted values ​​for three components). For example, based on the target motion vectors Refined_MV0 and Refined_MV1 of each subblock, the corresponding predicted block is obtained by interpolation in Pred_Inter0 / 1 prepared in step e2 (interpolation is necessary to obtain the corresponding pixel block because the motion vector may have a fraction of pixels).

[0312] In step e5, the target motion vector is used for motion compensation of the current block (i.e., to obtain the predicted values ​​of each subblock and the current block) and for time-domain referencing of subsequent frames, but not for loop filtering or spatial-domain referencing of the current picture.

[0313] Example 30: The difference from Example 29 is that the reference pixel preparation process is moved to each of the dx*dy subblocks. When preparing the reference pixel, only the (dx+(filtersize-1))*(dy+(filtersize-1)) pixel block is prepared, and if the optimal motion vector obtained through the search is not the original motion vector, the reference pixel is expanded. Otherwise, it is not expanded. For each of the dx*dy subblocks of the current block, a target motion vector is obtained, motion compensation is performed based on the target motion vector, and the final predicted value is obtained by weighting, and the following process is performed for each of the dx*dy subblocks of the current block.

[0314] In step f1, when the motion vector adjustment mode is activated for the current block, the following process is performed.

[0315] In step f2, integer pixel blocks for step f3 are prepared: for example, for the luminance component only, two integer pixel blocks with area (dx + (filtersize-1)) * (dy + (filtersize-1)) are obtained from the corresponding positions of the corresponding reference picture based on the original motion vectors (let's say the original motion vector for list0 is Org_MV0 and the original motion vector for list1 is Org_MV1).

[0316] For example, `filtersize` can be the number of filter taps, which defaults to 8.

[0317] In step f3, the target motion vectors (referred to as Refined_MV0 and Refined_MV1, respectively, for each of the dx*dy subblocks of the current block) are obtained.

[0318] For example, the process of realizing step f3 can refer to step e3, which will not be repeated here.

[0319] For example, the first motion vector compensation is performed based on the original motion vector. For the luminance component only, an initial predicted value of size (dx + 2 * IterNum) * (dy + 2 * IterNum) is obtained by bilinear interpolation, where IterNum is 2 by default, and IterNum may be the search range SR, or iterNum may be the maximum horizontal / vertical component interpolation between the target motion vector and the original motion vector. The initial predicted value of the original motion vector obtained above is stored in m_cYuvPredTempL0 / 1.

[0320] The cost values ​​of 25 points are calculated, and the integer pixel offset of the optimal integer pixel MV point is obtained. If it is the first point (the MV offset is (0,0)), the initial cost (cost is the SAD obtained by vertically downsampling the predicted values ​​in two directions by 2 times) is obtained, and if this cost is less than dx*dy, the subsequent search process is skipped directly (notZeroCost is set to false). The cost of the 24 points is calculated and compared with the above initial point, and the point with the smallest cost is kept as the new center point for the next step. The optimal 1 / 16 pixel decimal pixel offset is obtained, centered on the optimal integer pixel MV point. Based on the integer pixel offset and decimal pixel offset, the optimal offset MV is obtained, and the optimal offset MV is set as BestMVoffset. BestMVoffset = IntegerDeltaMV + SPMV. Based on BestMVoffset, obtain the target motion vectors in two directions: Refined_MV0 = Org_MV0 + BestMVoffset and Refined_MV1 = Org_MV1 - BestMVoffset.

[0321] In step f4, if the optimal offset MV is (0,0), the following steps are not performed (i.e., no further expansion is performed if the original motion vector is used). If the optimal offset MV is not (0,0), integer pixels are reacquired (because the reference pixels were not expanded in the above step, the required reference pixels after the offset exceed the range of reference pixels acquired in the above step), and the following steps are performed.

[0322] For the reference pictures in list0 and list1, for each of the U / V components (since the luminance component was obtained in step f2): obtain integer pixel values ​​of (dxc + (filtersizeC-1)) * (dyc + (filtersizeC-1)) from the reference pictures, where dxc and dyc are related to the sampling rate; if YUV has a sampling rate of 420, then dxc = dx / 2 and dyc = dy / 2. Of course, this is just an example, and dxc and dyc are not limited. filtersizeC may also be 4, and of course, this is just an example, and filtersizeC is not limited. Alternatively, for example, integer pixel values ​​of dx * dy could be obtained directly from the reference picture, but this is not limited.

[0323] For the reference pictures in list0 and list1, fill in the three components respectively. For example, fill in the top, bottom, left, and right sides based on the integer pixel values ​​obtained in the above step (e.g., the integer pixel values ​​of (dxc + (filtersizeC-1)) * (dyc + (filtersizeC-1))) by copying neighboring values ​​(e.g., the filling width and luminance components are 2, and the chroma component of 420 is 1). Exemplarily, the available integer pixel values ​​around the current subblock (within the current CU block) are not used here.

[0324] In step f5, based on the target motion vector of each subblock and the two reference pixel blocks (obtained in step f4), 8-tap interpolation is performed to obtain predicted values ​​for three components in two directions, and these are weighted to obtain the final predicted values ​​(e.g., predicted values ​​for three components).

[0325] Example 31: The above examples may be implemented individually or in any combination, and are not limited thereto.

[0326] For example, Example 4 may be carried out in combination with Example 2, and Example 4 may be carried out in combination with Example 3.

[0327] Example 5 may be carried out in combination with Example 2, Example 5 may be carried out in combination with Example 2 and Example 4, Example 5 may be carried out in combination with Example 3, and Example 5 may be carried out in combination with Example 3 and Example 4.

[0328] Example 6 may be carried out alone, Example 7 may be carried out alone, Example 8 may be carried out in combination with Example 7, Example 9 may be carried out in combination with Example 7, Example 10 may be carried out in combination with Example 7, Example 11 may be carried out in combination with Example 7, Example 12 may be carried out in combination with Example 7, Example 13 may be carried out in combination with Example 7, Example 14 may be carried out in combination with Example 7, and Example 15 may be carried out in combination with Example 7.

[0329] Example 16 may be carried out alone, Example 17 may be carried out alone, Example 18 may be carried out in combination with Example 17, Example 19 may be carried out in combination with Example 17, and Example 20 may be carried out in combination with Example 17.

[0330] Example 21 may be carried out in combination with Example 6, Example 21 may be carried out in combination with Example 16, Example 21 may be carried out in combination with Example 7, Example 21 may be carried out in combination with Example 17, Example 22 may be carried out in combination with Example 21, Example 23 may be carried out in combination with Example 21, and Example 24 may be carried out in combination with Example 21.

[0331] Example 25 may be carried out in combination with Example 2, Example 25 may be carried out in combination with Example 2 and Example 4, Example 25 may be carried out in combination with Example 3, and Example 25 may be carried out in combination with Example 3 and Example 4.

[0332] Example 26 may be carried out in combination with Example 25, and Example 27 may be carried out in combination with Example 25.

[0333] Example 28 may be carried out in combination with Example 2, Example 28 may be carried out in combination with Example 2 and Example 4, Example 28 may be carried out in combination with Example 3, and Example 28 may be carried out in combination with Example 3 and Example 4.

[0334] Example 29 may be implemented alone, or it may be implemented in combination with Example 4. Example 30 may be implemented alone, or it may be implemented in combination with Example 4. Of course, the above are just some examples of the present application, but it is not limited thereto, and all embodiments relating to the present application may be implemented alone or in combination, and this will not be described in detail.

[0335] Example 32, Based on an inventive concept similar to the above method, embodiments of the present invention further provide an encoding and decoding device to be applied to the encoding side or the decoding side, for example, as shown in Figure 9A, which is a structural diagram of the device, and the device is As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then a decision module 911 determines to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, it includes a motion compensation module 912 for performing motion compensation for the current block.

[0336] Specifically, the motion compensation module 912 provides the following for each subblock among at least one subblock included in the current block: Based on the first original motion vector of the subblock, a first reference block corresponding to the subblock is determined; based on the second original motion vector of the subblock, a second reference block corresponding to the subblock is determined; based on the first pixel value of the first reference block and the second pixel value of the second reference block, the first original motion vector and the second original motion vector are adjusted to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector; and based on the first target motion vector and the second target motion vector, a predicted value of the subblock is determined. This is used to determine the predicted value of the current block based on the predicted values ​​of each subblock.

[0337] The aforementioned decision module 911 further, As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. This is used to determine whether to activate motion vector adjustment mode for the current block unless one of the following conditions is met: the size of both reference pictures in the current block is the same as the size of the current picture.

[0338] The control information that allows the current block to use the move vector adjustment mode includes, as sequence level control information, allowing the current block to use the move vector adjustment mode, and / or as picture level control information, allowing the current block to use the move vector adjustment mode.

[0339] Currently, the width, height, and area of ​​a block are all within the limit range, which includes the width being greater than or equal to a first threshold, the height being greater than or equal to a second threshold, and the area being greater than or equal to a third threshold, or the width being greater than or equal to a first threshold, the height being greater than or equal to a second threshold, and the area being greater than or equal to a fourth threshold, wherein the third threshold is greater than the fourth threshold.

[0340] The first threshold is 8, the second threshold is 8, the third threshold is 128, and the fourth threshold is 64.

[0341] When the motion compensation module 912 determines a first reference block corresponding to the subblock based on the first original motion vector of the subblock, and determines a second reference block corresponding to the subblock based on the second original motion vector of the subblock, specifically, Based on the first original motion vector of the subblock, a first reference block corresponding to the subblock is determined from the first reference picture, and the pixel value of each pixel point in the first reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the first reference block, or by copying the pixel values ​​of neighboring pixel points in the first reference block. Based on the second original motion vector of the subblock, a second reference block corresponding to the subblock is determined from the second reference picture, and the pixel value of each pixel point in the second reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the second reference block, or by copying the pixel values ​​of neighboring pixel points in the second reference block.

[0342] The motion compensation module 912 adjusts the first original motion vector and the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector, specifically, Centered on the initial motion vector, some or all motion vectors are selected from motion vectors around the initial motion vector that include the initial motion vector, and the selected motion vectors are determined to be candidate motion vectors, and the initial motion vector is either the first original motion vector or the second original motion vector. Based on the first pixel value of the first reference block and the second pixel value of the second reference block, one motion vector is selected as the optimal motion vector from the initial motion vector and each candidate motion vector. This method is used to adjust the first original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector, and to adjust the second original motion vector based on the optimal motion vector to obtain a second target motion vector corresponding to the second original motion vector.

[0343] When the motion compensation module 912 adjusts the first original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector, and adjusts the second original motion vector based on the optimal motion vector to obtain a second target motion vector corresponding to the second original motion vector, specifically, Based on the aforementioned optimal motion vector, the first integer pixel motion vector adjustment value, the second integer pixel motion vector adjustment value, the first decimal pixel motion vector adjustment value, and the second decimal pixel motion vector adjustment value of the subblock are determined. Based on the first integer pixel motion vector adjustment value and the first decimal pixel motion vector adjustment value, the first original motion vector is adjusted to obtain the first target motion vector of the subblock. This is used to adjust the second original motion vector based on the second integer pixel motion vector adjustment value and the second decimal pixel motion vector adjustment value, in order to obtain the second target motion vector of the subblock.

[0344] When the optimal motion vector is the same as the initial motion vector, the motion compensation module 912 determines the predicted value of the subblock based on the first target motion vector and the second target motion vector, specifically, Based on the first target motion vector of the subblock, a third reference block corresponding to the subblock is determined from the first reference picture. Based on the second target motion vector of the subblock, a fourth reference block corresponding to the subblock is determined from the second reference picture. This method is used to weight the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block in order to obtain the predicted value of the subblock.

[0345] If the optimal motion vector differs from the initial motion vector, the motion compensation module 912 determines the predicted value of the subblock based on the first target motion vector and the second target motion vector, specifically, Determine a fifth reference block from a first reference picture, extend the fifth reference block to obtain a sixth reference block, and based on the first target motion vector of the subblock, select a third reference block corresponding to the subblock from the sixth reference block. Determine a seventh reference block from a second reference picture, extend the seventh reference block to obtain an eighth reference block, and based on the second target motion vector of the subblock, select a fourth reference block corresponding to the subblock from the eighth reference block. This method is used to weight the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block in order to obtain the predicted value of the subblock.

[0346] When the motion compensation module 912 weights the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block to obtain a predicted value of the subblock, specifically, it performs a weighting process on the pixel values ​​of the third reference block, a first weight corresponding to the pixel values ​​of the third reference block, the pixel values ​​of the fourth reference block, and a second weight corresponding to the pixel values ​​of the fourth reference block to obtain a predicted value of the subblock, wherein the first weight and the second weight are the same.

[0347] From a hardware perspective, a schematic diagram of the hardware architecture of a decoding device according to an embodiment of the present invention can be specifically seen in Figure 9B. It includes a processor 921 and a machine-readable storage medium 922, the machine-readable storage medium 922 storing machine-executable instructions that can be executed by the processor 921, and the processor 921 is used to carry out the method disclosed in the above example of the present invention by executing the machine-executable instructions. For example, the processor is used to accomplish the following steps by executing the machine-executable instructions.

[0348] As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then it is decided to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, the step of performing motion compensation for the current block.

[0349] From a hardware perspective, a schematic diagram of the hardware architecture of an encoding device according to an embodiment of the present invention can be specifically seen in Figure 9C. It includes a processor 931 and a machine-readable storage medium 932, the machine-readable storage medium 932 storing machine-executable instructions that can be executed by the processor 931, and the processor 931 is used to carry out the methods disclosed in the above examples of the present invention by executing machine-executable instructions. For example, the processor is used to accomplish the following steps by executing machine-executable instructions.

[0350] As control information, the current condition is that the block is moving and the vector adjustment mode is permitted. The current block prediction mode is normal fusion mode, or the current block prediction mode is fusion mode or skip mode, and the current block prediction mode is not any other mode other than normal fusion mode. The current block's predicted value is obtained by weighting the reference blocks from two reference pictures, the display order of the two reference pictures is before and after the current picture, and the distance from the two reference pictures to the current picture is the same. The condition is that the weights of the two reference pictures in the current block are the same. The condition is that both reference pictures in the current block are short-term reference pictures. The current condition is that the width, height, and area of ​​the block are all within a limited range. If all conditions are met, such that the sizes of the two reference pictures in the current block are the same as the size of the current picture, then it is decided to activate motion vector adjustment mode for the current block. If it is decided to activate motion vector adjustment mode for the current block, the step of performing motion compensation for the current block.

[0351] Based on an inventive concept similar to the above-described method, embodiments of the present invention further provide a machine-readable storage medium in which a plurality of computer instructions are stored, and when the computer instructions are executed by a processor, the encoding and decoding methods disclosed in the above-described examples of the present invention can be implemented. The machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device, and may contain or store information such as executable commands, data, etc. For example, the machine-readable storage medium may be RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (e.g., hard disk drives), solid-state drives, any type of storage disk (e.g., optical discs, DVDs, etc.), or similar storage media, or a combination thereof.

[0352] Based on an inventive concept similar to the above-described method, embodiments of the present invention further provide a computer program product including computer instructions, which, when executed by a processor, can implement the encoding and decoding methods disclosed in the above-described examples of the present invention.

[0353] Based on an inventive concept similar to the above-described method, embodiments of the present invention further provide an encoding and decoding system including a processor and a machine-readable storage medium, wherein machine-executable instructions that can be executed by the processor are stored in the machine-readable storage medium. When the machine-executable instructions are executed by the processor, the encoding and decoding method disclosed in the above-described embodiment of the present invention can be carried out.

[0354] The systems, devices, modules, or units described in the above embodiments may be specifically implemented by computer chips or entities, or by products having certain functions. Conventional implementing devices are computers, and specific forms of computers may include personal computers, laptop computers, mobile phones, camera phones, smartphones, personal digital assistants, media players, navigation devices, email sending and receiving devices, game consoles, tablet computers, wearable devices, or any combination of several types of these devices. For ease of explanation, when describing the above devices, they will be divided into various units based on their functions and described accordingly. Naturally, when implementing the present invention, the functions of each unit can be implemented with the same or multiple software and / or hardware.

[0355] As will be understood by those skilled in the art, embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention may take the form of complete hardware embodiments, complete software embodiments, or embodiments combining software and hardware. Embodiments of the present invention may take the form of computer program products implemented on one or more computer-readable storage media (including, but not limited to, disk memory, CD-ROM, optical memory, etc.) containing computer-readable program code. This application will be described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products relating to embodiments of this application. It should be understood that computer program instructions can realize each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams. These computer program instructions can be provided to the processor of a general-purpose computer, a dedicated computer, an embedded processor, or other programmable data processing device to generate a machine, and the instructions executed by the processor of the computer or other programmable data processing device generate a device for realizing a specified function in one flow of a flowchart or one or more blocks of multiple flows and / or block diagrams.

[0356] These computer program instructions may be stored in computer-readable memory that can guide a computer or other programmable data processing device to operate in a particular manner, thereby generating a product in which the instructions stored in the computer-readable memory generate an instruction unit that implements a function specified in one or more flows of a flowchart and / or one or more blocks of a block diagram. These computer program instructions may be loaded into a computer or other programmable data processing device, thereby generating a computer-implemented process by which the computer or other programmable device executes a series of operational steps, thereby providing steps for implementing a function specified in one or more flows of a flowchart and / or one or more blocks of a block diagram.

[0357] The foregoing describes only embodiments of the present application and does not limit it. To those skilled in the art, the present invention is subject to various modifications and changes. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of the claims.

Claims

1. A coding and decoding method, If it is decided to use a motion vector adjustment mode for the current block, the steps include performing motion compensation for the current block and obtaining a predicted value for the current block. The steps of performing motion compensation on the current block and obtaining the predicted value of the current block are as follows: For each of the subblocks among the at least one subblock included in the current block, The steps include determining a first reference block corresponding to the subblock based on the first original motion vector of the subblock, and determining a second reference block corresponding to the subblock based on the second original motion vector of the subblock, The steps include adjusting the first original motion vector and the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector, A step of determining the predicted value of the subblock based on the first target motion vector and the second target motion vector, The step includes determining the predicted value of the current block based on the predicted values ​​of all subblocks, The step of adjusting the first original motion vector and the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector is: The steps include selecting all motion vectors as candidate motion vectors from (2*SR+1)*(2*SR+1) motion vectors around an initial motion vector that include the initial motion vector, Regardless of whether the cost value corresponding to the initial motion vector is less than a predetermined threshold, the cost value of the candidate motion vector is determined based on the first pixel value of the first reference block and the second pixel value of the second reference block, and the motion vector with the smallest cost value is set as the optimal motion vector. The process includes the steps of adjusting the first original motion vector and the second original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector, The initial motion vector is either the first original motion vector or the second original motion vector. SR represents the search range, and if the value of SR is 2, the search order for the 25 candidate motion vectors is {Mv(0,0), Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1), Mv(-2,0), Mv(-1,0), Mv(0,0), M {v(1,0), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-2,2), Mv(-1,2), Mv(0,2), Mv(1,2), Mv(2,2)}, where Mv(0,0) is the initial motion vector, and the other candidate motion vectors, excluding Mv(0,0), are offset motion vectors of the initial motion vector. The step of adjusting the first original motion vector and the second original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector is: The steps include determining a first integer pixel motion vector adjustment value based on the optimal motion vector, and determining a second integer pixel motion vector adjustment value based on the first integer pixel motion vector adjustment value, A coding and decoding method characterized by comprising the steps of: adjusting the first original motion vector based on the first integer pixel motion vector adjustment value to obtain a first target motion vector corresponding to the first original motion vector; and adjusting the second original motion vector based on the second integer pixel motion vector adjustment value to obtain a second target motion vector corresponding to the second original motion vector.

2. The steps of determining a first reference block corresponding to the subblock based on the first original motion vector of the subblock, and determining a second reference block corresponding to the subblock based on the second original motion vector of the subblock, are as follows: A step of determining a first reference block corresponding to the subblock from a first reference picture based on a first original motion vector of the subblock, wherein the pixel value of each pixel point in the first reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the first reference block, or by copying the pixel values ​​of neighboring pixel points in the first reference block. The method according to claim 1, comprising the step of determining a second reference block corresponding to the subblock from a second reference picture based on a second original motion vector of the subblock, wherein the pixel value of each pixel point in the second reference block is obtained by interpolating the pixel values ​​of neighboring pixel points in the second reference block, or by copying the pixel values ​​of neighboring pixel points in the second reference block.

3. If the optimal motion vector is the same as the original motion vector, the step of determining the predicted value of the subblock based on the first target motion vector and the second target motion vector is: The steps include determining a third reference block corresponding to the subblock from a first reference picture based on the first target motion vector of the subblock, The steps include determining a fourth reference block corresponding to the subblock from a second reference picture based on the second target motion vector of the subblock, The method according to claim 1, comprising the step of obtaining a predicted value of the subblock by weighting the pixel value of the third reference block and the pixel value of the fourth reference block.

4. If the optimal motion vector differs from the original motion vector, the step of determining the predicted value of the subblock based on the first target motion vector and the second target motion vector is as follows: The steps include determining a fifth reference block from a first reference picture, extending the fifth reference block to obtain a sixth reference block, and selecting a third reference block corresponding to the subblock from the sixth reference block based on the first target motion vector of the subblock, The steps include determining a seventh reference block from a second reference picture, extending the seventh reference block to obtain an eighth reference block, and selecting a fourth reference block corresponding to the subblock from the eighth reference block based on the second target motion vector of the subblock, The method according to claim 1, comprising the step of obtaining a predicted value of the subblock by weighting the pixel value of the third reference block and the pixel value of the fourth reference block.

5. The step of obtaining a predicted value for the subblock by weighting the pixel values ​​of the third reference block and the pixel values ​​of the fourth reference block is: The process includes a step of performing a weighting process on the pixel value of the third reference block, a first weight corresponding to the pixel value of the third reference block, the pixel value of the fourth reference block, and a second weight corresponding to the pixel value of the fourth reference block to obtain a predicted value for the subblock, The method according to 3 or 4, characterized in that the first weight and the second weight are the same.

6. An encoding and decoding device, If it is decided to use a motion vector adjustment mode for the current block, a motion compensation module is provided to perform motion compensation on the current block and obtain a predicted value for the current block. The motion compensation module performs motion compensation on the current block and obtains a predicted value for the current block. For each of the subblocks among the at least one subblock included in the current block, Based on the first original motion vector of the subblock, a first reference block corresponding to the subblock is determined, and based on the second original motion vector of the subblock, a second reference block corresponding to the subblock is determined. Based on the first pixel value of the first reference block and the second pixel value of the second reference block, the first original motion vector and the second original motion vector are adjusted to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector. Based on the first target motion vector and the second target motion vector, the predicted value of the subblock is determined. Used to determine the predicted value of the current block based on the predicted values ​​of all subblocks, The motion compensation module adjusts the first original motion vector and the second original motion vector based on the first pixel value of the first reference block and the second pixel value of the second reference block, and obtains a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector. From the (2*SR+1)*(2*SR+1) motion vectors around the initial motion vector that include the initial motion vector, all motion vectors are selected as candidate motion vectors. Regardless of whether the cost value corresponding to the initial motion vector is less than a predetermined threshold, the cost value of the candidate motion vector is determined based on the first pixel value of the first reference block and the second pixel value of the second reference block, and the motion vector with the smallest cost value is set as the optimal motion vector. This is used to adjust the first original motion vector and the second original motion vector based on the optimal motion vector, and to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector. The initial motion vector is either the first original motion vector or the second original motion vector. SR represents the search range, and if the value of SR is 2, the search order for the 25 candidate motion vectors is {Mv(0,0), Mv(-2,-2), Mv(-1,-2), Mv(0,-2), Mv(1,-2), Mv(2,-2), Mv(-2,-1), Mv(-1,-1), Mv(0,-1), Mv(1,-1), Mv(2,-1), Mv(-2,0), Mv(-1,0), Mv(0,0), M {v(1,0), Mv(2,0), Mv(-2,1), Mv(-1,1), Mv(0,1), Mv(1,1), Mv(2,1), Mv(-2,2), Mv(-1,2), Mv(0,2), Mv(1,2), Mv(2,2)}, where Mv(0,0) is the initial motion vector, and the other candidate motion vectors, excluding Mv(0,0), are offset motion vectors of the initial motion vector. The motion compensation module adjusts the first original motion vector and the second original motion vector based on the optimal motion vector to obtain a first target motion vector corresponding to the first original motion vector and a second target motion vector corresponding to the second original motion vector, Based on the aforementioned optimal motion vector, a first integer pixel motion vector adjustment value is determined, and based on the aforementioned first integer pixel motion vector adjustment value, a second integer pixel motion vector adjustment value is determined. An encoding and decoding device characterized by being used to obtain a first target motion vector corresponding to the first original motion vector by adjusting the first original motion vector based on the first integer pixel motion vector adjustment value, and to obtain a second target motion vector corresponding to the second original motion vector by adjusting the second original motion vector based on the second integer pixel motion vector adjustment value.

7. An encoding device comprising a processor and a machine-readable storage medium, The machine-readable storage medium stores machine-executable instructions that can be executed by the processor. The encoding device is characterized in that the processor is used to carry out the method according to claim 1 by executing machine-executable instructions.

8. A decoding device comprising a processor and a machine-readable storage medium, The machine-readable storage medium stores machine-executable instructions that can be executed by the processor. The decoding device is characterized in that the processor is used to carry out the method according to claim 1 by executing machine-executable instructions.

Citation Information

Patent Citations

  • Motion vector refinement for multi-reference prediction

    WO2019001786A1

  • Partial cost calculation

    WO2019234672A1

  • Block size restrictions for dmvr

    WO2020008343A1

  • Sub-region based determination of motion information refinement

    WO2020228836A1

  • Methods and apparatuses for decoder-side motion vector refinement in video coding

    WO2020257365A1