Encoding and decoding method, apparatus, and device
Patent Information
- Application Number
- MYPI2021007014
- Authority / Receiving Office
- MY · MY
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-06-21
- Filing Date
- 2020-06-17
- Publication Date
- 2026-10-05
- Estimated Expiration
- 2040-06-17
AI Technical Summary
In video coding, the coding performance of bidirectional blocks is poor because the mirror symmetry present in predicted images from two different directions is not fully exploited.
By obtaining the first unidirectional motion information and the second unidirectional motion information of the current block, the original prediction value is determined, and the horizontal direction rate and vertical direction rate are calculated based on these values, and then the prediction compensation value is obtained, and finally the target prediction value is obtained.
The coding performance and coding efficiency are improved, especially in the application scenario of bidirectional blocks. The target prediction value is obtained through the optical flow method, which enhances the friendliness of hardware implementation.
Abstract
Description
A method, apparatus and device for encoding and decoding Technical Field
[0001] This application relates to the field of encoding and decoding technology, and in particular to an encoding and decoding method, apparatus and device. Background Technology
[0002] To save space, video images are encoded before transmission. A complete video coding method can include processes such as prediction, transform, quantization, entropy coding, and filtering. Among them, predictive coding can include intra-frame coding and inter-frame coding. Inter-frame coding utilizes the correlation in the temporal domain of the video, using pixels from neighboring encoded images to predict the pixels of the current image, thereby effectively removing temporal redundancy in the video.
[0003] In inter-frame coding, a motion vector (MV) can be used to represent the relative displacement between the current block of the current frame video image and the reference block of the reference frame video image. For example, if the current frame video image A and the reference frame video image B have a strong temporal correlation, when it is necessary to transmit image block A1 (the current block) of video image A, a motion search can be performed in video image B to find the image block B1 (i.e., the reference block) that best matches image block A1, and the relative displacement between image block A1 and image block B1 can be determined. This relative displacement is the motion vector of image block A1.
[0004] The encoder can send motion vectors to the decoder instead of sending image block A1. The decoder can then obtain image block A1 from the motion vectors and image block B1. Obviously, since the number of bits occupied by the motion vectors is much smaller than the number of bits occupied by image block A1, the above method can save a lot of bit overhead.
[0005] In traditional methods, when the current block is unidirectional, obtaining its motion information allows for encoding / decoding, thus improving coding performance. However, when the current block is bidirectional, obtaining its bidirectional motion information allows for the acquisition of prediction images from two different directions. These prediction images often exhibit mirror-symmetry, a characteristic not fully utilized in current coding frameworks to further remove redundancy. In other words, for bidirectional block applications, current methods suffer from relatively poor coding performance.
[0006] Summary of the Invention
[0007] This application provides an encoding / decoding method, apparatus, and device that can improve encoding performance.
[0008] This application provides an encoding / decoding method, the method comprising: if the feature information of the current block satisfies a specific condition, then performing the following steps to obtain the target prediction value of the current block or a sub-block of the current block:
[0009] A first original predicted value is determined based on the first unidirectional motion information of the current block; a second original predicted value is determined based on the second unidirectional motion information of the current block; the horizontal velocity is determined based on the first original predicted value and the second original predicted value; and the vertical velocity is determined based on the first original predicted value and the second original predicted value.
[0010] The predicted compensation value is obtained based on the horizontal velocity and the vertical velocity;
[0011] The target predicted value is obtained based on the first original predicted value, the second original predicted value, and the predicted compensation value.
[0012] This application provides an encoding / decoding apparatus, which is used to obtain a target prediction value of the current block or a sub-block of the current block if the feature information of the current block meets a specific condition. The apparatus includes:
[0013] The first determining module is used to determine a first original prediction value based on the first unidirectional motion information of the current block and a second original prediction value based on the second unidirectional motion information of the current block if the feature information of the current block meets specific conditions.
[0014] The second determining module is used to determine the horizontal velocity based on the first original predicted value and the second original predicted value; and to determine the vertical velocity based on the first original predicted value and the second original predicted value.
[0015] The first acquisition module is used to acquire a prediction compensation value based on the horizontal direction rate and the vertical direction rate;
[0016] The second acquisition module is used to acquire the target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
[0017] This application provides an encoding end device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to achieve the following steps: if the feature information of the current block meets specific conditions, then the following steps are performed to obtain a target prediction value of the current block or a sub-block of the current block: determining a first original prediction value based on a first unidirectional motion information of the current block, determining a second original prediction value based on a second unidirectional motion information of the current block; determining a horizontal velocity based on the first original prediction value and the second original prediction value; determining a vertical velocity based on the first original prediction value and the second original prediction value; obtaining a prediction compensation value based on the horizontal velocity and the vertical velocity; obtaining a target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
[0018] This application provides a decoding end device, including: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to achieve the following steps: if the feature information of the current block meets a specific condition, then the following steps are performed to obtain the target prediction value of the current block or a sub-block of the current block: determining a first original prediction value based on a first unidirectional motion information of the current block, determining a second original prediction value based on a second unidirectional motion information of the current block; determining a horizontal direction rate based on the first original prediction value and the second original prediction value; determining a vertical direction rate based on the first original prediction value and the second original prediction value; obtaining a prediction compensation value based on the horizontal direction rate and the vertical direction rate; obtaining a target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
[0019] As can be seen from the above technical solutions, in this embodiment, a first original prediction value can be determined based on the first unidirectional motion information of the current block, a second original prediction value can be determined based on the second unidirectional motion information of the current block, the horizontal and vertical velocities can be determined based on the first and second original prediction values, a prediction compensation value can be obtained based on the horizontal and vertical velocities, and a target prediction value can be obtained based on the prediction compensation value. This method can obtain the target prediction value of the current block or its sub-blocks based on optical flow, thereby improving hardware implementation friendliness and improving coding performance. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these accompanying drawings of the embodiments of this application.
[0021] Figure 1A is a schematic diagram of interpolation in one embodiment of this application;
[0022] Figure 1B is a schematic diagram of a video coding framework in one embodiment of this application;
[0023] Figure 2 is a flowchart of an encoding / decoding method according to one embodiment of this application;
[0024] Figure 3 is a flowchart of an encoding / decoding method according to one embodiment of this application;
[0025] Figure 4 is a schematic diagram of a reference block corresponding to a sub-block of the current block in one embodiment of this application;
[0026] Figure 5 is a structural diagram of an encoding / decoding device according to one embodiment of this application;
[0027] Figure 6 is a hardware structure diagram of a decoding device in one embodiment of this application;
[0028] Figure 7 is a hardware structure diagram of the encoding end device in one embodiment of this application. Detailed Implementation
[0029] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “the,” and “the” used in the embodiments and claims of this application are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to any or all possible combinations including one or more of the associated listed items. It should be understood that although the terms first, second, third, etc., may be used to describe various information in the embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of this application, and similarly, second information may also be referred to as first information. Furthermore, depending on the context, the word “if” used may be interpreted as “when…” or “in response to a determination.”
[0030] This application provides an encoding / decoding method, apparatus, and device, which may involve the following concepts:
[0031] Intra-prediction and inter-prediction techniques: Intra-prediction utilizes the spatial correlation of video to predict the current pixel using pixels from already coded blocks, thus removing spatial redundancy. Inter-prediction utilizes the temporal correlation of video; since video sequences contain strong temporal correlations, it uses pixels from neighboring coded images to predict pixels from the current image, effectively removing temporal redundancy. The inter-prediction portion of video coding standards generally employs block-based motion compensation techniques. The principle is to find the best matching block in previously coded images for each pixel block of the current image; this process is called motion estimation (ME).
[0032] Motion Vector (MV): In inter-frame coding, motion vectors can be used to represent the relative displacement between the current coded block and its best-matching block in the reference image. Each partitioned block has a corresponding motion vector that needs to be transmitted to the decoder. If the motion vector of each block is encoded and transmitted independently, especially when partitioning into small blocks, it consumes a considerable number of bits. To reduce the number of bits used to encode motion vectors, the spatial correlation between adjacent image blocks can be utilized. The motion vector of the current block to be encoded can be predicted based on the motion vectors of adjacent encoded blocks, and then the prediction difference can be encoded. This effectively reduces the number of bits used to represent motion vectors. In the process of encoding the motion vector of the current block, firstly, the motion vector of the current block is predicted using the motion vectors of adjacent encoded blocks. Then, the difference between the predicted value of the motion vector (MVP, Motion Vector Prediction) and the actual estimated value of the motion vector (MVD) can be encoded, thereby effectively reducing the number of bits used to encode MV.
[0033] Motion Information: Since motion vectors represent the positional offset of the current image patch relative to a reference image patch, in order to accurately obtain information pointing to the image patch, in addition to motion vectors, the index information of the reference frame image is also needed to indicate which reference frame image is used. In video coding techniques, a list of reference frames is usually established for the current frame image, and the reference frame image index information indicates which reference frame image in the list was used for the current image patch. Furthermore, many coding techniques support multiple reference image lists; therefore, an index value can also be used to indicate which reference image list was used. This index value can be called the reference direction. In video coding techniques, motion vectors, reference frame indices, reference directions, and other motion-related information can be collectively referred to as motion information.
[0034] Interpolation: If the current motion vector is not integer pixel precise, existing pixel values cannot be directly copied from the corresponding reference frame. The required pixel value is obtained through interpolation. As shown in Figure 1A, to obtain a pixel value Y with an offset of 1 / 2 pixel... 1 / 2 The value is obtained by interpolating the surrounding pixel values X. If an interpolation filter with N taps is used, the value is obtained by interpolating the surrounding N integer pixels. If the number of taps N is 8, then... a k These are the filter coefficients, i.e., the weighting coefficients.
[0035] Motion compensation: The process of motion compensation is to obtain the predicted pixel values of the current block through interpolation or copying.
[0036] Video coding framework: Referring to Figure 1B, the video coding framework can be used to implement the encoding-side processing flow of this application embodiment. Furthermore, the schematic diagram of the video decoding framework is similar to that in Figure 1B, and will not be repeated here. Moreover, the video decoding framework can be used to implement the decoding-side processing flow of this application embodiment. Specifically, the video coding framework and video decoding framework include modules such as intra-frame prediction, motion estimation / motion compensation, reference image buffer, intra-loop filtering, reconstruction, transform, quantization, inverse transform, inverse quantization, and entropy encoder. At the encoding end, the cooperation between these modules enables the encoding-side processing flow; at the decoding end, the cooperation between these modules enables the decoding-side processing flow.
[0037] In traditional methods, when the current block is a bidirectional block (i.e., the current block uses bidirectional prediction), the predicted images from two different directions often exhibit a mirror-symmetric relationship. Current coding frameworks do not fully utilize this characteristic to further remove redundancy, resulting in poor coding performance. To address this finding, this application proposes a prediction signal adjustment method based on optical flow when the current block is bidirectional. This method obtains the original prediction value based on the original motion information, and then obtains the prediction compensation value for the current block using the optical flow equation based on the original prediction value. Finally, it obtains the target prediction value for the current block based on this prediction compensation value and the original prediction value. This method can obtain the target prediction value for the current block based on optical flow, thereby improving hardware implementation friendliness and improving coding performance, i.e., improving both coding performance and coding efficiency.
[0038] The encoding and decoding methods in the embodiments of this application will be described in detail below with reference to several specific embodiments.
[0039] Example 1: Referring to Figure 2, which is a flowchart of the encoding / decoding method, this method can be applied to either the decoding or encoding end. The method obtains the target prediction value of the current block or its sub-blocks by executing the following steps. If the following steps are performed on the current block, the target prediction value of the current block can be obtained; if the current block is divided into at least one sub-block, and the following steps are performed on each sub-block of the current block, the target prediction value of the sub-block of the current block can be obtained. The method includes:
[0040] Step 201: If the feature information of the current block meets specific conditions, then determine the first original prediction value based on the first unidirectional motion information of the current block, and determine the second original prediction value based on the second unidirectional motion information of the current block.
[0041] For example, the current block can be a bidirectional block (i.e., the current block uses bidirectional prediction). This means the motion information corresponding to the current block is bidirectional motion information, which can include motion information in two different directions. These two different directions are referred to as the first unidirectional motion information and the second unidirectional motion information. The first unidirectional motion information can correspond to a first reference frame, which is located before the current frame in which the current block is located. The second unidirectional motion information can correspond to a second reference frame, which is located after the current frame in which the current block is located.
[0042] For example, the feature information may include, but is not limited to, one or more of the following: motion information attributes; prediction pattern attributes; size information; sequence-level switching control information. Of course, the above are just a few examples and are not intended to be limiting.
[0043] If the feature information includes motion information attributes, and the motion information attributes satisfy at least one of the following conditions, then the motion information attributes are determined to satisfy a specific condition: 1. The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions; 2. The current block includes multiple sub-blocks, and the motion information of the multiple sub-blocks is the same; 3. The current block uses bidirectional prediction, and the weighted weights of the two reference frames corresponding to the current block are the same; 4. The current block uses bidirectional prediction, and the distances between the two reference frames corresponding to the current block and the current frame are the same; 5. The current block uses bidirectional prediction, and the difference between the predicted values of the two reference frames corresponding to the current block is less than a preset threshold. Of course, the above are just a few examples and are not intended to limit the scope of the prediction.
[0044] For scenario 5, it is also necessary to obtain the difference between the predicted values of the two reference frames corresponding to the current block. To obtain this difference, the following method can be used: Obtain the first predicted block from the first reference frame based on the first unidirectional motion information of the current block, and obtain the second predicted block from the second reference frame based on the second unidirectional motion information of the current block; obtain the difference between the predicted values of the first and second reference frames based on the SAD (Sum of Difference) of the downsampled predicted values of the first and second predicted blocks. Alternatively, obtain the first predicted block from the first reference frame based on the first unidirectional motion information of the current block, and obtain the second predicted block from the second reference frame based on the second unidirectional motion information of the current block; obtain the difference between the predicted values of the first and second reference frames based on the SAD (Sum of Difference) of the predicted values of the first and second predicted blocks.
[0045] If the feature information includes prediction mode attributes, and the prediction mode attributes are a fusion mode that does not use intra-frame and inter-frame joint prediction, and / or a symmetric motion vector difference mode, then the prediction mode attributes are determined to meet specific conditions.
[0046] If the feature information includes sequence-level switch control information, and the sequence-level switch control information allows the current block to use bidirectional optical flow mode, then the sequence-level switch control information is determined to meet specific conditions.
[0047] If the feature information includes size information, and the size information includes at least one of a width value, a height value, and an area value, the size information satisfies a specific condition when at least one of the width value, height value, and area value in the size information meets a corresponding threshold condition. For example, the size information is determined to satisfy a specific condition when at least one of the following conditions is met: the width value of the current block is greater than or equal to a first threshold, and the width value of the current block is less than or equal to a second threshold; the height value of the current block is greater than or equal to a third threshold, and the height value of the current block is less than or equal to a fourth threshold; the area value of the current block is greater than or equal to a fifth threshold, and the area value of the current block is less than or equal to a sixth threshold. Of course, the above are just a few examples and are not intended to be limiting.
[0048] For example, the first threshold can be less than the second threshold, and both the first and second thresholds are positive integer powers of 2. There are no restrictions on either the first or second threshold; for example, the first threshold could be 8 and the second threshold could be 128. The third threshold can be less than the fourth threshold, and both the third and fourth thresholds are also positive integer powers of 2. There are no restrictions on either the third or fourth threshold; for example, the third threshold could be 8 and the fourth threshold could be 128. The fifth threshold can be less than the sixth threshold, and both the fifth and sixth thresholds are also positive integer powers of 2. There are no restrictions on either the fifth or sixth threshold; for example, the fifth threshold could be 64 (i.e., 8*8) and the sixth threshold could be 16384 (i.e., 128*128). Of course, the above thresholds are just examples, and there are no restrictions on these thresholds.
[0049] For example, the feature information may include one or more of motion information attributes, prediction mode attributes, size information, and sequence-level switch control information. When the feature information includes motion information attributes, the fact that the motion information attributes meet specific conditions indicates that the feature information meets specific conditions; when the feature information includes prediction mode attributes, the fact that the prediction mode attributes meet specific conditions indicates that the feature information meets specific conditions; when the feature information includes size information, the fact that the size information meets specific conditions indicates that the feature information meets specific conditions; and when the feature information includes sequence-level switch control information, the fact that the sequence-level switch control information meets specific conditions indicates that the feature information meets specific conditions.
[0050] When the feature information includes at least two of the following: motion information attributes, prediction mode attributes, size information, and sequence-level switch control information, for example, if the feature information includes both motion information attributes and prediction mode attributes, then it can be indicated that the feature information meets specific conditions if both the motion information attributes and prediction mode attributes meet specific conditions. As another example, if the feature information includes motion information attributes, size information, and sequence-level switch control information, then it can be indicated that the feature information meets specific conditions if all three conditions are met. Of course, the above processes are just a few examples and are not intended to be limiting.
[0051] For example, determining a first original prediction value based on the first unidirectional motion information of the current block, and determining a second original prediction value based on the second unidirectional motion information of the current block, may include, but is not limited to: determining a first reference block from a first reference frame based on the first unidirectional motion information of the current block, and determining a first original prediction value for the first reference block; the first original prediction value for the central region of the first reference block is obtained by interpolating pixel values in the first reference frame, and the first original prediction value for the edge region of the first reference block is obtained by copying pixel values in the first reference frame. Determining a second reference block from a second reference frame based on the second unidirectional motion information of the current block, and determining a second original prediction value for the second reference block; the second original prediction value for the central region of the second reference block is obtained by interpolating pixel values in the second reference frame, and the second original prediction value for the edge region of the second reference block is obtained by copying pixel values in the second reference frame.
[0052] For example, based on the first unidirectional motion information of the current block, the first reference block corresponding to the current block can be determined from the first reference frame. Assume the size of the current block is M*M, and the size of the first reference block is N*N, where N can be greater than M, such as M being 4 and N being 6. The first reference block can be divided into a central region and edge regions. The central region of the first reference block refers to the area of size M*M centered on the center point of the first reference block; the edge regions of the first reference block refer to the other regions within the first reference block besides the central region. For the central region of the first reference block, the first original predicted value is obtained by interpolating the pixel values in the first reference frame; for the edge regions of the first reference block, the first original predicted value is obtained by copying the pixel values in the first reference frame.
[0053] Based on the second unidirectional motion information of the current block, the corresponding second reference block can be determined from the second reference frame. Assume the current block is M*M in size, and the second reference block is N*N in size, where N can be greater than M (e.g., M = 4, N = 6). The second reference block can be divided into a central region and edge regions. The central region of the second reference block refers to the M*M area centered on the center point of the second reference block; the edge regions refer to all areas within the second reference block other than the central region. For the central region of the second reference block, the second original predicted value is obtained by interpolating the pixel values in the second reference frame; for the edge regions of the second reference block, the second original predicted value is obtained by copying the pixel values in the second reference frame.
[0054] For example, determining a first original prediction value based on the first unidirectional motion information of the current block, and determining a second original prediction value based on the second unidirectional motion information of the current block, may include, but is not limited to: determining a first reference block from a first reference frame based on the first unidirectional motion information of the current block, and determining a first original prediction value for the first reference block, wherein the first original prediction value is obtained by interpolating pixel values in the first reference frame. Determining a second reference block from a second reference frame based on the second unidirectional motion information of the current block, and determining a second original prediction value for the second reference block, wherein the second original prediction value is obtained by interpolating pixel values in the second reference frame. For example, based on the first unidirectional motion information of the current block, a first reference block corresponding to the current block can be determined from the first reference frame; assuming the size of the current block is M*M, the size of the first reference block can be M*M. Based on the second unidirectional motion information of the current block, a second reference block corresponding to the current block can be determined from the second reference frame; assuming the size of the current block is M*M, the size of the second reference block can be M*M.
[0055] Step 202: Determine the horizontal velocity based on the first and second original predicted values.
[0056] For example, the horizontal rate refers to the horizontal (X-direction) rate of the sub-block corresponding to the current block in the reference frame (i.e., the sub-block located in the reference frame that corresponds to the current block). Alternatively, it refers to the horizontal (X-direction) rate of the sub-block of the current block corresponding to the sub-block in the reference frame (i.e., the sub-block located in the reference frame that corresponds to the sub-block of the current block).
[0057] For example, the horizontal rate is determined based on a first original prediction value and a second original prediction value, including but not limited to:
[0058] Method 1: Determine the autocorrelation coefficient S1 of the horizontal gradient sum and the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum based on the first and second original predicted values. Then, determine the horizontal rate based on the autocorrelation coefficient S1, the rate threshold, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor.
[0059] Method 2: If the first preset condition is met, determine the cross-correlation coefficient S2 between the horizontal gradient sum and the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum, based on the first and second original predicted values; determine the horizontal rate based on the cross-correlation coefficient S2, the rate threshold, the cross-correlation coefficient S6, the first amplification factor, and the second amplification factor. If the first preset condition is not met, determine the autocorrelation coefficient S1 between the horizontal gradient sum and the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum, based on the first and second original predicted values; determine the horizontal rate based on the autocorrelation coefficient S1, the rate threshold, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor.
[0060] For example, the first preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5 of the vertical gradient.
[0061] Method 3: If the second preset condition is met, determine the autocorrelation coefficient S1 of the horizontal gradient sum, the cross-correlation coefficient S2 between the horizontal and vertical gradient sums, the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum, the autocorrelation coefficient S5 of the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first and second original predicted values; determine the horizontal rate based on the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, cross-correlation coefficient S6, rate threshold, first amplification factor, and second amplification factor. If the second preset condition is not met, determine the autocorrelation coefficient S1 of the horizontal gradient sum and the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum based on the first and second original predicted values; determine the horizontal rate based on the autocorrelation coefficient S1, rate threshold, cross-correlation coefficient S3, first amplification factor, and second amplification factor.
[0062] For example, the second preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5.
[0063] Step 203: Determine the vertical velocity based on the first and second original predicted values.
[0064] For example, the vertical rate refers to the vertical (Y-direction) rate of the corresponding sub-block of the current block in the reference frame (i.e., the sub-block located in the reference frame that corresponds to the current block). Alternatively, it refers to the vertical (Y-direction) rate of the corresponding sub-block of the current block in the reference frame (i.e., the sub-block located in the reference frame that corresponds to the sub-block of the current block).
[0065] For example, the vertical velocity is determined based on a first original prediction value and a second original prediction value, including but not limited to:
[0066] Method 1: Determine the cross-correlation coefficient S2 between the horizontal gradient sum and the vertical gradient sum, the autocorrelation coefficient S5 between the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first and second original predicted values. Then, the vertical rate can be determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the horizontal rate, the first amplification factor, and the second amplification factor.
[0067] Method 2: Obtain the untruncation horizontal velocity without truncation processing based on the first and second original prediction values, and determine the vertical velocity based on the untruncation horizontal velocity.
[0068] For example, the autocorrelation coefficient S1 of the horizontal gradient sum, the cross-correlation coefficient S2 between the horizontal and vertical gradient sums, the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum, the autocorrelation coefficient S5 of the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum can be determined based on the first and second original predicted values. Then, the untruncated horizontal velocity is determined based on the autocorrelation coefficient S1, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor, and the vertical velocity is determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the velocity threshold, the untruncated horizontal velocity, the first amplification factor, and the second amplification factor.
[0069] Method 3: When the third preset condition is met, determine the autocorrelation coefficient S5 of the vertical gradient sum and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first and second original predicted values. Then, determine the vertical rate based on the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the first amplification factor, and the second amplification factor. When the third preset condition is not met, determine the cross-correlation coefficient S2 between the horizontal and vertical gradient sums, the autocorrelation coefficient S5 of the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first and second original predicted values. Then, determine the vertical rate based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the horizontal rate, the first amplification factor, and the second amplification factor.
[0070] For example, the third preset condition can be determined based on the horizontal velocity.
[0071] In steps 202 and 203, the sum of horizontal gradients, the sum of vertical gradients, and the difference in time-domain predicted values can be determined based on the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor. Based on the sum of horizontal gradients, the sum of vertical gradients, and the difference in time-domain predicted values, the autocorrelation coefficient S1 of the sum of horizontal gradients, the cross-correlation coefficient S2 between the sum of horizontal gradients and the sum of vertical gradients, the cross-correlation coefficient S3 between the difference in time-domain predicted values and the sum of horizontal gradients, the autocorrelation coefficient S5 of the sum of vertical gradients, and the cross-correlation coefficient S6 between the difference in time-domain predicted values and the sum of vertical gradients can be determined.
[0072] For example, the cross-correlation coefficient S2 can be located between the first cross-correlation coefficient threshold and the second cross-correlation coefficient threshold; the cross-correlation coefficient S6 can be located between the third cross-correlation coefficient threshold and the fourth cross-correlation coefficient threshold.
[0073] For example, if the cross-correlation coefficient S2 obtained from the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is less than the first cross-correlation coefficient threshold, then the cross-correlation coefficient S2 is updated to the first cross-correlation coefficient threshold; if the cross-correlation coefficient S2 obtained from the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is greater than the second cross-correlation coefficient threshold, then the cross-correlation coefficient S2 is updated to the second cross-correlation coefficient threshold; if the cross-correlation coefficient S2 obtained from the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is greater than or equal to the first cross-correlation coefficient threshold and less than or equal to the second cross-correlation coefficient threshold, then the cross-correlation coefficient S2 remains unchanged.
[0074] If the cross-correlation coefficient S6 obtained based on the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is less than the third cross-correlation coefficient threshold, then the cross-correlation coefficient S6 is updated to the third cross-correlation coefficient threshold. If the cross-correlation coefficient S6 obtained based on the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is greater than the fourth cross-correlation coefficient threshold, then the cross-correlation coefficient S6 is updated to the fourth cross-correlation coefficient threshold. If the cross-correlation coefficient S6 obtained based on the first original predicted value, the second original predicted value, the first amplification factor, and the second amplification factor is greater than or equal to the third cross-correlation coefficient threshold and less than or equal to the fourth cross-correlation coefficient threshold, then the cross-correlation coefficient S6 remains unchanged.
[0075] For example, the first magnification factor can be the smaller of 5 and (BD-7), or the larger of 1 and (BD-11). Of course, the above are just examples of the first magnification factor, and there is no limitation on it; it can be configured based on experience.
[0076] For example, the second magnification factor can be the smaller of 8 and (BD-4), or the larger of 4 and (BD-8). Of course, the above are just examples of the second magnification factor, and there is no limitation on it; it can be configured based on experience.
[0077] For example, the rate threshold can be 2 to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7). Of course, the above are just examples of rate thresholds and are not restrictive; they can be configured based on experience.
[0078] For example, BD (bit depth) is the bit depth, which represents the bit width required for each chroma or luminance pixel value.
[0079] Step 204: Obtain the predicted compensation value based on the horizontal and vertical velocities.
[0080] For example, obtaining the prediction compensation value based on the horizontal and vertical velocities may include, but is not limited to: determining the horizontal and vertical gradients based on the first original prediction value, the second original prediction value, and the number of gradient right shifts, and obtaining the prediction compensation value based on the horizontal velocities, the vertical velocities, the horizontal gradients, and the vertical gradients.
[0081] For example, the number of bits for the gradient right shift can be the larger of 2 and (14-BD), or the larger of 6 and (BD-6). Of course, the above are just examples of the number of bits for the gradient right shift, and there is no limitation on this; it can be configured based on experience.
[0082] Step 205: Obtain the target predicted value based on the first original predicted value, the second original predicted value, and the predicted compensation value.
[0083] For example, if the above method is used to obtain the target prediction value of the current block, then: if the feature information of the current block meets specific conditions, then a first original prediction value corresponding to the current block is determined based on the first unidirectional motion information of the current block, and a second original prediction value corresponding to the current block is determined based on the second unidirectional motion information of the current block. The horizontal velocity corresponding to the current block is determined based on the first and second original prediction values, and the vertical velocity corresponding to the current block is determined based on the first and second original prediction values. Then, a prediction compensation value corresponding to the current block is obtained based on the horizontal and vertical velocities, and the target prediction value corresponding to the current block is obtained based on the first, second, and prediction compensation values. Thus, the target prediction value corresponding to the current block is successfully obtained.
[0084] For example, if the current block is divided into at least one sub-block, and the above method is used to obtain the target prediction value of each sub-block of the current block, then: if the feature information of the current block satisfies a specific condition, for each sub-block of the current block, a first original prediction value corresponding to the sub-block is determined based on the first unidirectional motion information of the sub-block (which is the same as the first unidirectional motion information of the current block), and a second original prediction value corresponding to the sub-block is determined based on the second unidirectional motion information of the sub-block (which is the same as the second unidirectional motion information of the current block). The horizontal velocity corresponding to the sub-block is determined based on the first and second original prediction values, and the vertical velocity corresponding to the sub-block is determined based on the first and second original prediction values. Then, the prediction compensation value corresponding to the sub-block is obtained based on the horizontal and vertical velocities, and the target prediction value corresponding to the sub-block is obtained based on the first, second, and prediction compensation values.
[0085] At this point, the target prediction value corresponding to the sub-block has been successfully obtained. After obtaining the target prediction value of each sub-block of the current block, the target prediction value of the current block is essentially obtained.
[0086] As can be seen from the above technical solutions, in this embodiment, a first original prediction value can be determined based on the first unidirectional motion information of the current block, a second original prediction value can be determined based on the second unidirectional motion information of the current block, the horizontal and vertical velocities can be determined based on the first and second original prediction values, a prediction compensation value can be obtained based on the horizontal and vertical velocities, and a target prediction value can be obtained based on the prediction compensation value. This method can obtain the target prediction value of the current block or its sub-blocks based on optical flow, thereby improving hardware implementation friendliness and improving coding performance.
[0087] Example 2: This application proposes an encoding / decoding method that can be applied to either the decoding or encoding end. See Figure 3, which is a flowchart illustrating the encoding / decoding method. For example, if the feature information of the current block meets specific conditions, the following steps can be performed for each sub-block of the current block to obtain the target prediction value for each sub-block.
[0088] Step 301: If the feature information of the current block meets specific conditions, then determine the first original prediction value of the sub-block based on the first unidirectional motion information of the current block (i.e., the first unidirectional motion information of the sub-blocks of the current block), and determine the second original prediction value of the sub-block based on the second unidirectional motion information of the current block (i.e., the second unidirectional motion information of the sub-blocks of the current block).
[0089] For example, if the current block is a bidirectional block (i.e., the current block uses bidirectional prediction), then the bidirectional motion information corresponding to the current block can be obtained, and there are no restrictions on the method of obtaining this information. This bidirectional motion information includes motion information in two different directions, referred to as the first unidirectional motion information (such as the first motion vector and the first reference frame index) and the second unidirectional motion information (such as the second motion vector and the second reference frame index). Based on the first unidirectional motion information, the first reference frame (such as reference frame 0) can be determined, and the first reference frame is located before the current frame in which the current block is located; based on the second unidirectional motion information, the second reference frame (such as reference frame 1) can be determined, and the second reference frame is located after the current frame in which the current block is located.
[0090] For example, for each sub-block of the current block, the first unidirectional motion information of the sub-block is the same as the first unidirectional motion information of the current block, and the second unidirectional motion information of the sub-block is the same as the second unidirectional motion information of the current block.
[0091] For example, the feature information may include one or more of the following: motion information attributes; prediction pattern attributes; size information; sequence-level switch control information. For details on whether the feature information meets specific conditions, please refer to step 201, which will not be repeated here.
[0092] For example, determining a first original prediction value for a sub-block based on the first unidirectional motion information of the current block, and determining a second original prediction value for the sub-block based on the second unidirectional motion information of the current block, may include: determining a first reference block corresponding to the sub-block of the current block from a first reference frame based on the first unidirectional motion information of the current block, and determining a first original prediction value I for the first reference block. (0) (x, y); Based on the second unidirectional motion information of the current block, determine the second reference block corresponding to the sub-block of the current block from the second reference frame, and determine the second original prediction value I of the second reference block. (1) (x, y). The method for determining the first and second original predicted values can be found in step 201, and will not be repeated here.
[0093] Step 302: Determine the sum of horizontal gradients, the sum of vertical gradients, and the difference in temporal predicted values based on the first and second original predicted values of the sub-block. For example, determine the sum of horizontal gradients, the sum of vertical gradients, and the difference in temporal predicted values based on the first and second original predicted values of the sub-block, the first magnification factor, and the second magnification factor.
[0094] Step 303: Based on the sum of horizontal gradients, the sum of vertical gradients, and the difference in time-domain predicted values, determine the autocorrelation coefficient S1 (hereinafter referred to as autocorrelation coefficient S1) of the sum of horizontal gradients, the cross-correlation coefficient S2 (hereinafter referred to as cross-correlation coefficient S2) between the sum of horizontal gradients and the sum of vertical gradients, the cross-correlation coefficient S3 (hereinafter referred to as cross-correlation coefficient S3) between the difference in time-domain predicted values and the sum of horizontal gradients, the autocorrelation coefficient S5 (hereinafter referred to as autocorrelation coefficient S5) of the sum of vertical gradients, and the cross-correlation coefficient S6 (hereinafter referred to as cross-correlation coefficient S6) between the difference in time-domain predicted values and the sum of vertical gradients.
[0095] Step 304: Determine the horizontal velocity of the corresponding sub-block in the reference frame based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0096] Step 305: Determine the vertical velocity of the corresponding sub-block in the reference frame based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0097] Step 306: Obtain the predicted compensation value of the sub-blocks of the current block based on the horizontal and vertical velocities.
[0098] Step 307: Obtain the target prediction value of the sub-block of the current block based on the first original prediction value of the sub-block of the current block, the second original prediction value of the sub-block of the current block, and the prediction compensation value of the sub-block of the current block.
[0099] For example, the process of steps 301-307 can be found in Embodiment 1, and will not be repeated here.
[0100] Example 3: The encoder / decoder needs to determine whether the feature information of the current block meets specific conditions. If so, the technical solution of this application embodiment is adopted to obtain the target prediction value of the current block or its sub-blocks. This technical solution can also be called a bidirectional optical flow mode. If not, the target prediction value acquisition method proposed in this application is not required.
[0101] The feature information of the current block is determined to satisfy a specific condition when the feature information satisfies at least the following conditions simultaneously.
[0102] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0103] The current block's dimensions (such as width, height, and area) are within the specified range.
[0104] Example 4: When the feature information satisfies at least the following conditions simultaneously, it is determined that the feature information of the current block satisfies a specific condition.
[0105] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0106] The current block's dimensions (such as width, height, and area) are within the specified range;
[0107] The current block includes multiple sub-blocks, and the motion information of all sub-blocks is the same. In other words, the motion information of each sub-block in the current block can be exactly the same, meaning that the current block does not adopt the sub-block motion information mode.
[0108] For example, the current block not using a sub-block motion information mode can include: the current block not using the Affine mode or the SBTMVP mode; the Affine mode uses an affine motion model, while the SBTMVP (subblock-based temporal motion vector prediction) mode acquires the motion information of the entire block in the time domain. When the current block uses the Affine mode or the SBTMVP mode, the motion information of each sub-block within the current block is likely not entirely the same; therefore, the current block may not use the Affine mode or the SBTMVP mode.
[0109] Example 5: When the feature information satisfies at least the following conditions simultaneously, it is determined that the feature information of the current block satisfies a specific condition.
[0110] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0111] The current block's dimensions (such as width, height, and area) are within the specified range;
[0112] The current block includes multiple sub-blocks, and the motion information of all sub-blocks is the same. In other words, the motion information of each sub-block in the current block can be exactly the same, meaning that the current block does not adopt the sub-block motion information mode.
[0113] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weight.
[0114] Example 6: When the feature information satisfies at least the following conditions simultaneously, it is determined that the feature information of the current block satisfies a specific condition.
[0115] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0116] The current block's dimensions (such as width, height, and area) are within the specified range;
[0117] The current block includes multiple sub-blocks, and the motion information of all sub-blocks is the same. In other words, the motion information of each sub-block in the current block can be exactly the same, meaning that the current block does not adopt the sub-block motion information mode.
[0118] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weight.
[0119] The current block does not use CIIP mode (combine intra-inter prediction mode).
[0120] Example 7: When the feature information satisfies at least the following conditions simultaneously, it is determined that the feature information of the current block satisfies a specific condition.
[0121] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0122] The current block's dimensions (such as width, height, and area) are within the specified range;
[0123] The current block includes multiple sub-blocks, and the motion information of all sub-blocks is the same. In other words, the motion information of each sub-block in the current block can be exactly the same, meaning that the current block does not adopt the sub-block motion information mode.
[0124] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weight.
[0125] The current block does not use the SMVD (Symmetric Motion Vector Difference) mode. In the SMVD mode, the two MVDs in the bidirectional motion information are symmetrical, that is, only one motion vector difference MVD needs to be encoded, and the other motion vector difference is a negative MVD.
[0126] Example 8: When the feature information satisfies at least the following conditions simultaneously, it is determined that the feature information of the current block satisfies a specific condition.
[0127] The sequence-level switch control information indicates that the current block is allowed to use bidirectional optical flow mode. In other words, the sequence-level control enables bidirectional optical flow mode, meaning that the sequence-level control switch is on, indicating that the current block is allowed to use bidirectional optical flow mode.
[0128] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions. That is, one reference frame corresponding to the current block is located before the current frame, and the other reference frame corresponding to the current block is located after the current frame.
[0129] The current block's dimensions (such as width, height, and area) are within the specified range;
[0130] The current block includes multiple sub-blocks, and the motion information of all sub-blocks is the same. In other words, the motion information of each sub-block in the current block can be exactly the same, meaning that the current block does not adopt the sub-block motion information mode.
[0131] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weight.
[0132] Example 9: Modify the condition "The current block uses bidirectional prediction and the two reference frames corresponding to the current block come from different directions" in any of Examples 3-8 above to "The current block uses bidirectional prediction and the two reference frames corresponding to the current block come from different directions, and the two reference frames corresponding to the current block are at the same distance from the current frame".
[0133] For example, if the display sequence number of the current frame is POC, and the display sequence numbers of the two reference frames corresponding to the current block are POC0 and POC1 respectively, then the two reference frames come from different directions, which is equivalent to (POC-POC0)*(POC-POC1)<0. The two reference frames are at the same distance from the current frame, which is equivalent to the value of (POC-POC0) being equal to the value of (POC1-POC).
[0134] Example 10: When the feature information satisfies at least the following conditions, it is determined that the feature information of the current block satisfies a specific condition.
[0135] The sequence-level switch control information indicates that the current block is allowed to use bidirectional optical flow mode. In other words, the sequence-level control enables bidirectional optical flow mode, meaning that the sequence-level control switch is on, indicating that the current block is allowed to use bidirectional optical flow mode.
[0136] Example 11: When the feature information satisfies at least the following conditions, it is determined that the feature information of the current block satisfies a specific condition.
[0137] The current block uses bidirectional prediction, and the difference between the predicted values of the two reference frames corresponding to the current block can be less than a preset threshold TH_SAD. For example, the difference between the predicted values of the two reference frames corresponding to the current block can be obtained as follows:
[0138] Method 1: Obtain the first prediction block corresponding to the sub-block of the current block from the first reference frame based on the first unidirectional motion information of the current block, and obtain the second prediction block corresponding to the sub-block of the current block from the second reference frame based on the second unidirectional motion information of the current block; obtain the difference value between the prediction values of the first reference frame and the second reference frame based on the SAD (Sum of Absolute Difference) of the prediction values of the first prediction block and the prediction values of the second prediction block.
[0139] In Method 1, the difference in predicted values is the SAD (Sum of Aspects) between the predicted values of the first prediction block (hereinafter referred to as pred0) and the predicted values of the second prediction block (hereinafter referred to as pred1), which is the SAD of all pixels in pred0 and pred1. For example, the difference in predicted values between the first reference frame and the second reference frame can be determined by the following formula, in which pred0(i,j) is the predicted value of pred0 in the i-th column and j-th row of pred0, pred1(i,j) is the predicted value of pred1 in the i-th column and j-th row of pred1, n is the total number of pixels, abs(x) represents the absolute value of x, H represents the height value, and W represents the width value.
[0140]
[0141] Method 2: Obtain the first prediction block corresponding to the sub-block of the current block from the first reference frame based on the first unidirectional motion information of the current block, and obtain the second prediction block corresponding to the sub-block of the current block from the second reference frame based on the second unidirectional motion information of the current block; obtain the difference value between the prediction values of the first reference frame and the second reference frame based on the SAD of the downsampled prediction value of the first prediction block (i.e., the prediction value obtained after downsampling the prediction value of the first prediction block) and the downsampled prediction value of the second prediction block (i.e., the prediction value obtained after downsampling the prediction value of the second prediction block).
[0142] In Method 2, the difference in predicted values is the SAD of the predicted value after downsampling the first prediction block by N times (hereinafter referred to as pred0) and the predicted value after downsampling the second prediction block by N times (hereinafter referred to as pred1). For example, the difference in predicted values between the first reference frame and the second reference frame can be determined by the following formula, in which pred0(i,j) is the predicted value of pred0 in the i-th column and j-th row of pred0, pred1(i,j) is the predicted value of pred1 in the i-th column and j-th row of pred1, n is the total number of pixels, abs(x) represents the absolute value of x, H represents the height value, W represents the width value, and N is a positive integer, preferably 2.
[0143]
[0144] Example 12: In the above examples, the size information of the current block is within a limited range, which can be one of the following:
[0145] Case 1: The width of the current block is within the first interval [Wmin, Wmax]; the height of the current block is within the second interval [Hmin, Hmax]; Wmin, Wmax, Hmin, and Hmax are all positive integer powers of 2; for example, Wmin is 8, Wmax is 128, Hmin is 8, and Hmax is 128.
[0146] The area value of the current block is within the range of the third interval [Smin, Smax]; Smin and Smax are both positive integer powers of 2; for example, Smin is 64, and Smax is 128*128=16384.
[0147] In the above embodiments, [a, b] means greater than or equal to a and less than or equal to b.
[0148] Case 2: The width of the current block is within the first interval [Wmin, Wmax]; Wmin and Wmax are both positive integer powers of 2; for example, Wmin is 8 and Wmax is 128.
[0149] Case 3: The height of the current block is within the range of the second interval [Hmin, Hmax]; Hmin and Hmax are both positive integer powers of 2; for example, Hmin is 8 and Hmax is 128.
[0150] For example, the weighted weights of the two reference frames corresponding to the current block are the same if any of the following conditions are met:
[0151] Condition 1: The current block does not use a method that allows different weightings.
[0152] Condition 2: The current block is allowed to use different weighting methods (such as enabling the block-level weighted prediction method BCW (Bi-prediction with CU based weighting)), and the two weightings of the current block are exactly the same.
[0153] Condition 3: The current frame containing the current block does not use a method with different weighting weights.
[0154] Condition 4: The current frame containing the current block is allowed to use different weighting methods (such as enabling frame-level weighted prediction method), and the two weighting weights of the current frame are exactly the same.
[0155] Example 13: The encoder / decoder needs to determine the first original prediction value of the sub-block based on the first unidirectional motion information of the current block, and determine the second original prediction value of the sub-block based on the second unidirectional motion information of the current block. For example, based on the first unidirectional motion information of the current block, a first reference block corresponding to the sub-block of the current block is determined from the first reference frame, and the first original prediction value I of the first reference block is determined. (0) (x, y); Based on the second unidirectional motion information of the current block, determine the second reference block corresponding to the sub-block of the current block from the second reference frame, and determine the second original prediction value I of the second reference block. (1) (x, y).
[0156] For example, based on the first unidirectional motion information of the current block, a first reference block is determined from the first reference frame, and a first original prediction value I of the first reference block is determined. (0) (x, y); the first original prediction value I of the central region of the first reference block. (0) (x, y) is obtained by interpolating the pixel values in the first reference frame, and is the first original predicted value I of the edge region of the first reference block. (0) (x, y) are obtained by copying the pixel values from the first reference frame. Based on the second unidirectional motion information of the current block, a second reference block is determined from the second reference frame, and a second original prediction value I for the second reference block is determined. (1) (x, y); the second original prediction value I of the central region of the second reference block. (1) (x, y) is obtained by interpolating the pixel values in the second reference frame, representing the second original prediction value I of the edge region of the second reference block. (1) (x, y) is obtained by copying the pixel values in the second reference frame.
[0157] Referring to Figure 4, assuming the sub-block size is 4*4 and the first reference block size is 6*6, the central region of the first reference block refers to the 4*4 area centered on the center point of the first reference block. The first original predicted value of the central region of the first reference block is obtained by interpolating the pixel values in the first reference frame, which will not be elaborated further. The edge region of the first reference block refers to the other regions in the first reference block besides the central region (i.e., the area outside the central region, with one row and one column on each side). The first original predicted value of the edge region of the first reference block is obtained by copying the pixel values in the first reference frame. Figure 4 shows the copying of pixel values from the first reference frame to the edge region of the first reference block. Of course, Figure 4 is just an example; pixel values from other pixels can also be used for copying.
[0158] Obviously, in the above method, the edge region of the first reference block can be obtained by copying the nearest integer pixel value in the first reference frame, so as to avoid the additional interpolation process and indirectly avoid accessing additional reference pixels.
[0159] Regarding the second original predicted value of the central region of the second reference block and the second original predicted value of the edge region of the second reference block, the process of obtaining the second original predicted value can be referred to the process of obtaining the first original predicted value, and will not be repeated here.
[0160] For example, based on the first unidirectional motion information of the current block, a first reference block is determined from the first reference frame, and a first original prediction value for the first reference block is determined. The first original prediction value for the first reference block is obtained by interpolating the pixel values in the first reference frame. Based on the second unidirectional motion information of the current block, a second reference block is determined from the second reference frame, and a second original prediction value for the second reference block is determined. The second original prediction value for the second reference block is obtained by interpolating the pixel values in the second reference frame. For example, assuming the size of the sub-block is 4*4, the size of the first reference block is 4*4, and the size of the second reference block is 4*4, the first original prediction values for all regions of the first reference block are obtained by interpolating the pixel values in the first reference frame, and the first original prediction values for all regions of the second reference block are also obtained by interpolating the pixel values in the first reference frame.
[0161] Example 14: After obtaining the first and second original prediction values of a sub-block, the encoder / decoder determines the sum of horizontal gradients, the sum of vertical gradients, and the difference in temporal prediction values based on the first and second original prediction values of the sub-block. For example, the sum of horizontal gradients, the sum of vertical gradients, and the difference in temporal prediction values are determined based on the first and second original prediction values of the sub-block, the first amplification factor, and the second amplification factor. For example, the sum of horizontal gradients is determined by formula (1), the sum of vertical gradients is determined by formula (2), and the difference in temporal prediction values is determined by formula (3).
[0162]
[0163]
[0164] θ(i,j)=(I (1) (i, j) >> n b )-(I (0) (i, j) >> n b (3)
[0165] For example, Represents the gradient in the horizontal direction. The gradient in the vertical direction is represented by the following parameters in formulas (1)-(3): and It can be determined by method (4) and formula (5).
[0166]
[0167]
[0168] ψ x (i, j) represents the gradient in the horizontal direction, and ψ y (i,j) represents the vertical gradient sum, and θ(i,j) represents the difference between the time-domain predicted values.
[0169] I (0) (x, y) represents the first original predicted value of the sub-block, I (1) (x, y) represents the second original prediction value of the sub-block. Assuming the sub-block size is 4*4, see Example 13, I. (0) (x, y) is the first raw prediction value of the first reference block of size 4*4, or the first raw prediction value of the first reference block of size 6*6. (1) (x, y) is the second original prediction value of a second reference block of size 4*4, or the second original prediction value of a second reference block of size 6*6, denoted by I. (0) (x, y) is the first original prediction value of the first reference block of size 4*4, I (1) (x, y) is taken as an example, where (x, y) is the second original prediction value of a second reference block of size 4*4. (k) (i, j) represents the pixel value at coordinates (i, j), such as I (0) (i, j) represents the pixel value at coordinate (i, j) in the first reference block, corresponding to the first original predicted value of the sub-block, I (1) (i, j) represents the pixel value at coordinate (i, j) in the second reference block, corresponding to the second original prediction value of the sub-block.
[0170] n a This can represent the first magnification factor, where n is the first magnification factor. a It can be the smaller of 5 and (BD-7), or the larger of 1 and (BD-11). b This can represent the second magnification factor, where n is the second magnification factor. b It can be the smaller of 8 and (BD-4), or the larger of 4 and (BD-8). shift1 can represent the number of right shifts of the gradient, which can be the larger of 2 and (14-BD), or the larger of 6 and (BD-6).
[0171] >> indicates a right shift, such as >>n a This indicates a right shift of n. a That is, n divided by 2 a Power of n a This indicates a right shift of n. b That is to say, n divided by 2 b The term "power" means to shift right by 1 (shift1), which is equivalent to dividing by 2 raised to the power of shift1.
[0172] BD (bit depth) can be represented as the bit width required for each chroma or luminance pixel value. For example, BD can be 10 or 8, and usually, BD can be a known value.
[0173] Example 15: After obtaining the sum of horizontal gradients, the sum of vertical gradients, and the difference in temporal predicted values, the encoder / decoder can further determine the following based on the sum of horizontal gradients, including the autocorrelation coefficient S1 (hereinafter referred to as autocorrelation coefficient S1), the cross-correlation coefficient S2 (hereinafter referred to as cross-correlation coefficient S2) between the sum of horizontal and vertical gradients, the cross-correlation coefficient S3 (hereinafter referred to as cross-correlation coefficient S3) between the difference in temporal predicted values and the sum of horizontal gradients, the autocorrelation coefficient S5 (hereinafter referred to as autocorrelation coefficient S5) between the sum of vertical gradients, and the cross-correlation coefficient S6 (hereinafter referred to as cross-correlation coefficient S6) between the difference in temporal predicted values and the sum of vertical gradients. For example, the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6 can be determined using the following formulas.
[0174] S1=∑ (i,j)∈Ω ψ x (i, j)·ψ x (i, j) (6)
[0175] S2=∑ (i,j)∈Ω ψ x (i, j)·ψ y (i, j) (7)
[0176] S3=∑ (i,j)∈Ω θ(i,j)·ψ x (i, j) (8)
[0177] S5=∑ (i,j)∈Ω ψ y (i, j)·ψ y (i, j) (9)
[0178] S6=∑ (i,j)∈Ω θ(i,j)·ψ y (i, j) (10)
[0179] ψ x (i, j) represents the gradient in the horizontal direction, and ψ y (i,j) represents the vertical gradient sum, and θ(i,j) represents the difference between the time-domain predicted values.
[0180] Assuming the size of the sub-block is 4x4, Ω represents the window corresponding to the 4x4 sub-block, or Ω represents the 6x6 window surrounding the 4x4 sub-block. For each coordinate point (i, j) in Ω, ψ can be determined first using the above example. x (i, j), ψ y (i, j) and θ(i, j), then, according to ψ x (i, j), ψ y Given (i, j) and θ(i, j), determine S1, S2, S3, S5, and S6.
[0181] Example 16: After obtaining the cross-correlation coefficients S2 and S6, the cross-correlation coefficient S2 can be restricted between a first cross-correlation coefficient threshold and a second cross-correlation coefficient threshold. For example, if the cross-correlation coefficient S2 is less than the first cross-correlation coefficient threshold, it can be updated to the first cross-correlation coefficient threshold; if the cross-correlation coefficient S2 is greater than the second cross-correlation coefficient threshold, it can be updated to the second cross-correlation coefficient threshold. The cross-correlation coefficient S6 can be restricted between a third cross-correlation coefficient threshold and a fourth cross-correlation coefficient threshold. For example, if the cross-correlation coefficient S6 is less than the third cross-correlation coefficient threshold, it can be updated to the third cross-correlation coefficient threshold; if the cross-correlation coefficient S6 is greater than the fourth cross-correlation coefficient threshold, it can be updated to the fourth cross-correlation coefficient threshold. The first cross-correlation coefficient threshold can be less than the second cross-correlation coefficient threshold, and the third cross-correlation coefficient threshold can be less than the fourth cross-correlation coefficient threshold.
[0182] For example, the cross-correlation coefficients S2 and S6 can be limited as follows to prevent intermediate results from overflowing, ensuring that the bit width does not exceed a certain range. -(1 << THS2) represents the first cross-correlation coefficient threshold, 1 << THS2 represents the second cross-correlation coefficient threshold, -(1 << THS6) represents the third cross-correlation coefficient threshold, and 1 << THS6 represents the fourth cross-correlation coefficient threshold. For instance, to prevent the bit width from exceeding 32 bits, THS2 can be 25 and THS6 can be 27. Of course, the above values are merely an example and are not intended to be limiting.
[0183] S2=clip3(-(1<<THS2), (1<<THS2), S2) (11)
[0184] S6=clip3(-(1<<THS6), (1<<THS6), S6) (12)
[0185] Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. Therefore, formula (11) means that if S2 is less than -(1 << THS2), then S2 is -(1 << THS2); if S2 is greater than (1 << THS2), then S2 is (1 << THS2); otherwise, S2 remains unchanged. Similarly, formula (12) means that if S6 is less than -(1 << THS6), then S6 is -(1 << THS6); if S6 is greater than (1 << THS6), then S6 is (1 << THS6); otherwise, S6 remains unchanged. << indicates a left shift.
[0186] Example 17: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the horizontal velocity of the corresponding sub-block in the reference frame can be determined based on one or more of these coefficients. The vertical velocity of the corresponding sub-block in the reference frame can also be determined based on one or more of these coefficients.
[0187] For example, the horizontal speed can be determined based on the autocorrelation coefficient S1, the speed threshold, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor, as shown in the following formula, which is an example of determining the horizontal speed based on the above parameters.
[0188]
[0189] In the above formula, if S1 > 0 holds true, then If S1 > 0 is not true, then v x =0. v x th′ represents the horizontal velocity. BIO This represents the rate threshold, which is used to set the horizontal rate v. x Restricted to -th′ BIO with th′ BIO Between, i.e., the horizontal velocity v x Greater than or equal to -th′ BIO Horizontal velocity v x Less than or equal to th′ BIO Rate threshold th′ BIOIt can be 2 raised to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7). For example, th′ BIO =2 13-BD Or th′ BIO =2max(5, BD-7), where BD is the bit depth.
[0190] n a This can represent the first magnification factor, where n is the first magnification factor. a It can be the smaller of 5 and (BD-7), or the larger of 1 and (BD-11). b This can represent the second magnification factor, where n is the second magnification factor. b It can be the smaller of 8 and (BD-4), or the larger of 4 and (BD-8). >> indicates a right shift. This is for rounding down.
[0191] First magnification factor n a Second amplification factor n b All can be configured based on experience, with the second amplification factor n b It can be greater than the first amplification factor n a First amplification factor n a Second amplification factor n b Used to amplify the horizontal velocity v x The range of values for n, for example, assuming n b -n a If it is 3, then If the value is 8, then the horizontal velocity v can be... x The range of values for n is magnified by 8 times, assuming n b -n a If it is 4, then If the value is 16, then the horizontal velocity v can be... x The range of values is magnified by 16 times, and so on.
[0192] Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIO Then the horizontal speed v x for
[0193] For example, the vertical velocity can be determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the velocity threshold, the horizontal velocity, the first amplification factor, and the second amplification factor, as shown in the following formula.
[0194]
[0195] As can be seen from the above formula, if S5 > 0 holds, then If S5 > 0 is not true, then v y =0.
[0196] v y V represents the vertical velocity. x th′ represents the horizontal velocity. BIO This represents the rate threshold, used to limit the vertical rate to -th′. BIO with th′ BIO Between, that is, the vertical velocity is greater than or equal to -th′ BIO The vertical velocity is less than or equal to th′ BIO Rate threshold th′ BIO It can be 2 raised to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7). For example, th′ BIO =2 13-BD Or th′ BIO =2max(5, BD-7), where BD is the bit depth.
[0197] n a This can represent the first magnification factor, where n is the first magnification factor. a It can be the smaller of 5 and (BD-7), or the larger of 1 and (BD-11). b This can represent the second magnification factor, where n is the second magnification factor. b It can be the smaller of 8 and (BD-4), or the larger of 4 and (BD-8). >> indicates a right shift. This is for rounding down.
[0198] First magnification factor n a Second amplification factor n b All can be configured based on experience, with the second amplification factor n b It can be greater than the first amplification factor n a First amplification factor n a Second amplification factor n b Used to amplify the vertical velocity v y The range of values for n, for example, assuming n b -n a If it is 3, then If the value is 8, then the vertical velocity v can be... y The range of values for n is magnified by 8 times, assuming n b -n a If it is 4, then If the value is 16, then the vertical velocity v can be... y The range of values is magnified by 16 times, and so on.
[0199] Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIO Then the vertical velocity v y for
[0200] For example, in the formula above,
[0201] Example 18: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the horizontal velocity of the corresponding sub-block in the reference frame can be determined based on one or more of these coefficients. The vertical velocity of the corresponding sub-block in the reference frame can also be determined based on one or more of these coefficients.
[0202] For example, the horizontal speed can be determined based on the autocorrelation coefficient S1, the speed threshold, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor, as shown in the following formula, which is an example of determining the horizontal speed based on the above parameters.
[0203]
[0204] Compared with formula (13), formula (15) removes the... The negative sign at the beginning, and the other contents are the same as in formula (13), and the meaning of each parameter is also the same as in formula (13), so they will not be repeated here.
[0205] For example, the vertical velocity can be determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the velocity threshold, the horizontal velocity, the first amplification factor, and the second amplification factor, as shown in the following formula.
[0206]
[0207] Compared with formula (14), formula (16) removes The negative sign at the beginning, the rest of the content is the same as formula (14), and the meaning of each parameter is also the same as formula (14), so it will not be repeated here.
[0208] Example 19: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the horizontal velocity of the corresponding sub-block in the reference frame can be determined based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0209] For example, if the first preset condition is met, the horizontal speed can be determined based on the cross-correlation coefficient S2, the rate threshold, the cross-correlation coefficient S6, the first amplification factor, and the second amplification factor. If the first preset condition is not met, the horizontal speed can be determined based on the autocorrelation coefficient S1, the rate threshold, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor. The first preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5, as shown in the following formula:
[0210] When the first preset condition is met
[0211]
[0212] When the first preset condition is not met
[0213]
[0214] The first preset condition mentioned above may include: |S2|>k|S5|, where |.| represents taking the absolute value, and k is the threshold, which can be set arbitrarily, such as 8. In formula (17), S2==0? means judging whether S2 is equal to 0.
[0215] If S2 == holds when the first preset condition is met, then If S2==0 does not hold, then v x =0. v x th′ represents the horizontal velocity. BIO Represents the rate threshold, n a n represents the first magnification factor. b This indicates the second magnification factor, and >> indicates a right shift. This is for rounding down.
[0216] Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIO Then the horizontal speed v x for
[0217] When the first preset condition is not met, formula (18) is the same as formula (13), and will not be repeated here.
[0218] Example 20: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the horizontal velocity of the corresponding sub-block in the reference frame can be determined based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0219] For example, if the second preset condition is met, the horizontal speed can be determined based on the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, cross-correlation coefficient S6, speed threshold, first amplification factor, and second amplification factor. If the second preset condition is not met, the horizontal speed can still be determined based on the autocorrelation coefficient S1, speed threshold, cross-correlation coefficient S3, first amplification factor, and second amplification factor. The second preset condition is determined based on the cross-correlation coefficient S2 and autocorrelation coefficient S5, as shown in the following formula: When the second preset condition is met, then S... tmp =S1·S5-S2·S2,
[0220]
[0221] When the second preset condition is not met, then
[0222]
[0223] When the second preset condition is met, S is first determined according to S1, S2, and S5. tmp For the specific determination method, please refer to the formula above. Then, if S tmp If == 0 is true, then If S tmpIf == 0 is not true, then v x =0. v x th′ represents the horizontal velocity. BIO Represents the rate threshold, n a n represents the first magnification factor. b This indicates the second magnification factor, and >> indicates a right shift. This is for rounding down.
[0224] In the above formula, Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIO Then the horizontal speed v x It can be
[0225] When the second preset condition is not met, formula (20) is the same as formula (13), and will not be repeated here.
[0226] The second preset condition mentioned above may include, but is not limited to: |S2|>k|S5|, where |.| represents taking the absolute value, and k is the threshold, which can be set arbitrarily, such as 8. Of course, this second preset condition is just an example and is not a limitation.
[0227] Example 21: For Example 19, when the first preset condition is not met, the formula for determining the horizontal speed becomes formula (15). For Example 20, when the second preset condition is not met, the formula for determining the horizontal speed becomes formula (15).
[0228] Example 22: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the vertical velocity of the corresponding sub-block in the reference frame can be determined based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0229] For example, the untruncated horizontal velocity can be determined based on the autocorrelation coefficient S1, the cross-correlation coefficient S3, the first amplification factor, and the second amplification factor, and the vertical velocity can be determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the velocity threshold, the untruncated horizontal velocity, the first amplification factor, and the second amplification factor.
[0230] See the formula below:
[0231]
[0232]
[0233] As can be seen from the above formula, if S1 > 0 holds, then If S1 > 0 is not true, then v x_org =0. (This is in contrast to v in the above embodiments.) x In contrast, this embodiment does not use the rate threshold th′. BIO Limit the horizontal speed to -th′ BIO with th′ BIO Between, therefore, v x_org This is called the uncut horizontal velocity, meaning it is not truncated. In other words, this uncut horizontal velocity v x_org Not restricted to -th′ BIO with th′ BIO between.
[0234] As can be seen from the above formula, if S5 > 0 holds, then If S5 > 0 is not true, then v y =0.
[0235] v y V represents the vertical velocity. x_org Indicates the untrunculated horizontal velocity, th′ BIO Represents the rate threshold, n a n represents the first magnification factor. b This indicates the second magnification factor, and >> indicates a right shift. To round down. Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIOThen the vertical velocity v y for
[0236] For example, in the formula above,
[0237] Example 23: After obtaining the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6, the vertical velocity of the corresponding sub-block in the reference frame can be determined based on one or more of the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, and cross-correlation coefficient S6.
[0238] For example, when the third preset condition is met, the vertical velocity is determined based on the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the first amplification factor, and the second amplification factor. When the third preset condition is not met, the vertical velocity is determined based on the cross-correlation coefficient S2, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the horizontal velocity, the first amplification factor, and the second amplification factor. For example, the third preset condition can be determined based on the horizontal velocity.
[0239] See the formula below: When the third preset condition is met, then:
[0240]
[0241] If the third preset condition is not met, then:
[0242]
[0243] For example, the third preset condition could be: if v x -th′ BIO or th′ BIO That is, v x It can be either the minimum or maximum value.
[0244] When the third preset condition is met, if S5 > 0 is true, then If S5 > 0 is not true, then v y =0. For example, v y th′ represents the vertical velocity. BIO Represents the rate threshold, n a n represents the first magnification factor. b This indicates the second magnification factor, and >> indicates a right shift. To round down. Clip3(a, b, x) means that if x is less than a, then Clip3(a, b, x) = a; if x is greater than b, then Clip3(a, b, x) = b; if x is greater than or equal to a and less than or equal to b, then Clip3(a, b, x) = x. In the above formula, -th′ BIO For a, th′ BIO For b, Let x be the sum of the above. Greater than -th′ BIO , and less than th′ BIO Then the vertical velocity v y It can be
[0245] When the third preset condition is not met, formula (24) is the same as formula (14), and will not be repeated here.
[0246] Example 24: For Example 23, when the third preset condition is not met, the formula for determining the vertical velocity is changed to formula (16).
[0247] Example 25: In the above examples, the first amplification factor n a It can be the smaller value between 5 and (BD-7), i.e., n a =min(5, BD-7); or, the first amplification factor n a It can be the larger of 1 and (BD-11), i.e., n a =Max(1, BD-11). Of course, the above is just an example of the first magnification factor; there are no restrictions, and it can be configured based on experience. Second magnification factor n b It can be the smaller of 8 and (BD-4), i.e., n b =min(8, BD-4); or, the second amplification factor n b It can be the larger of 4 and (BD-8), i.e., n b =Max(4, BD-8). Of course, the above is just an example of the second amplification factor; there are no restrictions, and it can be configured empirically. Rate threshold th′ BIO It can be 2 raised to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7). For example, th′ BIO =2 13-BD Or th′ BIO =2max(5, BD-7). Of course, the above is just an example of the rate threshold, and there are no restrictions on it. It can be configured based on experience.
[0248] By using the first amplification factor n aSetting it to the larger of 1 and (BD-11) reduces the number of bits shifted right by the autocorrelation coefficient and cross-correlation coefficient of the gradient, increasing the required bit width (preserving precision) for both. This is achieved by using the second amplification factor n. b Setting it to a larger value between 4 and (BD-8) reduces the number of bits shifted right by the autocorrelation coefficient and cross-correlation coefficient of the gradient, increasing the required bit width (to preserve precision) for both. This is achieved by using the rate threshold th′. BIO Setting it to 2max(5, BD-7) increases the horizontal velocity v. x and vertical velocity v y The required bit width (storage precision).
[0249] Example 26: The horizontal velocity v is obtained at the encoding / decoding end. x and vertical velocity v y Then, based on the horizontal velocity v x and vertical velocity v y Obtain the prediction compensation values of the sub-blocks of the current block. For example, based on the first original prediction value of the sub-block, the second original prediction value of the sub-block, and the number of gradient right shifts, determine the horizontal and vertical gradients, and based on the horizontal rate v... x Vertical velocity v y The horizontal gradient and the vertical gradient are used to obtain the predicted compensation value.
[0250] For example, the encoder / decoder can obtain the prediction compensation value b(x, y) of the sub-blocks of the current block using the following formula:
[0251]
[0252] For example, Represents the gradient in the horizontal direction. The gradient in the vertical direction is represented by the following parameters in the above formula: and These parameters can also be determined in the following ways.
[0253]
[0254]
[0255] I (k) (i, j) represents the pixel value at coordinates (i, j), such as I (0) (i, j) represents the pixel value at coordinate (i, j) in the first reference block, corresponding to the first original predicted value of the sub-block, I (1)(i, j) represents the pixel value at coordinates (i, j) in the second reference block, corresponding to the second original predicted value of the sub-block. For example, I (0) (x, y) represents the first original predicted value of the sub-block, I (1) (x, y) represents the second original prediction value of the sub-block. Assuming the sub-block size is 4*4, I (0) (x, y) is the first original prediction value of the first reference block of size 4*4, or the first original prediction value of the first reference block of size 6*6. (1) (x, y) is the second original prediction value of a second reference block of size 4*4, or the second original prediction value of a second reference block of size 6*6, denoted by I. (0) (x, y) is the first original prediction value of the first reference block of size 4*4, I (1) (x, y) is an example of the second original prediction value of the second reference block with a size of 4*4.
[0256] v x V represents the horizontal velocity. y The gradient shift is defined as follows: `>>` represents the vertical velocity, `rnd` represents rounding, `shift1` represents the number of bits for right shift, and `>>shift1` represents a right shift of `shift1`. The number of bits for right shift `shift1` can be the larger of 2 and (14-BD), i.e., `shift1 = max(2, 14-BD)`, or the larger of 6 and (BD-6), i.e., `shift1 = max(6, BD-6)`. These are just examples of the number of bits for right shift and are not restrictive; they can be configured empirically. By setting `shift1` to the larger of 6 and (BD-6), the number of bits for right shift can be increased, thus reducing the required bit width of the gradient (preserving precision). `BD` represents the bit depth, i.e., the bit width required for the brightness value, typically 10 or 8.
[0257] Example 27: The encoder / decoder can obtain the target prediction value of a sub-block of the current block based on the first original prediction value, the second original prediction value, and the prediction compensation value of the sub-block of the current block. For example, the encoder / decoder can obtain the target prediction value pred of the sub-block of the current block using the following formula. BDOF (x, y):
[0258] pred BDOF (x, y) = (I (0) (x, y) + I (1) (x, y) + b(x, y) + o offset >> shift(28)
[0259] In the above formula, I (0)(x, y) represents the first original predicted value of the sub-block, I (1) (x, y) represents the second original prediction value of the sub-block, b(x, y) represents the prediction compensation value of the sub-block, >> represents right shift, and >>shift represents right shift shift.
[0260] For example, o offset =2 shift-1 +2 14 shift = 15 - BD, where BD represents the bit depth.
[0261] Of course, the above method is just an example of obtaining the target prediction value of a sub-block, and there are no restrictions on it.
[0262] Example 28: When the current block is divided into multiple sub-blocks, the above-described embodiment can be used to determine the target prediction value of each sub-block. That is, the prediction signal is adjusted for each sub-block (e.g., a 4*4 size sub-block) of the current block to obtain the target prediction value of each sub-block. In this embodiment, when the target condition is met, the signal adjustment process of a certain sub-block can be skipped in advance. In other words, the method described in the above-described embodiment is no longer used to determine the target prediction value of the sub-block.
[0263] For example, if the current block is divided into sub-block 1, sub-block 2, sub-block 3 and sub-block 4, the encoder / decoder first uses the method described in the above embodiment to determine the target prediction value of sub-block 1, and then uses the method described in the above embodiment to determine the target prediction value of sub-block 2. Assuming that the target condition is met, the encoder / decoder no longer uses the method described in the above embodiment to determine the target prediction values of sub-block 3 and sub-block 4, that is, it skips the signal adjustment process of sub-block 3 and sub-block 4 in advance.
[0264] For example, if the difference between the predicted values of the two sub-blocks of the current block is less than a certain threshold TH_SUB_SAD, it can be determined that the target condition is met, and the signal adjustment process of the remaining sub-blocks can be exited in advance. For instance, if the difference between the predicted values of sub-block 1 and sub-block 2 is less than the threshold TH_SUB_SAD, then the target condition is met, and the signal adjustment process of the remaining sub-blocks (i.e., sub-blocks 3 and 4) can be exited in advance.
[0265] For example, if the current block is divided into multiple sub-blocks, before the encoding / decoding end determines the target prediction value of each sub-block using the method described in the above embodiment, it determines whether the target condition is met. If the target condition is met, the target prediction value of the sub-block is no longer determined using the method described in the above embodiment, i.e., the signal adjustment process of the sub-block is skipped in advance. If the target condition is not met, the target prediction value of the sub-block can be determined using the method described in the above embodiment.
[0266] For example, if the difference in the predicted values of the sub-blocks is less than a certain threshold TH_SUB_SAD, it can be determined that the target condition is met, and the signal adjustment process of the sub-block can be exited in advance. For instance, if the difference in the predicted values of sub-block 1 is less than the threshold TH_SUB_SAD, then it is determined that the target condition is met, and the signal adjustment process of sub-block 1 can be exited in advance.
[0267] For example, to determine the difference in predicted values for sub-blocks, the following method can be used:
[0268] Method 1: The difference in predicted values can be the SAD (Sum of Aspects) between the predicted value of the first predicted block (i.e., the first predicted block corresponding to the sub-block obtained from the first reference frame based on the first unidirectional motion information of the current block) (hereinafter referred to as pred0) and the predicted value of the second predicted block (i.e., the second predicted block corresponding to the sub-block obtained from the second reference frame based on the second unidirectional motion information of the current block) (hereinafter referred to as pred1), that is, the SAD of all pixels in pred0 and pred1. For example, the difference in predicted values between the first reference frame and the second reference frame can be determined by the following formula, in which pred0(i,j) is the predicted value of pred0 in the i-th column and j-th row of pred0, pred1(i,j) is the predicted value of pred1 in the i-th column and j-th row of pred1, n is the total number of pixels, abs(x) represents the absolute value of x, H represents the height value, and W represents the width value.
[0269]
[0270] Method 2: The difference in predicted values can also be the SAD of the predicted value after downsampling the first prediction block by N times (denoted as pred0, i.e., the predicted value obtained after downsampling the predicted value of the first prediction block) and the predicted value after downsampling the second prediction block by N times (denoted as pred1, i.e., the predicted value obtained after downsampling the predicted value of the second prediction block). For example, the difference in predicted values between the first reference frame and the second reference frame can be determined by the following formula: pred0(i,j) is the predicted value of pred0 in the i-th column and j-th row of pred0, pred1(i,j) is the predicted value of pred1 in the i-th column and j-th row of pred1, n is the total number of pixels, abs(x) represents the absolute value of x, H represents the height value, W represents the width value, and N is a positive integer, preferably 2.
[0271]
[0272] Example 29:
[0273] Based on the same concept as the above method, this application also proposes an encoding / decoding device, applied at the encoding end or the decoding end. The device is used to obtain the target prediction value of the current block or a sub-block of the current block if the feature information of the current block meets a specific condition. Figure 5 shows a structural diagram of the device, which includes:
[0274] The first determining module 51 is used to determine a first original prediction value based on the first unidirectional motion information of the current block and a second original prediction value based on the second unidirectional motion information of the current block if the feature information of the current block meets a specific condition.
[0275] The second determining module 52 is used to determine the horizontal velocity based on the first original predicted value and the second original predicted value; and to determine the vertical velocity based on the first original predicted value and the second original predicted value.
[0276] The first acquisition module 53 is used to acquire a prediction compensation value based on the horizontal direction rate and the vertical direction rate;
[0277] The second acquisition module 54 is used to acquire the target prediction value based on the first original prediction value, the second original prediction value and the prediction compensation value.
[0278] For example, the feature information may include, but is not limited to, one or more of the following: motion information attributes; prediction pattern attributes; size information; sequence-level switching control information.
[0279] The first determining module 51 is further configured to: determine that the motion information attribute satisfies a specific condition when the feature information includes the motion information attribute and the motion information attribute satisfies at least one of the following conditions;
[0280] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions;
[0281] The current block includes multiple sub-blocks, and the motion information of the multiple sub-blocks is the same;
[0282] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weighting.
[0283] The current block uses bidirectional prediction, and the two reference frames corresponding to the current block are at the same distance from the current frame;
[0284] The current block uses bidirectional prediction, and the difference between the predicted values of the two reference frames corresponding to the current block is less than a preset threshold.
[0285] The first determining module 51 is further configured to: obtain a first predicted block from a first reference frame based on the first unidirectional motion information of the current block, and obtain a second predicted block from a second reference frame based on the second unidirectional motion information of the current block;
[0286] Based on the SAD of the downsampled predicted value of the first prediction block and the downsampled predicted value of the second prediction block, the difference between the predicted values of the first reference frame and the second reference frame is obtained.
[0287] The first determining module 51 is further configured to: if the feature information includes the prediction mode attribute, wherein the prediction mode attribute is not using a fusion mode based on intra-frame and inter-frame joint prediction, and / or not using a symmetric motion vector difference mode, determine that the prediction mode attribute satisfies a specific condition.
[0288] The first determining module 51 is further configured to: if the feature information includes the sequence-level switch control information, and the sequence-level switch control information allows the current block to use a bidirectional optical flow mode, then determine that the sequence-level switch control information meets a specific condition.
[0289] The first determining module 51 is further configured to: determine that the size information satisfies a specific condition if the feature information includes the size information and the size information satisfies at least one of the following conditions: the width value of the current block is greater than or equal to a first threshold, and the width value of the current block is less than or equal to a second threshold; the height value of the current block is greater than or equal to a third threshold, and the height value of the current block is less than or equal to a fourth threshold; the area value of the current block is greater than or equal to a fifth threshold, and the area value of the current block is less than or equal to a sixth threshold.
[0290] The first determining module 51 determines a first original predicted value based on the first unidirectional motion information of the current block, and determines a second original predicted value based on the second unidirectional motion information of the current block, specifically for the following purposes:
[0291] Based on the first unidirectional motion information of the current block, a first reference block is determined from the first reference frame, and a first original prediction value of the first reference block is determined; wherein, the first original prediction value of the central region of the first reference block is obtained by interpolating the pixel values in the first reference frame, and the first original prediction value of the edge region of the first reference block is obtained by copying the pixel values in the first reference frame; based on the second unidirectional motion information of the current block, a second reference block is determined from the second reference frame, and a second original prediction value of the second reference block is determined; wherein, the second original prediction value of the central region of the second reference block is obtained by interpolating the pixel values in the second reference frame, and the second original prediction value of the edge region of the second reference block is obtained by copying the pixel values in the second reference frame.
[0292] When the second determining module 52 determines the horizontal speed based on the first original predicted value and the second original predicted value, it is specifically used to: when the first preset condition is met, determine the cross-correlation coefficient S2 between the horizontal gradient sum and the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first original predicted value and the second original predicted value; determine the horizontal speed based on the cross-correlation coefficient S2, the speed threshold, the cross-correlation coefficient S6, the first amplification factor and the second amplification factor; the first preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5 of the vertical gradient sum.
[0293] When the second determining module 52 determines the horizontal speed based on the first original predicted value and the second original predicted value, it is specifically used to: if the second preset condition is met, determine the autocorrelation coefficient S1 of the horizontal gradient sum, the cross-correlation coefficient S2 between the horizontal and vertical gradient sums, the cross-correlation coefficient S3 between the time-domain predicted value difference and the horizontal gradient sum, the autocorrelation coefficient S5 of the vertical gradient sum, and the cross-correlation coefficient S6 between the time-domain predicted value difference and the vertical gradient sum based on the first and second original predicted values; determine the horizontal speed based on the autocorrelation coefficient S1, the cross-correlation coefficient S2, the cross-correlation coefficient S3, the autocorrelation coefficient S5, the cross-correlation coefficient S6, the speed threshold, the first amplification factor, and the second amplification factor; wherein, the second preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5.
[0294] When the second determining module 52 determines the vertical direction rate based on the first original prediction value and the second original prediction value, it is specifically used to: obtain the untruncation horizontal direction rate without truncation processing based on the first original prediction value and the second original prediction value, and determine the vertical direction rate based on the untruncation horizontal direction rate.
[0295] When the second determining module 52 determines the vertical direction rate based on the first original predicted value and the second original predicted value, it is specifically used to: when a third preset condition is met, determine the autocorrelation coefficient S5 of the vertical direction gradient sum and the cross-correlation coefficient S6 between the time domain predicted value difference and the vertical direction gradient sum based on the first original predicted value and the second original predicted value; determine the vertical direction rate based on the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the first amplification factor and the second amplification factor; wherein, the third preset condition is determined based on the horizontal direction rate.
[0296] The cross-correlation coefficient S2 is located between the first cross-correlation coefficient threshold and the second cross-correlation coefficient threshold;
[0297] The cross-correlation coefficient S6 is located between the third cross-correlation coefficient threshold and the fourth cross-correlation coefficient threshold.
[0298] The first amplification factor is the smaller of 5 and (BD-7), or the larger of 1 and (BD-11); the second amplification factor is the smaller of 8 and (BD-4), or the larger of 4 and (BD-8); the rate threshold is 2 to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7); where BD is the bit depth.
[0299] When the first acquisition module 53 acquires the prediction compensation value based on the horizontal direction rate and the vertical direction rate, it is specifically used to: determine the horizontal direction gradient and the vertical direction gradient based on the first original prediction value, the second original prediction value and the gradient right shift number, and acquire the prediction compensation value based on the horizontal direction rate, the vertical direction rate, the horizontal direction gradient and the vertical direction gradient; wherein, the gradient right shift number is the larger of 2 and (14-BD), or the larger of 6 and (BD-6), where BD is the bit depth.
[0300] The decoding device provided in this application embodiment, from a hardware perspective, has a hardware architecture schematic diagram as shown in Figure 6. It includes a processor 61 and a machine-readable storage medium 62, wherein the machine-readable storage medium 62 stores machine-executable instructions that can be executed by the processor 61; the processor 61 is used to execute the machine-executable instructions to implement the method disclosed in the above examples of this application. For example, the processor is used to execute the machine-executable instructions to implement the following steps:
[0301] If the feature information of the current block meets specific conditions, the following steps are performed to obtain the target prediction value of the current block or its sub-blocks: determine a first original prediction value based on the first unidirectional motion information of the current block, and determine a second original prediction value based on the second unidirectional motion information of the current block; determine the horizontal velocity based on the first original prediction value and the second original prediction value; determine the vertical velocity based on the first original prediction value and the second original prediction value; obtain a prediction compensation value based on the horizontal velocity and the vertical velocity; and obtain the target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
[0302] The encoding device provided in this application embodiment, from a hardware perspective, has a hardware architecture schematic diagram as shown in Figure 7. It includes a processor 71 and a machine-readable storage medium 72, wherein the machine-readable storage medium 72 stores machine-executable instructions that can be executed by the processor 71; the processor 71 is used to execute the machine-executable instructions to implement the method disclosed in the above examples of this application. For example, the processor is used to execute the machine-executable instructions to implement the following steps:
[0303] If the feature information of the current block meets specific conditions, the following steps are performed to obtain the target prediction value of the current block or its sub-blocks: determine a first original prediction value based on the first unidirectional motion information of the current block, and determine a second original prediction value based on the second unidirectional motion information of the current block; determine the horizontal velocity based on the first original prediction value and the second original prediction value; determine the vertical velocity based on the first original prediction value and the second original prediction value; obtain a prediction compensation value based on the horizontal velocity and the vertical velocity; and obtain the target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
[0304] Based on the same concept as the methods described above, this application also provides a machine-readable storage medium storing a plurality of computer instructions. When executed by a processor, these computer instructions can implement the encoding and decoding methods disclosed in the examples above. The machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device, and can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid-state drive, any type of storage disk (such as optical disc, DVD, etc.), or similar storage media, or combinations thereof.
[0305] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, tablet computer, wearable device, or any combination of these devices.
[0306] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0307] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. This application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0308] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams. Furthermore, these computer program instructions can also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0309] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams. The above descriptions are merely embodiments of this application and are not intended to limit the application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An encoding / decoding method, comprising: If the feature information of the current block meets specific conditions, then the following steps are performed to obtain the target prediction value of the current block or a sub-block of the current block: A first original predicted value is determined based on the first unidirectional motion information of the current block, and a second original predicted value is determined based on the second unidirectional motion information of the current block; the horizontal velocity is determined based on the first original predicted value and the second original predicted value. The vertical velocity is determined based on the first and second original predicted values; The predicted compensation value is obtained based on the horizontal velocity and the vertical velocity; The target predicted value is obtained based on the first original predicted value, the second original predicted value, and the predicted compensation value.
2. The method according to claim 1, characterized in that, The feature information includes one or more of the following: motion information attributes; prediction pattern attributes; size information; sequence-level switch control information.
3. The method according to claim 2, characterized in that, If the feature information includes the motion information attribute, and the motion information attribute satisfies at least one of the following conditions, then the motion information attribute is determined to satisfy a specific condition. The current block uses bidirectional prediction, and the two reference frames corresponding to the current block come from different directions; The current block includes multiple sub-blocks, and the motion information of the multiple sub-blocks is the same; The current block uses bidirectional prediction, and the two reference frames corresponding to the current block have the same weighting. The current block uses bidirectional prediction, and the two reference frames corresponding to the current block are at the same distance from the current frame; The current block uses bidirectional prediction, and the difference between the predicted values of the two reference frames corresponding to the current block is less than a preset threshold.
4. The method according to claim 3, characterized in that, The method further includes: A first prediction block is obtained from a first reference frame based on the first unidirectional motion information of the current block, and a second prediction block is obtained from a second reference frame based on the second unidirectional motion information of the current block. Based on the SAD of the downsampled predicted value of the first prediction block and the downsampled predicted value of the second prediction block, the difference between the predicted values of the first reference frame and the second reference frame is obtained.
5. The method according to claim 2, characterized in that, If the feature information includes the prediction mode attribute, and the prediction mode attribute is that a fusion mode based on intra-frame and inter-frame joint prediction is not used, and / or a symmetric motion vector difference mode is not used, then the prediction mode attribute is determined to satisfy a specific condition.
6. The method according to claim 2, characterized in that, If the feature information includes the sequence-level switch control information, and the sequence-level switch control information allows the current block to use a bidirectional optical flow mode, then it is determined that the sequence-level switch control information meets specific conditions.
7. The method according to claim 2, characterized in that, If the feature information includes the size information, and the size information includes a width value and a height value, and the size information satisfies at least one of the following conditions, then the size information is determined to satisfy a specific condition; The width value of the current block is greater than or equal to a first threshold, and the width value of the current block is less than or equal to a second threshold; The height value of the current block is greater than or equal to the third threshold, and the height value of the current block is less than or equal to the fourth threshold; The area value of the current block is greater than or equal to the fifth threshold, and the area value of the current block is less than or equal to the sixth threshold.
8. The method according to claim 1, characterized in that, The step of determining a first original predicted value based on the first unidirectional motion information of the current block, and determining a second original predicted value based on the second unidirectional motion information of the current block, includes: Based on the first unidirectional motion information of the current block, a first reference block is determined from the first reference frame, and a first original prediction value of the first reference block is determined; wherein, the first original prediction value of the central region of the first reference block is obtained by interpolating the pixel values in the first reference frame, and the first original prediction value of the edge region of the first reference block is obtained by copying the pixel values in the first reference frame. Based on the second unidirectional motion information of the current block, a second reference block is determined from the second reference frame, and a second original prediction value of the second reference block is determined; wherein, the second original prediction value of the central region of the second reference block is obtained by interpolating the pixel values in the second reference frame, and the second original prediction value of the edge region of the second reference block is obtained by copying the pixel values in the second reference frame.
9. The method according to claim 1, characterized in that, Determining the horizontal velocity based on the first and second original predicted values includes: When the first preset condition is met, the cross-correlation coefficient S2 between the sum of horizontal and vertical gradients and the cross-correlation coefficient S6 between the difference in time-domain predicted values and the sum of vertical gradients are determined based on the first and second original predicted values. The horizontal velocity is determined based on the cross-correlation coefficient S2, the rate threshold, the cross-correlation coefficient S6, the first amplification factor, and the second amplification factor. The first preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5 of the vertical gradient.
10. The method according to claim 1, characterized in that, Determining the horizontal velocity based on the first and second original predicted values includes: If the second preset condition is met, the autocorrelation coefficient S1 of the horizontal gradient sum, the cross-correlation coefficient S2 of the horizontal gradient sum and the vertical gradient sum, the cross-correlation coefficient S3 of the time domain predicted value difference and the horizontal gradient sum, the autocorrelation coefficient S5 of the vertical gradient sum, and the cross-correlation coefficient S6 of the time domain predicted value difference and the vertical gradient sum are determined based on the first original predicted value and the second original predicted value. The horizontal velocity is determined based on the autocorrelation coefficient S1, cross-correlation coefficient S2, cross-correlation coefficient S3, autocorrelation coefficient S5, cross-correlation coefficient S6, rate threshold, first amplification factor, and second amplification factor. The second preset condition is determined based on the cross-correlation coefficient S2 and the autocorrelation coefficient S5.
11. The method according to claim 1, characterized in that, Determining the vertical velocity based on the first and second original predicted values includes: The untruncated horizontal velocity, without truncation, is obtained based on the first and second original predicted values. The vertical velocity is determined based on the untrunculated horizontal velocity.
12. The method according to claim 1, characterized in that, Determining the vertical velocity based on the first and second original predicted values includes: When the third preset condition is met, the autocorrelation coefficient S5 of the vertical gradient sum and the cross-correlation coefficient S6 between the time domain prediction value difference and the vertical gradient sum are determined based on the first original prediction value and the second original prediction value. The vertical velocity is determined based on the autocorrelation coefficient S5, the cross-correlation coefficient S6, the rate threshold, the first amplification factor, and the second amplification factor. The third preset condition is determined based on the horizontal velocity.
13. The method according to claim 9, 10, or 12, characterized in that, The method further includes: The cross-correlation coefficient S2 is located between the first cross-correlation coefficient threshold and the second cross-correlation coefficient threshold; The cross-correlation coefficient S6 is located between the third cross-correlation coefficient threshold and the fourth cross-correlation coefficient threshold.
14. The method according to claim 9, 10, or 12, characterized in that, The first amplification factor is the smaller of 5 and (BD-7), or the larger of 1 and (BD-11); The second amplification factor is the smaller of 8 and (BD-4), or the larger of 4 and (BD-8); The rate threshold is 2 to the power of M, where M is the difference between 13 and BD, or the larger of 5 and (BD-7); where BD is the bit depth.
15. The method according to claim 1, characterized in that, Obtaining the predicted compensation value based on the horizontal and vertical velocities includes: Based on the first original predicted value, the second original predicted value, and the number of right shifts in the gradient, determine the horizontal gradient and the vertical gradient, and The prediction compensation value is obtained based on the horizontal velocity, the vertical velocity, the horizontal gradient, and the vertical gradient; wherein the right shift bit of the gradient is the larger of 2 and (14-BD), or the larger of 6 and (BD-6), where BD is the bit depth.
16. The method according to any one of claims 1-15, characterized in that, If the current block is divided into at least one sub-block, for each sub-block of the current block, the method further includes: The first original predicted value of the sub-block is determined based on the first unidirectional motion information of the sub-block. The second original predicted value of the sub-block is determined based on the second unidirectional motion information of the sub-block; The horizontal velocity and the vertical velocity of the sub-block are determined based on the first and second original prediction values of the sub-block. The prediction compensation value corresponding to the sub-block is obtained based on the horizontal velocity and the vertical velocity; The target prediction value of the sub-block is obtained based on the first original prediction value of the sub-block, the second original prediction value of the sub-block, and the prediction compensation value corresponding to the sub-block.
17. An encoding / decoding apparatus, the apparatus being configured to acquire a target prediction value of the current block or a sub-block of the current block if the feature information of the current block satisfies a specific condition, the apparatus comprising: The first determining module is used to determine a first original prediction value based on the first unidirectional motion information of the current block and a second original prediction value based on the second unidirectional motion information of the current block if the feature information of the current block meets specific conditions. The second determining module is used to determine the horizontal velocity based on the first original predicted value and the second original predicted value; and to determine the vertical velocity based on the first original predicted value and the second original predicted value. The first acquisition module is used to acquire a prediction compensation value based on the horizontal direction rate and the vertical direction rate; The second acquisition module is used to acquire the target prediction value based on the first original prediction value, the second original prediction value, and the prediction compensation value.
18. An encoding end device, comprising: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method of any one of claims 1-16.
19. A decoding device, characterized in that, include: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method of any one of claims 1-16.
20. A machine-readable storage medium storing computer instructions that, when executed by a processor, implement the method of any one of claims 1-16.
