Decoding method, encoding method, apparatus, and device
By determining enhanced time movement vector prediction modes and compensating sub-block movement information, the method addresses inaccuracies in existing video coding technologies, leading to improved decoding and encoding performance.
Patent Information
- Application Number
- JP2023182870
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-03-26
- Filing Date
- 2023-10-24
- Publication Date
- 2025-01-31
- Estimated Expiration
- 2041-03-25
AI Technical Summary
In existing video coding technologies like ATMVP, the accuracy of movement information for sub-blocks is often inaccurate, leading to unreliable encoding performance due to incorrect movement information of surrounding blocks.
The method involves determining enhanced time movement vector prediction modes by analyzing index information from the bitstream, identifying matching blocks, and compensating sub-block movement information based on forward and backward movement vectors scaled to reference frames, ensuring accurate movement information for each sub-block.
This approach improves the reliability and accuracy of movement information, enhancing the decoding and encoding performance by reducing the probability of incorrect movement information and improving overall video coding efficiency.
Smart Images

Figure 0007625055000002 
Figure 0007625055000003 
Figure 0007625055000004
Abstract
Description
[Technical field]
[0001] The present invention relates to video encoding / decoding technology, and in particular to a decoding method, an encoding method, an apparatus, and a device. [Background technology]
[0002] Complete video coding usually includes operations such as prediction, transformation, quantization, entropy coding, and filtering. Prediction can be divided into intra prediction and inter prediction. Intra prediction predicts the current uncoded block using neighboring coded blocks as references, effectively removing redundancy in the spatial domain. Inter prediction predicts the current image using neighboring coded images, effectively removing redundancy in the temporal domain.
[0003] The Alternative Temporal Motion Vector Prediction (ATMVP) technique adopted in the Versatile Video Coding (VVC) standard uses the motion information of the time-domain sub-blocks to provide different motion information for each sub-block in the current coding unit.
[0004] However, in practical applications, in the ATMVP technique, finding the coding block at the corresponding position of the current coding block in the co-located frame needs to rely on the motion information of the neighboring blocks of the current coding block. If the information of the neighboring blocks is inaccurate, the motion information of the coding block at the corresponding position is also unreliable, which affects the coding performance. Summary of the Invention [Means for solving the problem]
[0005] Therefore, the present invention provides a decoding method, an encoding method, an apparatus, and a device.
[0006] According to a first aspect of an embodiment of the present invention, there is provided a decoding method, including: The method includes the steps of: analyzing index information of an enhanced temporal motion vector prediction mode from a bitstream of the current block when it is determined that an enhanced temporal motion vector prediction technique is applied to the current block; determining a matching block for the current block, determining a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of a first frame in List0, and the target reference direction is a List0 direction; or the target reference frame index is an index of a first frame in List1, and the target reference direction is a List1 direction; determining an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate; determining an enhanced temporal motion vector prediction mode from the temporal mode candidate list based on the index information; determining motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode; and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; Wherein, determining motion information of each sub-block within the current block based on the determined enhanced temporal motion vector prediction mode includes: For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or if the backward motion information of the sub-block is available but the forward motion information is not available, scaling the backward motion information of the sub-block to point to the first frame of List1, and providing the scaled backward motion information to the sub-block at the corresponding position of the current block; A sequence parameter set level syntax is used to indicate whether the enhanced temporal motion vector prediction technique is in operation for the current block.
[0007] According to a second aspect of an embodiment of the present invention, there is provided an encoding method, including: The method includes determining a matching block for the current block, the step comprising: determining a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of a first frame in List0, and the target reference direction is a List0 direction; or the target reference frame index is an index of a first frame in List1, and the target reference direction is a List1 direction; determining an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate; traversing each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determining motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; determining an enhanced temporal motion vector prediction mode candidate having a minimum rate-distortion cost as an enhanced temporal motion vector prediction mode of the current block according to rate-distortion costs corresponding to each enhanced temporal motion vector prediction mode candidate; adding index information to a bitstream of the current block, the index information being used to indicate a mode index of the determined enhanced temporal motion vector prediction mode; However, determining motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate is For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or If backward motion information of the sub-block is available but forward motion information is not available, scaling the backward motion information of the sub-block to point to the first frame of List1 and providing the scaled backward motion information to the sub-block at the corresponding position of the current block.
[0008] According to a third aspect of an embodiment of the present invention, there is provided a decoding device, including: The apparatus further comprises: a decoding unit for analyzing index information of an enhanced temporal motion vector prediction mode from a bitstream of the current block when it is determined that an enhanced temporal motion vector prediction technique is applied to the current block; a first determining unit for determining a matching block of the current block; a construction unit for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a second determining unit for determining an enhanced temporal motion vector prediction mode from the temporal mode candidate list according to index information of the enhanced temporal motion vector prediction mode; a prediction unit for determining motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block. Wherein, the prediction unit further comprises: for any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scaling the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and providing the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block, respectively; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or If the backward motion information of the sub-block is available but the forward motion information is not available, the backward motion information of the sub-block is scaled to point to the first frame of List1, and the scaled backward motion information is used to provide the sub-block at the corresponding position of the current block; using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is in operation for a current block; When determining a matching block of the current block, the first determination unit determines a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is the index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is the index of the first frame in List1 and the target reference direction is the List1 direction.
[0009] According to a fourth aspect of an embodiment of the present invention, there is provided an encoding device, including: The apparatus includes a first determining unit for determining a matching block of a current block; a construction unit for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a prediction unit for traversing each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determining motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; a second determining unit for determining, according to a rate-distortion cost corresponding to each enhanced temporal motion vector prediction mode candidate, an enhanced temporal motion vector prediction mode candidate having a minimum rate-distortion cost as an enhanced temporal motion vector prediction mode of the current block; a coding unit for adding index information to a bitstream of the current block, the index information being used to indicate a mode index of the determined enhanced temporal motion vector prediction mode; Here, the prediction unit further comprises: For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or If the backward motion information of the sub-block is available but the forward motion information is not available, the backward motion information of the sub-block is scaled to point to the first frame of List1, and the scaled backward motion information is used to provide the sub-block at the corresponding position of the current block; When determining a matching block of the current block, the first determination unit determines a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is the index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is the index of the first frame in List1 and the target reference direction is the List1 direction.
[0010] According to a fifth aspect of an embodiment of the present invention there is provided a decoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to implement the decoding method as claimed by executing the machine-executable instructions.
[0011] According to a fifth aspect of an embodiment of the present invention there is provided an encoding device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to implement the encoding method as claimed by executing the machine-executable instructions.
[0012] In the decoding method according to the embodiment of the present invention, when it is determined that the enhanced temporal motion vector prediction technique is applied to the current block, the index information of the enhanced temporal motion vector prediction mode is analyzed from the bit stream of the current block, the matching block of the current block is determined, and an enhanced temporal motion vector prediction mode candidate is determined according to the matching block and a new matching block obtained by offsetting the matching block, a temporal mode candidate list is constructed according to the enhanced temporal motion vector prediction mode candidate, an enhanced temporal motion vector prediction mode is determined from the temporal mode candidate list according to the index information, motion information of each sub-block in the current block is determined according to the enhanced temporal motion vector prediction mode, and motion compensation is performed for each sub-block in the current block according to the motion information of each sub-block in the current block. This reduces the probability that the motion information of the matching block is inaccurate due to the inaccurate motion information of the surrounding blocks, and improves the decoding performance. [Brief description of the drawings]
[0013] [Figure 1A] FIG. 2 is a schematic diagram of block division as shown in an exemplary embodiment of the present invention; [Figure 1B] FIG. 2 is a schematic diagram of block division as shown in an exemplary embodiment of the present invention; [Diagram 2] FIG. 2 is a schematic diagram of an encoding and decoding method as illustrated in an exemplary embodiment of the present invention; [Diagram 3] FIG. 2 is a schematic diagram of a Clip operation shown in an exemplary embodiment of the present invention. [Figure 4A] 4 is a flowchart of a decoding method according to an exemplary embodiment of the present invention; [Figure 4B] 4 is a flowchart of another decoding method according to an exemplary embodiment of the present invention; [Diagram 5] FIG. 2 is a schematic diagram of neighboring blocks of a current block shown in an exemplary embodiment of the present invention. [Figure 6]1 is a flowchart of determining a matching block of a current block based on a first neighboring block of the current block shown in an exemplary embodiment of the present invention. [Figure 7] FIG. 13 is a schematic diagram of a reference block when offsetting a matching block as shown in an exemplary embodiment of the present invention. [Figure 8A] FIG. 13 is a schematic diagram of offsetting matching blocks shown in an exemplary embodiment of the present invention. [Figure 8B] FIG. 13 is a schematic diagram of offsetting matching blocks shown in an exemplary embodiment of the present invention. [Figure 8C] FIG. 13 is a schematic diagram of offsetting matching blocks shown in an exemplary embodiment of the present invention. [Figure 8D] FIG. 13 is a schematic diagram of offsetting matching blocks shown in an exemplary embodiment of the present invention. [Figure 8E] FIG. 13 is a schematic diagram of offsetting matching blocks shown in an exemplary embodiment of the present invention. [Figure 9] FIG. 2 is a schematic diagram of the structure of a decoding device shown in an exemplary embodiment of the present invention; [Figure 10] FIG. 2 is a schematic diagram of a hardware structure of a decoding device shown in an exemplary embodiment of the present invention; [Figure 11] FIG. 2 is a schematic diagram of the structure of an encoding device according to an exemplary embodiment of the present invention; [Figure 12] FIG. 2 is a schematic diagram of a hardware structure of an encoding device according to an exemplary embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] The terms used in the embodiments of the present invention are only for the purpose of describing the specific embodiments, and are not intended to limit the present invention. Unless the context clearly indicates otherwise, the singular forms "a," "the," and "the" used in the embodiments of the present invention and the claims are intended to include the plural forms. It should be understood that the term "and / or" used herein means to include any or all possible combinations of one or more associated items listed. It should be understood that, although the embodiments of the present invention may use terms such as first, second, third, etc. to describe various information, such information is not limited to these terms. These terms are used only to distinguish between information of the same type. For example, the first information may be referred to as the second information, and similarly, the second information may be referred to as the first information, without departing from the scope of the present invention. In addition, the word "if" used may be interpreted as "when," "in the case of," or "depending on," depending on the context.
[0015] Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the drawings. When the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not all embodiments consistent with the present invention. On the contrary, they are merely examples of apparatus and methods consistent with certain aspects of the present invention, as detailed in the appended claims.
[0016] The terms used in the embodiments of the present invention are for the purpose of describing particular embodiments only and are not intended to limit the present invention. Unless the context clearly indicates otherwise, the singular forms "a," "the," and "the" used in the embodiments and claims of the present invention are also intended to include the plural forms.
[0017] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, first, some technical terms related to the embodiments of the present invention and main processes of existing video encoding and decoding will be briefly described.
[0018] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, some technical terms related to the embodiments of the present invention will first be briefly described.
[0019] Technical terms: 1. Predicted pixel (also called Prediction Signal): This is the pixel value obtained from a pixel that has already been coded and decoded. The residual is calculated from the difference between the original pixel and the predicted pixel, and the residual is transformed, quantized, and coefficient coded.
[0020] For example, the predicted pixel in inter prediction refers to the pixel value obtained from the reference frame (reconstructed pixel frame) for the current image block, and since the pixel position is discrete, it needs to be interpolated to obtain the final predicted pixel. The closer the predicted pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two will be, and the higher the coding compression performance will be.
[0021] 2. Motion Vector (MV): In inter-coding, MV is used to represent the relative displacement between the current coding block and its best matching block in the reference image. For each block (also called sub-block) obtained by division, the corresponding motion vector needs to be transmitted to the decoding side. Especially when the number of sub-blocks is large, if the MV of each sub-block is coded and transmitted independently, a considerable number of bits will be consumed. In order to reduce the number of bits used for coding the MV, video coding utilizes the spatial correlation between adjacent image blocks, predicts the MV of the current coding target block based on the MV of the adjacent blocks that have already been coded, and codes the prediction difference. This can effectively reduce the number of bits used to express the MV. Based on this, when coding the MV of the current image block, generally, the MV of the current image block is predicted using the MV of the adjacent coded blocks first, and the difference between the predicted value of the MV (Motion Vector Prediction, MVP) and the actual estimated value of the motion vector, i.e., the motion vector residual (Motion Vector Difference, MVD), can be coded, so that the number of bits coded by the MV can be effectively reduced.
[0022] 3. Motion Information: Since MV represents the relative displacement between the current image block and the best matching block of a reference image, in order to accurately obtain information pointing to an image block, in addition to MV information, reference image index information indicating which reference image was used is also required. In video coding technology, a reference image list is usually created for the current image based on a certain rule, and the reference image index indicates which reference image in the reference image list was used for the current image block. In addition, since coding technology may support multiple reference image lists, an index indicating which reference image list was used is also required, and this index can be called a reference direction. In video coding, information related to motion such as MV, reference frame index, and reference direction is collectively called motion information.
[0023] 4. Rate-Distortion Optimized (RDO): Indicators for evaluating the efficiency of coding include bit rate (Bits Per Second, BPS) and Peak Signal to Noise Ratio (PSNR). The lower the bit rate, the higher the compression rate, and the higher the PSNR, the higher the quality of the reconstructed image. When selecting a coding mode, the discriminant is essentially a combined evaluation of both.
[0024] For example, the cost of a coding mode: J(mode)=D+λ*R, where D is the distortion, usually measured by the SSE (Sum of Square Error) metric, which is the sum of the squared error between the reconstructed block and the source image block, λ is the Lagrange multiplier, and R is the actual number of bits required to code the image block in that coding mode, which includes the sum of the bits required to code the mode information, motion information, and prediction residual.
[0025] When selecting a coding mode, a comparative decision based on the RDO can usually guarantee higher coding performance.
[0026] Next, the block division technique in the existing video coding standards and the main processes of the existing video encoding and decoding are briefly described.
[0027] Block division techniques in video coding standards:
[0028] In High Efficiency Video Coding (HEVC), for example, a coding tree unit (CTU) is recursively divided into coding units (CU) using a quadtree. As shown in FIG. 1A and FIG. 1B, an undivided CTU is a largest coding unit (LCU). The CTU described below can be used in place of an LCU. At the leaf node CU level, it is determined whether intra coding or inter coding is used. A CU can be further divided into two or four prediction units (PU), and the same prediction information is used within the same PU. After the prediction is completed and residual information is obtained, the CU can be further divided into multiple transform units (TU) using a quadtree. For example, the current block in the present invention is one PU.
[0029] However, in the latest proposed general-purpose video coding, the block partitioning technology has changed significantly. The bipartite / tertiary / quadtree partitioning structure replaces the traditional partitioning model, cancels the traditional concept of CU, PU, and TU, and supports more flexible CU partitioning methods. CUs can be partitioned into squares or rectangles. CTUs are first partitioned into quadtrees, and the leaf nodes obtained by quadtree partitioning can be further partitioned into bipartites or ternary trees. As shown in Figure 1A, there are five types of CU partitioning types: quadtree partitioning, horizontal bipartite partitioning, vertical bipartite partitioning, horizontal ternary tree partitioning, and vertical ternary tree partitioning. As shown in Figure 1B, the partitioning of CUs in a CTU can be freely combined with the above five partitioning types to make the shape of each PU different, for example, a rectangle or a square with a different size.
[0030] The main processes of video encoding and decoding:
[0031] Taking video coding as an example, as shown in (a) of Figure 2, video coding generally includes processes such as prediction, transformation, quantization, and entropy coding, and furthermore, coding can also be performed in a framework such as that shown in (b) of Figure 2.
[0032] Here, prediction can be divided into intra prediction and inter prediction. Intra prediction predicts a current uncoded block by using neighboring coded blocks as references, effectively removing redundancy in the spatial domain. Inter prediction predicts a current image by using neighboring coded images, effectively removing redundancy in the temporal domain.
[0033] Transformation refers to converting an image from the spatial domain to the transform domain and using transform coefficients to represent the image. Most images contain many flat and slowly changing regions, and by applying an appropriate transformation, the image can be transformed from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transform domain, eliminating the frequency domain correlation between signals, and effectively compressing the bitstream together with the quantization process.
[0034] Entropy coding is a lossless coding method that converts a sequence of element symbols (e.g., representing a video sequence) into a binary bitstream for transmission or storage. The element symbols input to the entropy coding module include quantized transform coefficients, motion vector information, prediction mode information, syntax for transform and quantization, etc. Entropy coding can effectively remove redundancy in the video element symbols.
[0035] The above takes encoding as an example, but the process of video decoding is the opposite of the process of video encoding; that is, video decoding usually includes processes such as entropy decoding, prediction, inverse quantization, inverse transform, filtering, etc., and the implementation principle of each process is the same as or similar to that of video encoding.
[0036] The implementation of ATMVP technology is briefly described below.
[0037] The implementation of ATMVP technology mainly consists of the following processes:
[0038] 1) Determination of Temporal Motion Vector Prediction (TMVP): It is determined whether the motion information of the position A0 of the current coding block satisfies the following condition.
[0039] a) Position A0 exists and is in the same slice and tile as the current coding unit.
[0040] b) The prediction mode at position A0 is an inter prediction mode.
[0041] c) The reference frame index of position A0 is the same as the reference frame index of the co-located frame corresponding to the current frame (the L0 direction is determined first, and then the L1 direction).
[0042] Here, position A0 is the position (xCb-1, yCb+CbHeight-1), where (xCb, yCb) are the coordinates of the upper left corner of the current block, and CbHeight is the height of the current block.
[0043] 2) Calculate the position of the central reference block: the precision of the TMVP obtained in step 1) is 1 / 16, and the motion vector at position A0 needs to be shifted 4 bits to the right, thereby converting the motion vector into an integer pixel. At the same time, the position of the central reference block needs to be clipped to within the range of the current CTU. That is, if the position of the central reference block is not within the range of the current CTU, the central reference block is shifted horizontally and / or vertically so as to be exactly within the range of the current CTU. A schematic diagram is shown in FIG. 3. In the present invention, the current CTU may represent a CTU in a reference frame. The current CTU is in the same image as the matching block, and the current CTU may be the largest coding unit in the reference frame that is in the same position as the largest coding unit in which the current block is located.
[0044] The position of the central reference block is calculated as follows:
number
[0045] 3) Determining the prediction mode of the central reference block: if the prediction mode is a non-inter prediction mode, then ctrPredFlagL0 and ctrPredFlagL1 are both 0; otherwise, that is, the prediction mode is an inter prediction mode, proceed to step 4).
[0046] 4),Adjustment of reference position: Since the sub-block size is 8*8, the motion information is in 8*8 units. Therefore, the coordinates of the upper left corner of the central reference block need to be adjusted by 8 times. The adjustment formula is as follows: xColCb=((xColCb>>3)<<3) yColCb=((yColCb>>3)<<3)
[0047] 5) Obtaining motion information of the adjusted central reference block: if the prediction mode of the adjusted central reference block is intra prediction or intra block copy (IBC) mode, FlagLXCol=0; otherwise, determine whether motion information in the L0 direction and L1 direction of the adjusted central reference block exists, respectively; if it exists, FlagLXCol=1, and obtain the motion information in the L0 direction and / or L1 direction of the adjusted central reference block.
[0048] For example, when LX=L0 or LX=L1, and the prediction mode of the adjusted central reference block is an intra prediction mode or an intra block copy mode, FlagL0Col=0 and FlagL1Col=0.
[0049] If the prediction mode of the adjusted central reference block is neither intra prediction mode nor intra block copy mode, when motion information in the L0 direction of the adjusted central reference block exists, FlagL0Col = 1; when motion information in the L0 direction of the adjusted central reference block does not exist, FlagL0Col = 0; when motion information in the L1 direction of the adjusted central reference block exists, FlagL1Col = 1; and when motion information in the L1 direction of the adjusted central reference block does not exist, FlagL1Col = 0.
[0050] When FlagL1Col=1, if the long-term reference frame of the current frame and the long-term reference frame of the co-located frame are not the same frame, it is determined that the motion information of the adjusted central reference block is not available, and ctrPredFlagLX=0; otherwise, the motion information of the adjusted central reference block is scaled to point to the first frame of ListX (X=0 or 1), and the scaled motion information is used as the motion information of the current central reference block, and ctrPredFlagLX=1. In the present invention, ListX can represent reference image queue X (also called reference image list X), for example, List0 can represent reference image queue 0, and List1 can represent reference image queue 1.
[0051] 6) If ctrPredFlagLX=1, calculate motion information for each subblock: traverse each subblock in the matching block, and for any subblock, clip the subblock within the range of the current CTU, and if the motion information of the subblock after clipping is available, scale the motion information of the subblock after clipping to point to the first frame of ListX, and provide the scaled motion information to the subblock at the corresponding position of the current block. If the motion information of the subblock after clipping is not available, scale the motion information of the center position of the adjusted center reference block to point to the first frame of ListX, and provide the scaled motion information to the subblock at the corresponding position of the current block.
[0052] In order to make the above objectives, features and advantages of the embodiments of the present invention easier to understand, the technical solutions in the embodiments of the present invention are described in more detail below in conjunction with the accompanying drawings.
[0053] Referring to FIG. 4A, it is a flowchart of a decoding method provided in an embodiment of the present invention, in which the decoding method can be applied to a decoding device, and the decoding method can include the following steps: Step S401: If it is determined that the enhanced temporal motion vector prediction technique is applied to the current block, index information of the enhanced temporal motion vector prediction mode is analyzed from the bitstream of the current block. Step S402: A matching block of the current block is determined. Step S403: Determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and build a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate. Step S404: Determine an enhanced temporal motion vector prediction mode from the temporal mode candidate list according to the index information. Step S405: Based on the determined enhanced temporal motion vector prediction mode, determine motion information of each sub-block in the current block, and perform motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block. However, determining the motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode includes: for any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block, respectively; or if the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block, or if the backward motion information of the sub-block is available but the forward motion information is not available, scale the backward motion information of the sub-block to point to the first frame of List1, and provide the scaled backward motion information to the sub-block at the corresponding position of the current block. Here, a sequence parameter set level syntax can be used to indicate whether an enhanced temporal motion vector prediction technique is applied to the current block.
[0054] In an embodiment of the present invention, determining a matching block of the current block includes determining a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is an index of the first frame in List1 and the target reference direction is the List1 direction.
[0055] Referring to FIG. 4B, there is shown a flowchart of another decoding method provided in an embodiment of the present invention, in which the decoding method can be applied to a decoding device, and the decoding method can include the following steps:
[0056] Step S400: obtain a bitstream of a current block, and analyze index information of an enhanced temporal motion vector prediction mode from the bitstream of the current block, where the index information is a position of the enhanced temporal motion vector prediction mode in a first temporal mode candidate list constructed by the encoding device.
[0057] In the embodiment of the present invention, the current block may be any one of the image blocks of the image to be processed. In the implementation, the image to be processed may be divided into a number of image blocks, and each image block may be processed in a certain order in sequence. However, the size and shape of each image block may be set according to a predetermined division rule.
[0058] In the case of a decoding device, the current block is the block to be decoded.
[0059] The bitstream is transmitted from the encoding side, and may be a binary bitstream, and may include information that the decoding device needs to know for decoding, for example, information about the encoding method used by the encoding device, the size of the current block, etc.
[0060] In order to improve the reliability of the motion information of the matching block, the number of matching blocks determined based on the surrounding blocks of the current block is not limited to one and may be multiple, and the encoding device can construct a temporal mode candidate list (referred to as a first temporal mode candidate list in this invention) based on the temporal prediction modes (which can be referred to as enhanced temporal motion vector prediction mode candidates in this invention) corresponding to each of the multiple matching blocks, and encode index information of the enhanced temporal motion vector prediction mode candidates (referred to as enhanced temporal motion vector prediction modes in this invention) corresponding to the matching block to be finally used into the bitstream of the current block, and the index information is used to indicate the position of the enhanced temporal motion vector prediction mode in the first temporal mode candidate list constructed by the encoding device.
[0061] When the decoding device obtains the bitstream of the current block, it can parse the index information of the enhanced temporal motion vector prediction mode from the bitstream of the current block.
[0062] Step S410: determining a matching block of the current block based on a first neighboring block of the current block.
[0063] In an embodiment of the present invention, the first neighboring block of the current block may include any decoded adjacent or non-adjacent block of the current block.
[0064] For example, referring to FIG. 5, the first neighboring block of the current block may be any one of A, B, C, D, F, and G.
[0065] The decoding device may determine a matching block of the current block based on the first neighboring block of the current block.
[0066] As one possible embodiment, as shown in FIG. 6, in step S410, determining a matching block of the current block based on the first neighboring block of the current block can be realized by the following steps:
[0067] Step S411: determining a first-stage motion information based on a first neighboring block of a current block;
[0068] Step S412: determining a matching block for the current block based on the first-stage motion information.
[0069] Exemplarily, the first stage may refer to a process of determining a matching block of the current block based on the surrounding blocks of the current block, and the motion information of the first stage may refer to motion information used to determine a matching block of the current block, determined based on the current first surrounding blocks.
[0070] Exemplarily, both List0 and List1 are used to record information of reference frames in bi-prediction mode, for example, identification information of reference frames, such as frame numbers. Based on the index of a frame in List0 or List1, the information of the reference frame can be determined, for example, the frame number of the reference frame can be determined, and then the corresponding reference frame can be obtained based on the frame number.
[0071] In an embodiment of the present invention, determining the first-stage motion information based on the first neighboring block of the current block may include:
[0072] Determine that the first-stage motion vector is 0, the reference frame index is the index of the first frame in List0, and the reference direction of the first-stage motion information is List0 direction;
[0073] Alternatively, it is determined that the first-stage motion vector is 0, the reference frame index is the index of the first frame in List1, and the reference direction of the first-stage motion information is the List1 direction.
[0074] In an embodiment of the present invention, both List0 and List1 are used to record information of reference frames in bi-prediction mode, for example, identification information of reference frames, such as frame numbers. Based on the index of a frame in List0 or List1, the information of the reference frame can be determined, for example, the frame number of the reference frame can be determined, and then the corresponding reference frame can be obtained based on the frame number.
[0075] As one possible embodiment, in step S412, determining a matching block of the current block based on the first-stage motion information may include:
[0076] A matching block corresponding to the current block is determined based on the position of the current block and the horizontal and vertical motion vectors of the first stage, and the determining step may be performed in combination with the accuracy of the motion vector.
[0077] Exemplarily, after determining the first-stage motion information, the decoding device can determine a matching block of the current block based on the first-stage horizontal motion vector (i.e., the horizontal component of the first-stage motion vector) and vertical motion vector (i.e., the vertical component of the first-stage motion vector) and the position of the current block, i.e., adjust the position corresponding to the first-stage motion information.
[0078] By way of example, the precision of the motion vectors can take values including, but not limited to, 4, 2, 1, ½, ¼, ⅛ or 1 / 16.
[0079] For example, the position of the current block can be indicated by the coordinates of the upper left corner of the current block.
[0080] The decoding device shifts the first-stage horizontal motion vector and vertical motion vector slightly to the left (precision greater than 1) or right (precision less than 1) based on the accuracy of the motion vector, respectively, and converts them into integer pixels; determines a reference position based on the position of the current block and the converted first-stage horizontal motion vector and vertical motion vector; adjusts the reference position based on a predetermined value (which can be set according to the actual scene, for example, 3); and determines the position of the matching block based on the adjusted reference position; for specific implementation, please refer to the specific embodiments below.
[0081] As another possible embodiment, in step S412, determining a matching block of the current block based on the first-stage motion information may include:
[0082] A matching block of the current block is determined based on the position of the current block, the horizontal and vertical motion vectors of the first stage, and the size of the sub-block.
[0083] Exemplarily, after determining the first-stage motion information, the decoding device can determine a matching block of the current block based on the first-stage horizontal motion vector (i.e., the horizontal component of the first-stage motion vector) and vertical motion vector (i.e., the vertical component of the first-stage motion vector) and the position of the current block, i.e., adjust the position corresponding to the first-stage motion information.
[0084] By way of example, the precision of the motion vectors can take values including, but not limited to, 4, 2, 1, ½, ¼, ⅛ or 1 / 16.
[0085] For example, the position of the current block can be indicated by the coordinates of the upper left corner of the current block.
[0086] The decoding device shifts the first-stage horizontal and vertical motion vectors slightly to the left (precision greater than 1) or right (precision less than 1) based on the precision of the motion vectors, converts them to integer pixels, determines a reference position based on the position of the current block and the converted first-stage horizontal and vertical motion vectors, adjusts the reference position based on the size of the sub-block (which can be called alignment adjustment), and further determines the position of the matching block based on the adjusted reference position.
[0087] For example, assuming that the size of the sub-block is 2N*2N, the reference position may be first shifted to the right by N bits and then shifted to the left by N bits, where N is a positive integer.
[0088] For example, when aligning a reference position based on the side length of a sub-block, the remainder when dividing the horizontal and vertical coordinates of the reference position by the side length of the sub-block is usually directly discarded, but if the remainder when dividing the horizontal and vertical coordinates of the reference position by the side length of the sub-block is greater than half the side length, it is more effective to further process the remainder (e.g., round up the remainder) rather than directly discarding it, and therefore the determined matching block will usually be better.
[0089] For example, after the first-stage motion information is determined, the first-stage horizontal motion vector and the vertical motion vector may be adjusted based on a predetermined adjustment value, respectively, and a matching block of the current block may be determined based on the adjusted first-stage horizontal motion vector and the vertical motion vector, the accuracy of the motion vector, and the position of the current block.
[0090] Alternatively, the horizontal and vertical coordinates of the upper left corner of the matching block may be provisionally determined based on the horizontal and vertical motion vectors of the first stage and the accuracy of the motion vectors, and the horizontal and vertical coordinates of the provisionally determined upper left corner of the matching block may be adjusted based on predetermined adjustment values, and finally, the adjusted horizontal and vertical coordinates may be aligned based on the side lengths of the sub-blocks. For specific implementation, please refer to the following specific embodiments.
[0091] For example, the horizontal and vertical motion vectors of the first stage are converted into integer pixels based on the accuracy of the motion vector, and then the converted horizontal and vertical motion vectors of the first stage are respectively multiplied by 2. N-1 Alternatively, add 2 to the horizontal and vertical coordinates of the upper left corner of the matching block tentatively determined by the above method. N-1 You can add 2. N is the side length of the subblock.
[0092] Exemplarily, the adjustment value for adjusting the first stage horizontal motion vector may be the same as or different from the adjustment value for adjusting the first stage vertical motion vector.
[0093] Alternatively, the adjustment value for adjusting the horizontal coordinate of the upper left corner of the provisionally determined matching block may be the same as or different from the adjustment value for adjusting the vertical coordinate of the upper left corner of the initially determined matching block.
[0094] Step S420: determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and construct a second temporal mode candidate list based on the determined enhanced temporal motion vector prediction mode candidate.
[0095] In an embodiment of the present invention, when the matching block is determined in step S410, the matching block may be offset to obtain a new matching block.
[0096] Exemplarily, the number of new matching blocks obtained by the matching block offsetting scheme may be one or more.
[0097] Based on the matching block determined in step S410 and the new matching block obtained in step S420, the decoding device may determine the temporal prediction mode corresponding to the matching block and the temporal prediction mode corresponding to the new matching block as enhanced temporal motion vector prediction mode candidates, and construct a temporal mode candidate list (referred to as a second temporal mode candidate list in this invention) based on the determined enhanced temporal motion vector prediction mode candidates.
[0098] By way of example, there is no limitation on the number of enhanced temporal motion vector prediction mode candidates and the order in which each enhanced temporal motion vector prediction mode candidate is added to the temporal mode candidate list, but the decoding device and the encoding device must be consistent.
[0099] It should be noted that in a specific application scene, the motion information of a new matching block obtained by offsetting a matching block may be identical or similar to the motion information of the matching block, and in this case, the prediction mode corresponding to the new matching block does not need to be determined as an enhanced temporal motion vector prediction mode candidate.
[0100] As one possible embodiment, offsetting a matching block and obtaining a new matching block can be achieved in the following manner:
[0101] clip the first sub-block and the second sub-block into the range of the current CTU, compare the motion information of the first sub-block and the second sub-block after clipping, and clip the third sub-block and the fourth sub-block into the range of the current CTU, compare the motion information of the third sub-block and the fourth sub-block after clipping, and if at least one of the two comparison results in different motion information, offset the matching block by one unit horizontally to the right to obtain a new matching block;
[0102] clip the fifth sub-block and the sixth sub-block into the range of the current CTU, compare the motion information of the fifth sub-block and the sixth sub-block after clipping, and clip the seventh sub-block and the eighth sub-block into the range of the current CTU, compare the motion information of the seventh sub-block and the eighth sub-block after clipping, and if at least one of the two comparison results in different motion information, offset the matching block horizontally to the left by one unit to obtain a new matching block;
[0103] The first sub-block and the ninth sub-block are clipped to the range of the current CTU, and the motion information of the first sub-block and the ninth sub-block after clipping is compared; the fifth sub-block and the tenth sub-block are clipped to the range of the current CTU, and the motion information of the fifth sub-block and the tenth sub-block after clipping is compared; if at least one of the two comparison results in different motion information, the matching block is offset vertically downward by one unit to obtain a new matching block.
[0104] The third sub-block and the eleventh sub-block are clipped into the range of the current CTU, and the motion information of the third sub-block and the eleventh sub-block after clipping are compared; the seventh sub-block and the twelfth sub-block are clipped into the range of the current CTU, and the motion information of the seventh sub-block and the twelfth sub-block after clipping are compared; if at least one of the two comparison results in different motion information, the matching block is offset vertically upward by one unit to obtain a new matching block.
[0105] Exemplarily, the first subblock is the subblock in the upper left corner of the matching block, the second subblock is the topmost adjacent subblock immediately to the right of the matching block, the third subblock is the subblock in the lower left corner of the matching block, the fourth subblock is the bottommost adjacent subblock immediately to the right of the matching block, the fifth subblock is the subblock in the upper right corner of the matching block, the sixth subblock is the topmost adjacent subblock immediately to the left of the matching block, the seventh subblock is the subblock in the lower right corner of the matching block, the eighth subblock is the bottommost adjacent subblock immediately to the left of the matching block, the ninth subblock is the leftmost adjacent subblock immediately below the matching block, the tenth subblock is the rightmost adjacent subblock immediately below the matching block, the eleventh subblock is the leftmost adjacent subblock immediately above the matching block, and the twelfth subblock is the rightmost adjacent subblock above the matching block.
[0106] Illustratively, one unit is the size of a sub-block.
[0107] For example, in the case of an 8*8 subblock, one unit is 8 pixels, in the case of a 4*4 subblock, one unit is 4 pixels, and in the case of a 16*16 subblock, one unit is 16 pixels.
[0108] It should be noted that when offsetting the matching block, it is not limited to offsetting in units of 1 as described in the above embodiment, but other values are also acceptable. For example, if the sub-block is an 8*8 sub-block, when offsetting the matching block, a value other than 8 pixels may also be acceptable. The specific implementation is not described here.
[0109] Taking Figure 7 as an example, the first sub-block is A1, the second sub-block is B2, the third sub-block is A3, the fourth sub-block is B4, the fifth sub-block is A2, the sixth sub-block is B1, the seventh sub-block is A4, the eighth sub-block is B3, the ninth sub-block is C3, the tenth sub-block is C4, the eleventh sub-block is C1, and the twelfth sub-block is C2.
[0110] Taking A1, B2, A3, and B4 as an example, the decoding device can clip A1, B2, A3, and B4 respectively into the range of the current CTU (i.e., the CTU to which the current block belongs), compare the motion information of A1 and B2 after clipping, and compare the motion information of A3 and B4 after clipping. Considering that if the motion information of A1 and B2 after clipping is the same, and the motion information of A3 and B4 after clipping is the same, the motion information of other sub-blocks between A1 and B2 after clipping is likely to be the same, and the motion information of other sub-blocks between A3 and B4 after clipping is likely to be the same, the matching block is offset by one unit to the right in the horizontal direction, and the motion information of the obtained new matching block is likely to be the same as the motion information of the original matching block, and the offset may not allow new motion information to be obtained.
[0111] If the motion information of A1 and B2 after clipping is different and / or if the motion information of A3 and B4 after clipping is different, a new matching block is obtained by offsetting the matching block horizontally to the right by one unit, thereby obtaining new motion information.
[0112] Similarly, it can be determined, following the logic above, whether a matching block can be offset horizontally to the left by one unit, vertically up by one unit, and vertically down by one unit to obtain a corresponding new matching block.
[0113] It should be noted that in this embodiment, if a new matching block cannot be obtained by the above method, the original matching block may be determined as the final matching block candidate, or the current matching block may be re-offset according to another offset strategy to obtain a new matching block.
[0114] As another possible embodiment, the new matching block obtained by offsetting the matching block may be determined in the following manner:
[0115] The matching block is offset horizontally and vertically based on one or more offset pairs, respectively, to obtain one or more new matching blocks.
[0116] Illustratively, the decoding device may obtain a new matching block by offsetting the matching block by a predetermined offset amount in both the horizontal and vertical directions.
[0117] Illustratively, an offset amount for offsetting a matching block horizontally and an offset amount for offsetting a matching block vertically constitute an offset amount pair.
[0118] The decoding device may offset the matching block horizontally and vertically based on one or more pairs of offset amounts, respectively, to obtain one or more new matching blocks.
[0119] As another possible embodiment, in step S410, after determining the matching block of the current block, the method may further include:
[0120] The determined matching block is clipped to the range of the current CTU.
[0121] Exemplarily, in order to improve the efficiency of determining motion information of each sub-block of the current block in subsequent processing, when a matching block is determined in step S410, a Clip operation is performed on the determined matching block, and the matching block is clipped to the range of the current CTU, thereby ensuring that each sub-block of the matching block is within the range of the current CTU.
[0122] As an example, a new match block obtained by offsetting a matching block can be determined as follows:
[0123] If the right boundary of the matching block after clipping is not located at the right boundary of the current CTU, compare the motion information of the 13th sub-block with the 14th sub-block, and compare the motion information of the 15th sub-block with the 16th sub-block; if at least one of the two comparison results is different motion information, offset the matching block after clipping by one unit horizontally to the right to obtain a new matching block;
[0124] If the left boundary of the matching block after clipping is not located at the left boundary of the current CTU, compare the motion information of the 17th sub-block with the 18th sub-block, and compare the motion information of the 19th sub-block with the 20th sub-block; if at least one of the two comparison results is different motion information, offset the matching block after clipping horizontally left by one unit to obtain a new matching block;
[0125] If the bottom boundary of the matching block after clipping is not located at the bottom boundary of the current CTU, compare the motion information of the 13th sub-block with the 21st sub-block, and compare the motion information of the 17th sub-block with the 22nd sub-block; if at least one of the two comparison results is different motion information, offset the matching block after clipping vertically downward by one unit to obtain a new matching block;
[0126] If the upper boundary of the matching block after clipping is not located at the upper boundary of the current CTU, compare the motion information of the 15th sub-block and the 23rd sub-block, and compare the motion information of the 19th sub-block and the 24th sub-block; if at least one of the two comparison results is different motion information, offset the matching block after clipping vertically upward by one unit to obtain a new matching block;
[0127] For example, the 13th sub-block is the sub-block in the upper left corner of the matching block after clipping, the 14th sub-block is the topmost adjacent sub-block immediately to the right of the matching block after clipping, the 15th sub-block is the sub-block in the lower left corner of the matching block after clipping, the 16th sub-block is the bottommost adjacent sub-block immediately to the right of the matching block after clipping, the 17th sub-block is the sub-block in the upper right corner of the matching block after clipping, the 18th sub-block is the topmost adjacent sub-block immediately to the left of the matching block after clipping, and the 19th sub-block is the sub-block in the upper right corner of the matching block after clipping. The subblock is the subblock in the bottom right corner of the matching block after clipping, the 20th subblock is the bottommost adjacent subblock immediately to the left of the matching block after clipping, the 21st subblock is the leftmost adjacent subblock immediately below the matching block after clipping, the 22nd subblock is the rightmost adjacent subblock immediately below the matching block after clipping, the 23rd subblock is the leftmost adjacent subblock immediately above the matching block after clipping, and the 24th subblock is the rightmost adjacent subblock immediately above the matching block after clipping.
[0128] Exemplarily, one unit is the length of a side of a sub-block, for example, if the sub-block has a size of 8*8, the length of the side of the sub-block is 8 pixels.
[0129] Still taking Figure 7 as an example, assuming that the matching blocks in Figure 7 are the matching blocks after Clip, the 13th sub-block is A1, the 14th sub-block is B2, the 15th sub-block is A3, the 16th sub-block is B4, the 17th sub-block is A2, the 18th sub-block is B1, the 19th sub-block is A4, the 20th sub-block is B3, the 21st sub-block is C3, the 22nd sub-block is C4, the 23rd sub-block is C1, and the 24th sub-block is C2.
[0130] In order to ensure that each sub-block in the matching block is within the range of the current CTU and to improve the efficiency of determining the motion information of each sub-block in the current block, when the matching block is determined in step S410, a clip operation may be performed on the matching block so that the matching block after clipping is within the range of the current CTU.
[0131] Considering that the coordinates of the vertices of the matching block are all aligned to integer multiples of the side length of the sub-block, that is, the coordinates of the vertices of the matching block are all integer multiples of the side length of the sub-block, the distances from the boundary of the matching block after clipping to each boundary position of the current CTU are all integer multiples of the side length of the sub-block.
[0132] In order to ensure that each sub-block in the matching block obtained by offsetting is within the range of the current CTU, when offsetting the matching block after clipping, it is necessary to ensure that the distance between the boundary of the matching block after clipping and the boundary of the corresponding current CTU in the offset direction is greater than 0, that is, it is necessary to ensure that the boundary of the matching block after clipping is not located at the boundary of the corresponding current CTU in the offset direction.
[0133] For example, if the right boundary of the matching block after the clip is not located at the right boundary of the current CTU, the decoding device may determine whether the matching block after the clip needs to be offset horizontally to the right based on a comparison result of the motion information of A1 and B2 and a comparison result of the motion information of A3 and B4. If at least one of the two comparison results in different motion information, the matching block after the clip may be offset horizontally to the right by one unit.
[0134] Similarly, if the left boundary of the matching block after Clip is not located at the left boundary of the current CTU, the decoding device may determine whether the matching block after Clip needs to be offset horizontally to the left based on the comparison result of the motion information of A2 and B1 and the comparison result of the motion information of A4 and B3. If at least one of the two comparison results in different motion information, the matching block after Clip may be offset horizontally to the left by one unit.
[0135] If the bottom boundary of the matching block after the clip is not located at the bottom boundary of the current CTU, the decoding device may determine whether the matching block after the clip needs to be offset vertically downward based on the comparison result of the motion information of A1 and C3 and the comparison result of the motion information of A2 and C4. If at least one of the two comparison results in different motion information, the matching block after the clip may be offset vertically downward by one unit.
[0136] If the upper boundary of the matching block after the clip is not located at the upper boundary of the current CTU, the decoding device may determine whether the matching block after the clip needs to be offset vertically upward based on a comparison result of the motion information of A3 and C1 and a comparison result of the motion information of A4 and C2. If at least one of the two comparison results in different motion information, the matching block after the clip may be offset vertically upward by one unit. As an example, in step S420, determining an enhanced temporal motion vector prediction mode candidate based on the matching block and the new matching block obtained by offsetting the matching block may include:
[0137] If there is at least one new matching block, a prediction mode corresponding to the matching block before the offset and a prediction mode corresponding to the new matching block obtained by the offset are determined as enhanced temporal motion vector prediction mode candidates.
[0138] As an example, if a clip operation is performed on a matching block before offsetting the matching block, the matching block before offset may be the matching block after clipping, and if a clip operation is not performed on the matching block before offsetting the matching block, the matching block before offset is the original matching block.
[0139] Illustratively, when the decoding device obtains at least one new matching block according to the method described in the above embodiment, it may determine the prediction mode corresponding to the matching block before the offset and the prediction mode corresponding to the new matching block obtained by the offset as enhanced temporal motion vector prediction mode candidates.
[0140] It should be noted that, when there are multiple new matching blocks, the decoding device may determine some or all of the prediction modes corresponding to the multiple new matching blocks as enhanced temporal motion vector prediction mode candidates.
[0141] If a new matching block cannot be obtained by the method described in the above embodiment, the decoding device may determine the prediction mode corresponding to the matching block before the offset as a candidate enhanced temporal motion vector prediction mode.
[0142] Illustratively, the second temporal mode candidate list includes at least one enhanced temporal motion vector prediction mode candidate, where each enhanced temporal motion vector prediction mode candidate corresponds to a different matching block.
[0143] In step S430, an enhanced temporal motion vector prediction mode is determined from the second temporal mode candidate list according to the index information of the enhanced temporal motion vector prediction mode.
[0144] In an embodiment of the present invention, currently, when the technical method provided by an embodiment of the present invention is adopted, considering that for the same image block, when the encoding device and the decoding device construct a temporal mode candidate list, the order of each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list is the same, therefore, the position of the enhanced temporal motion vector prediction mode in the temporal mode candidate list constructed by the encoding device and the position of the enhanced temporal motion vector prediction mode in the temporal mode candidate list constructed by the decoding device are the same.
[0145] Therefore, the decoding device can determine the enhanced temporal motion vector prediction mode from the second temporal mode candidate list constructed by the decoding device based on the index information of the enhanced temporal motion vector prediction mode analyzed from the bitstream of the current block.
[0146] In step S440, determine motion information of each sub-block in the current block according to an enhanced temporal motion vector prediction mode, and perform motion compensation for each sub-block in the current block according to the motion information of each sub-block in the current block.
[0147] In an embodiment of the present invention, when an enhanced temporal motion vector prediction mode is determined, motion information of each sub-block in the current block may be determined based on a matching block (which can be referred to as a target matching block in the present invention) corresponding to the enhanced temporal motion vector prediction mode, and motion compensation of the current block may be performed based on the motion information of each sub-block in the current block.
[0148] Illustratively, each enhanced temporal motion vector prediction mode candidate in the second temporal mode candidate list corresponds to a different matching block.
[0149] As one possible embodiment, in step S440, determining the motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode may include:
[0150] For any sub-block in the target matching block, clip the sub-block to the range of the current CTU;
[0151] If both forward motion information and backward motion information of the sub-block after the clip are available, scale the forward motion information and backward motion information of the sub-block after the clip to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block, respectively;
[0152] If the forward motion information of the sub-block after the clip is available but the backward motion information is not available, scale the forward motion information of the sub-block after the clip to point to the first frame of List0, and give the scaled forward motion information to the sub-block at the corresponding position of the current block;
[0153] If backward motion information of the sub-block after the clip is available but forward motion information is not available, the backward motion information of the sub-block after the clip is scaled to point to the first frame of List1, and the scaled backward motion information is given to the sub-block at the corresponding position of the current block.
[0154] For example, to improve the accuracy of the motion information of each sub-block of the determined current block, for any sub-block of the target matching block, the decoding device may clip the sub-block to the range of the current CTU and determine whether backward motion information and forward motion information of the sub-block after clipping are available.
[0155] When both forward motion information and backward motion information of the sub-block after the clip are available, the decoding device scales the forward motion information of the sub-block after the clip to point to the first frame of List0, scales the backward motion information of the sub-block after the clip to point to the first frame of List1, and provides the scaled forward motion information and backward motion information, respectively, to the sub-blocks at corresponding positions of the current block.
[0156] If forward motion information of the sub-block after the clip is available but backward motion information is not available, the forward motion information of the sub-block after the clip is scaled to point to the first frame of List0, and the scaled forward motion information is given to the sub-block at the corresponding position of the current block.
[0157] If backward motion information of the sub-block after the clip is available but forward motion information is not available, the backward motion information of the sub-block after the clip is scaled to point to the first frame of List1, and the scaled backward motion information is given to the sub-block at the corresponding position of the current block.
[0158] It should be noted that in this embodiment, if forward motion information of a sub-block after Clip is available but backward motion information is not available, the forward motion information of the sub-block after Clip may be scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled motion information may be provided to the sub-block corresponding to the current block (the scaled motion information pointing to the first frame of List0 is the forward motion information, and the scaled motion information pointing to the first frame of List1 is the backward motion information).
[0159] The same is true in the case where backward motion information of the sub-block after the clip is available, but forward motion information is not available.
[0160] For example, for any sub-block in the target matching block, when the sub-block is clipped into the range of the current CTU, if neither the forward motion information nor the backward motion information of the sub-block after clipping is available, the motion information of the sub-block at the corresponding position in the current block can be determined in at least the following manner:
[0161] If neither forward motion information nor backward motion information of the sub-block after the clip is available, when both forward motion information and backward motion information of the second peripheral block of the current block are available, the forward motion information and backward motion information of the second peripheral block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively; if forward motion information of the second peripheral block is available but backward motion information is not available, the forward motion information of the second peripheral block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block; if backward motion information of the second peripheral block is available but forward motion information is not available, the backward motion information of the second peripheral block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block; and if neither forward motion information nor backward motion information of the second peripheral block is available, zero motion information is provided to the sub-block at the corresponding position of the current block.
[0162] Illustratively, the first neighboring blocks of the current block may include any already decoded neighboring or non-neighboring blocks of the current block.
[0163] The second peripheral block may be the same as or different from the first peripheral block.
[0164] For example, when neither forward motion information nor backward motion information of a sub-block after Clip is available, the decoding device can determine whether forward motion information and backward motion information of a second peripheral block of the current block is available, and when both forward motion information and backward motion information of the second peripheral block are available, the decoding device can scale the forward motion information and backward motion information of the second peripheral block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block, respectively.
[0165] If forward motion information of the second surrounding block is available but backward motion information is not available, the forward motion information of the second surrounding block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0166] If backward motion information of the second surrounding block is available but forward motion information is not available, the backward motion information of the second surrounding block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0167] If neither the forward motion information nor the backward motion information of the second surrounding block is available, the decoding device may provide zero motion information to the correspondingly positioned sub-block of the current block.
[0168] It should be noted that in this embodiment, if forward motion information of the center position of the target matching block after Clip is available but backward motion information is not available, the forward motion information of the center position of the target matching block after Clip may be scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled motion information may be provided to the sub-block corresponding to the current block (the scaled motion information pointing to the first frame of List0 is the forward motion information, and the scaled motion information pointing to the first frame of List1 is the backward motion information).
[0169] The same applies when backward motion information of the center position of the target matching block after clip is available but forward motion information is not available, and when one of the forward motion information and backward motion information of the second surrounding block is available but the other is not available.
[0170] As one possible embodiment, in step S440, determining the motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode may include:
[0171] For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block, respectively;
[0172] If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and give the scaled forward motion information to the sub-block at the corresponding position of the current block;
[0173] If backward motion information for the sub-block is available but forward motion information is not available, the backward motion information for the sub-block is scaled to point to the first frame in List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0174] Illustratively, to improve the efficiency of determining motion information for each sub-block of the current block, for any sub-block of the target matching block, the decoding device may determine whether motion information for that sub-block is available.
[0175] If both forward motion information and backward motion information for the sub-block are available, the decoding device scales the forward motion information of the sub-block to point to the first frame of List0 and scales the backward motion information of the sub-block to point to the first frame of List1 by scaling the forward motion information and backward motion information of the sub-block, respectively, and provides the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block.
[0176] If forward motion information for the sub-block is available but backward motion information is not available, the forward motion information for the sub-block is scaled to point to the first frame in List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0177] If backward motion information for the sub-block is available but forward motion information is not available, the backward motion information for the sub-block is scaled to point to the first frame in List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0178] It should be noted that in this embodiment, if forward motion information of a sub-block is available but backward motion information is not available, the forward motion information of the sub-block may be scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled motion information may be provided to the sub-block corresponding to the current block (the scaled motion information pointing to the first frame of List0 is the forward motion information, and the scaled motion information pointing to the first frame of List1 is the backward motion information).
[0179] This is also the case when backward motion information of a sub-block is available, but forward motion information is not.
[0180] Exemplarily, for any sub-block in the target matching block, if neither the forward motion information nor the backward motion information of the sub-block is available, the motion information of the sub-block at the corresponding position in the current block can be determined in at least the following manner:
[0181] If neither the forward motion information nor the backward motion information of the sub-block is available, when both the forward motion information and the backward motion information of the second peripheral block of the current block are available, the forward motion information and the backward motion information of the second peripheral block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively; if the forward motion information of the second peripheral block is available but the backward motion information is not available, the forward motion information of the second peripheral block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block; if the backward motion information of the second peripheral block is available but the forward motion information is not available, the backward motion information of the second peripheral block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block; and if neither the forward motion information nor the backward motion information of the second peripheral block is available, zero motion information is provided to the sub-block at the corresponding position of the current block.
[0182] Exemplarily, if neither forward motion information nor backward motion information of the sub-block is available, the decoding device can determine whether forward motion information and backward motion information of a second peripheral block of the current block is available, and if both forward motion information and backward motion information of the second peripheral block are available, the decoding device scales the forward motion information and backward motion information of the second peripheral block to point to the first frame of List0 and the first frame of List1, respectively, and provides the scaled forward motion information and backward motion information to the sub-block at the corresponding position of the current block.
[0183] If forward motion information of the second surrounding block is available but backward motion information is not available, the forward motion information of the second surrounding block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0184] If backward motion information of the second surrounding block is available but forward motion information is not available, the backward motion information of the second surrounding block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0185] If neither the forward motion information nor the backward motion information of the second surrounding block is available, the decoding device may provide zero motion information to the correspondingly positioned sub-block of the current block.
[0186] In this embodiment, the second peripheral block of the current block may be the same as or different from the first peripheral block. With reference to FIG. 5, the second peripheral block may be, for example, the bottom-most neighbor block immediately to the left of the current block, i.e., block F.
[0187] As one possible embodiment, in step S400 or S401, parsing index information of the enhanced temporal motion vector prediction mode from the bitstream of the current block may include:
[0188] If it is determined that the enhanced temporal motion vector prediction technique is applied to the current block, the index information of the enhanced temporal motion vector prediction mode is analyzed from the bitstream of the current block.
[0189] For example, in order to enhance the controllability and flexibility of the technology provided by an embodiment of the present invention (referred to as Enhanced Temporal Motion Vector Prediction (ETMVP) technology in the present invention) and to achieve compatibility with conventional ATMVP technology, the operation of the enhanced temporal motion vector prediction technology can be controlled according to an actual scene.
[0190] When the decoding device receives a bitstream of a current block and determines that an enhanced temporal motion vector prediction technology is applied to the current block, the decoding device can analyze the index information of the enhanced temporal motion vector prediction mode from the bitstream of the current block, and perform subsequent processing in the manner described in the above embodiment.
[0191] If the decoding device determines that the enhanced temporal motion vector prediction technique is not in operation for the current block, the decoding device may perform processing according to the conventional ATMVP technique.
[0192] As an example, a Sequence Parameter Set (SPS) level syntax can be used to indicate whether enhanced temporal motion vector prediction techniques are in operation for the current block.
[0193] Exemplarily, in order to reduce bit consumption for controlling whether the enhanced temporal motion vector prediction technique is operating, the SPS level syntax can be used to control whether the enhanced temporal motion vector prediction technique is operating on the current block.
[0194] For an image sequence, an SPS-level flag bit can be set, which indicates whether the enhanced temporal motion vector prediction technique is activated for that image sequence.
[0195] For example, the SPS level flag bit may be a flag bit of length 1 bit, where a first value (e.g., 1) of the flag bit indicates that enhanced temporal motion vector prediction is enabled for the corresponding image sequence, and a second value (e.g., 0) of the flag bit indicates that enhanced temporal motion vector prediction is not enabled for the corresponding image sequence.
[0196] For any block, the decoding device can determine whether the enhanced temporal motion vector prediction technique is operating for the current block based on whether the enhanced temporal motion vector prediction technique is operating for the image sequence to which the block belongs.
[0197] For example, if the enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs, it is determined that the enhanced temporal motion vector prediction technique is applied to the current block.
[0198] If the enhanced temporal motion vector prediction technique is not applied to the image sequence to which the current block belongs, it is determined that the enhanced temporal motion vector prediction technique is not applied to the current block.
[0199] In an embodiment of the present invention, a bitstream of a current block is obtained, index information of an enhanced temporal motion vector prediction mode is analyzed from the bitstream of the current block, a matching block of the current block is determined, an enhanced temporal motion vector prediction mode candidate is determined based on the matching block and a new matching block obtained by offsetting the matching block, a second temporal mode candidate list is constructed based on the enhanced temporal motion vector prediction mode candidate, an enhanced temporal motion vector prediction mode is determined from the second temporal mode candidate list based on index information of the enhanced temporal motion vector prediction mode, motion information of each sub-block in the current block is determined based on the enhanced temporal motion vector prediction mode, and motion compensation of each sub-block in the current block is performed based on the motion information of each sub-block in the current block. By offsetting the matching block determined based on the neighboring blocks of the current block to obtain a new matching block, the probability that the motion information of the matching block is inaccurate due to the inaccurate motion information of the neighboring blocks is reduced, and the decoding performance is improved.
[0200] As an example, an embodiment of the present invention further provides an encoding method, where the encoding method can be applied to an encoding device, and the method may include the following steps:
[0201] Step A1: Determine the matching block of the current block.
[0202] The specific implementation thereof can be referred to in the embodiment of the decoding side method described above, and will not be described repeatedly in the embodiment of the present invention.
[0203] Step A2: Determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and construct a first temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate.
[0204] The specific implementation thereof may refer to step S420 in the embodiment of FIG. 4, and will not be described repeatedly in the embodiment of the present invention.
[0205] Step A3: Traverse each enhanced temporal motion vector prediction mode candidate in the first time mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determine motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and perform motion compensation of each sub-block in the current block based on the motion information of each sub-block in the current block.
[0206] Illustratively, when constructing the first temporal mode candidate list in the method described in step A2, the encoding device may traverse each enhanced temporal motion vector prediction mode candidate in the first temporal mode candidate list.
[0207] For any enhanced temporal motion vector prediction mode candidate, the encoding device can determine motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and perform motion compensation of each sub-block in the current block based on the motion information of each sub-block in the current block, the specific implementation of which can refer to step S440 in the embodiment of Figure 4, and will not be repeatedly described in the embodiment of the present invention.
[0208] Step A4: Based on the rate-distortion cost corresponding to each enhanced temporal motion vector prediction mode candidate, determine the enhanced temporal motion vector prediction mode candidate with the smallest rate-distortion cost as the enhanced temporal motion vector prediction mode of the current block.
[0209] For example, when the encoding device performs motion compensation for each sub-block in the current block based on each enhanced temporal motion vector prediction mode candidate according to the method described in step A3, the encoding device may determine a respective rate-distortion cost corresponding to each enhanced temporal motion vector prediction mode, and determine the enhanced temporal motion vector prediction mode candidate having the lowest rate-distortion cost as the enhanced temporal motion vector prediction mode of the current block.
[0210] Step A5: Add index information to the bitstream of the current block, where the index information is used to indicate a mode index of the determined enhanced temporal motion vector prediction mode.
[0211] For example, when determining the enhanced temporal motion vector prediction mode of the current block, the encoding device may add index information of the enhanced temporal motion vector prediction mode of the current block to the bitstream of the current block so that the decoding device can determine the enhanced temporal motion vector prediction mode of the current block based on the index information in the bitstream.
[0212] In an embodiment of the present invention, a matching block of a current block is determined, an enhanced temporal motion vector prediction mode candidate is determined based on the matching block and a new matching block obtained by offsetting the matching block, a first temporal mode candidate list is constructed based on the enhanced temporal motion vector prediction mode candidate, each enhanced temporal motion vector prediction mode candidate in the first temporal mode candidate list is traversed, for any enhanced temporal motion vector prediction mode candidate, motion information of each sub-block in the current block is determined based on the enhanced temporal motion vector prediction mode candidate, motion compensation is performed for each sub-block in the current block based on the motion information of each sub-block in the current block, and based on the rate-distortion costs corresponding to each enhanced temporal motion vector prediction mode candidate, the enhanced temporal motion vector prediction mode candidate with the smallest rate-distortion cost is determined as the enhanced temporal motion vector prediction mode of the current block, and index information of the enhanced temporal motion vector prediction mode of the current block is added to the bitstream of the current block. By offsetting the matching block determined based on the neighboring blocks of the current block to obtain a new matching block, the probability that the motion information of the matching block becomes inaccurate due to inaccurate motion information of the neighboring blocks is reduced, thereby improving coding performance.
[0213] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, the technical solutions provided by the embodiments of the present invention are described below with specific examples.
[0214] Example 1 The encoding method provided by the embodiment of the present invention may include the following steps. 1. Determine the first-stage motion information using the motion information of the neighboring blocks (for example, the first neighboring block) of the current block. 2. Determine the matching block of the current block using the motion information from the first stage. 3. Determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and construct a first temporal mode candidate list based on the determined enhanced temporal motion vector prediction mode candidate. 4. Sequentially traverse each enhanced temporal motion vector prediction mode candidate in the first temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, obtain the motion information of all sub-blocks in the current block based on the motion information of the matching block. 5. Perform motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block. 6. Determine a rate-distortion cost corresponding to the enhanced temporal motion vector prediction mode candidate, compare the rate-distortion cost value with the rate-distortion costs of other enhanced temporal motion vector prediction mode candidates, and select the enhanced temporal motion vector prediction mode candidate with the lowest rate-distortion cost value as the enhanced temporal motion vector prediction mode of the current block, and add index information of the enhanced temporal motion vector prediction mode to the bitstream and send it to the decoding device, where the index information is used to indicate a mode index of the determined enhanced temporal motion vector prediction mode.
[0215] Example 2 The decoding method provided by the embodiment of the present invention may include the following steps. 1. Obtain a bitstream of a current block, and analyze index information of an enhanced temporal motion vector prediction mode from the bitstream of the current block, where the index information is used to indicate a mode index of the determined enhanced temporal motion vector prediction mode. 2. Determine the first-stage motion information using the motion information of the neighboring blocks (eg, the first neighboring block) of the current block. 3. Determine the matching block of the current block using the motion information from the first stage. 4. Determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and construct a second temporal mode candidate list based on the determined enhanced temporal motion vector prediction mode candidate. 5. According to the index information obtained in step 1, obtain the corresponding enhanced temporal motion vector prediction mode in the second mode candidate list, and obtain the motion information of all sub-blocks in the current block according to the motion information of the target matching block corresponding to the enhanced temporal motion vector prediction mode. 6. Perform motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block.
[0216] The following describes specific implementation methods of some steps.
[0217] First, the motion information of the first stage is determined by using the motion information of the neighboring blocks of the current block.
[0218] For example, the schematic diagram of the spatially adjacent blocks of the current block is, for example, as shown in FIG. 5, where the peripheral block of the current block is block F.
[0219] Example 3 It is determined that the first-stage motion vector is 0, the reference frame index is the index of the first frame in List0, and the reference direction of the first-stage motion information is the List0 direction.
[0220] Example 4 It is determined that the first-stage motion vector is 0, the reference frame index is the index of the first frame in List1, and the reference direction of the first-stage motion information is the List1 direction.
[0221] Second, the matching block of the current block is determined using the motion information from the first stage.
[0222] Example 5 Assume that the horizontal motion vector of the first stage is MVx, the vertical motion vector is MVy, the coordinates of the upper left corner of the current block are (Xpos, Ypos), and the precision of the motion vector is Precision.
[0223] Illustratively, Precision may take on values including 4, 2, 1, ½, ¼, ⅛ or 1 / 16.
[0224] For Precision values of 1, 1 / 2, 1 / 4, 1 / 8 or 1 / 16, the coordinates of the upper left corner of the matching block corresponding to the current block are: Mx0=((Xpos+(MVx>>shift)+4)>>3)<<3 My0=((Ypos+(MVy>>shift)+4)>>3)<<3
[0225] Here, the shift value and Precision have a one-to-one correspondence, and when the Precision value is 1, 1 / 2, 1 / 4, 1 / 8, or 1 / 16, the shift value is 0, 1, 2, 3, or 4, respectively.
[0226] If Precision is 4 or 2, the coordinates of the upper left corner of the matching block corresponding to the current block are: Mx0=((Xpos+(MVx<<shift)+4)> >3)<<3 My0=((Ypos+(MVy<<shift)+4)> >3)<<3
[0227] Here, the shift value and Precision have a one-to-one correspondence, so when the Precision value is 4 and 2, the shift value is 2 and 1, respectively.
[0228] In this embodiment, the horizontal motion vector (MVx>>shift) and the vertical motion vector (MVy>>shift) of the first stage are adjusted by 2 N-1(N is the base-2 logarithm of the side length of the sub-block. In this embodiment, taking an 8*8 sub-block as an example, that is, 2 N-1 = 4) is used for adjustment, or the horizontal coordinate (Xpos + (MVx << shift)) and the vertical coordinate (Ypos + (MVy << shift)) of the upper left corner of the temporarily determined matching block are adjusted using the adjustment value 4 respectively.
[0229] When performing alignment adjustment for the reference positions (Xpos + (MVx >> shift)) and (Ypos + (MVy >> shift)), the adjustment value N (N is the base-2 logarithm of the side length of the sub-block. In this embodiment, taking an 8*8 sub-block as an example, that is, N = 3) is used.
[0230] Embodiment 6 Assume that the horizontal motion vector in the first stage is MVx, the vertical motion vector is MVy, the coordinates of the upper left corner of the current block are (Xpos, Ypos), and the accuracy of the motion vector is Precision.
[0231] Exemplarily, Precision may take values including 4, 2, 1, 1 / 2, 1 / 4, 1 / 8 or 1 / 16.
[0232] When the value of Precision is 1, 1 / 2, 1 / 4, 1 / 8 or 1 / 16, the coordinates of the upper left corner of the matching block corresponding to the current block are: Mx0 = ((Xpos + (MVx >> shift)) >> 3) << 3 My0 = ((Ypos + (MVy >> shift)) >> 3) << 3
[0233] Here, the value of shift and Precision correspond one-to-one. When the value of Precision is 1, 1 / 2, 1 / 4, 1 / 8, 1 / 16, the value of shift is 0, 1, 2, 3, 4 respectively.
[0234] When the value of Precision is 4 or 2, the coordinates of the upper left corner of the matching block corresponding to the current block are: Mx0=((Xpos+(MVx<<shift))> >3)<<3 My0=((Ypos+(MVy<<shift))> >3)<<3
[0235] Here, the shift value and Precision have a one-to-one correspondence, so when the Precision value is 4 and 2, the shift value is 2 and 1, respectively.
[0236] In this embodiment, the determined reference positions (Xpos+(MVx>>shift)) and (Ypos+(MVy>>shift)) are aligned using a constant of 3.
[0237] Third, determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and construct a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate (a first temporal mode candidate list for the encoding device, and a second temporal mode candidate list for the decoding device).
[0238] For illustrative purposes, take the matching block shown in FIG. 7 as an example and assume that the size of the sub-block is 8*8.
[0239] Example 7 A1 and B2 are clipped to the range of the current CTU, the motion information of A1 and B2 after clipping is obtained, the motion information of both is compared, and the comparison result is represented as r1 (r1 may be the same or different motion information, and the same applies below).
[0240] A3 and B4 are clipped to the range of the current CTU, the motion information of A3 and B4 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r2.
[0241] If at least one of r1 and r2 results in different motion information, the matching block is offset horizontally to the right by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0242] A2 and B1 are clipped to the range of the current CTU, the motion information of A2 and B1 after clipping is obtained, and the motion information of both is compared, and the comparison result is denoted as r3.
[0243] A4 and B3 are clipped into the range of the current CTU, the motion information of A4 and B3 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r4.
[0244] If at least one of r3 and r4 results in different motion information, the matching block is offset horizontally to the left by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0245] A1 and C3 are clipped to the range of the current CTU, the motion information of A1 and C3 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r5.
[0246] A2 and C4 are clipped to the range of the current CTU, the motion information of A2 and C4 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r6.
[0247] If at least one of r5 and r6 results in different motion information, the matching block is offset vertically downward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0248] A3 and C1 are clipped to the range of the current CTU, the motion information of A3 and C1 after clipping is obtained, and the motion information of both is compared, and the comparison result is denoted as r7.
[0249] A4 and C2 are clipped to the range of the current CTU, the motion information of A4 and C2 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r8.
[0250] If at least one of r7 and r8 results in different motion information, the matching block is offset vertically upward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0251] The prediction mode corresponding to the original matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0252] It should be noted that the order in which the prediction modes corresponding to the original matching blocks and the prediction modes corresponding to the new matching blocks are added to the temporal mode candidate list is not limited.
[0253] Also, when there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0254] If there is no new matching block, the prediction mode corresponding to the original matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0255] As an example, a schematic diagram of a determined matching block may be shown in FIG. 8A, a schematic diagram of a new matching block obtained by offsetting the matching block horizontally to the right by 8 pixels may be shown in FIG. 8B, a schematic diagram of a new matching block obtained by offsetting the matching block horizontally to the left by 8 pixels may be shown in FIG. 8C, a schematic diagram of a new matching block obtained by offsetting the matching block vertically upward by 8 pixels may be shown in FIG. 8D, and a schematic diagram of a new matching block obtained by offsetting the matching block vertically downward by 8 pixels may be shown in FIG. 8E.
[0256] Example 8 Clips the matching block to the range of the current CTU.
[0257] The matching block shown in FIG. 7 is assumed to be the matching block after clipping.
[0258] If the right boundary of the matching block after clipping is not located at the right boundary of the current CTU, obtain the motion information of A1 and B2, compare the motion information of both, and denote the comparison result as r9 (r9 may include the same or different motion information, and the same applies below).
[0259] The motion information of A3 and B4 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r10.
[0260] If at least one of r9 and r10 results in different motion information, the matching block after the clip is offset horizontally to the right by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0261] If the left boundary of the matching block after clipping is not located at the left boundary of the current CTU, the motion information of A2 and B1 is obtained, and the motion information of both is compared, and the comparison result is denoted as r11.
[0262] The motion information of A4 and B3 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r12.
[0263] If at least one of r11 and r12 has different motion information, the matching block after the clip is offset horizontally to the left by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0264] If the lower boundary of the matching block after clipping is not located at the lower boundary of the current CTU, the motion information of A1 and C3 is obtained and compared, and the comparison result is denoted as r13.
[0265] The motion information of A2 and C4 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r14.
[0266] If at least one of r13 and r14 results in different motion information, the matching block after the clip is offset vertically downward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0267] If the upper boundary of the matching block after clipping is not located at the upper boundary of the current CTU, the motion information of A3 and C1 is obtained, and the motion information of both is compared, and the comparison result is denoted as r15.
[0268] The motion information of A4 and C2 is obtained, and the motion information of both is compared, and the comparison result is denoted as r16.
[0269] If at least one of r15 and r16 results in different motion information, the matching block after the clip is offset vertically upward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0270] The prediction mode corresponding to the pre-offset matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0271] It should be noted that the order in which the prediction modes corresponding to the matching blocks before the offset and the prediction modes corresponding to the new matching blocks are added to the temporal mode candidate list is not limited.
[0272] Also, when there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0273] If there is no new matching block, the prediction mode corresponding to the matching block before the offset is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0274] Example 9 The original matching block is offset to obtain a new matching block.
[0275] Exemplarily, the offset is performed as follows: Mx1=Mx0+offset1 My1=My0+offset2
[0276] where Mx0 and My0 are the horizontal and vertical coordinates of the upper left corner of the original matching block, Mx1 and My1 are the horizontal and vertical coordinates of the upper left corner of the new matching block, and offset1 and offset2 are offsets, each of which can be any integer.
[0277] The prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0278] The prediction mode corresponding to the original matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0279] It should be noted that the order in which the prediction modes corresponding to the original matching blocks and the prediction modes corresponding to the new matching blocks are added to the temporal mode candidate list is not limited.
[0280] offset1 and offset2 can take multiple sets of values to obtain multiple new matching blocks, and the number of new matching blocks is not limited.
[0281] If there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0282] Example 10 A1 and B2 are clipped to the range of the current CTU, the motion information of A1 and B2 after clipping is obtained, the motion information of both is compared, and the comparison result is denoted as r1 (r1 may include the same or different motion information, and the same applies below).
[0283] A3 and B4 are clipped to the range of the current CTU, the motion information of A3 and B4 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r2.
[0284] If at least one of r1 and r2 results in different motion information, the matching block is offset horizontally to the right by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0285] A2 and B1 are clipped to the range of the current CTU, the motion information of A2 and B1 after clipping is obtained, and the motion information of both is compared, and the comparison result is denoted as r3.
[0286] A4 and B3 are clipped into the range of the current CTU, the motion information of A4 and B3 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r4.
[0287] If at least one of r3 and r4 results in different motion information, the matching block is offset horizontally to the left by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0288] A1 and C3 are clipped to the range of the current CTU, the motion information of A1 and C3 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r5.
[0289] A2 and C4 are clipped to the range of the current CTU, the motion information of A2 and C4 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r6.
[0290] If at least one of r5 and r6 results in different motion information, the matching block is offset vertically downward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0291] A3 and C1 are clipped to the range of the current CTU, the motion information of A3 and C1 after clipping is obtained, and the motion information of both is compared, and the comparison result is denoted as r7.
[0292] A4 and C2 are clipped to the range of the current CTU, the motion information of A4 and C2 after clipping is obtained, and the motion information of both is compared, and the comparison result is represented as r8.
[0293] If at least one of r7 and r8 results in different motion information, the matching block is offset vertically upward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0294] It should be noted that when there are multiple new matching blocks, the order in which the prediction modes corresponding to each new matching block are added to the temporal mode candidate list is not limited.
[0295] Also, when there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0296] If there is no new matching block, the prediction mode corresponding to the original matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0297] Example 11 Clips the matching block to the range of the current CTU.
[0298] The matching block shown in FIG. 7 is assumed to be the matching block after clipping.
[0299] If the right boundary of the matching block after clipping is not located at the right boundary of the current CTU, obtain the motion information of A1 and B2, compare the motion information of both, and denote the comparison result as r9 (r9 may include the same or different motion information, and the same applies below).
[0300] The motion information of A3 and B4 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r10.
[0301] If at least one of r9 and r10 results in different motion information, the matching block after the clip is offset horizontally to the right by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0302] If the left boundary of the matching block after clipping is not located at the left boundary of the current CTU, the motion information of A2 and B1 is obtained, and the motion information of both is compared, and the comparison result is denoted as r11.
[0303] The motion information of A4 and B3 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r12.
[0304] If at least one of r11 and r12 has different motion information, the matching block after the clip is offset horizontally to the left by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0305] If the lower boundary of the matching block after clipping is not located at the lower boundary of the current CTU, the motion information of A1 and C3 is obtained and compared, and the comparison result is denoted as r13.
[0306] The motion information of A2 and C4 is obtained, and the two pieces of motion information are compared, and the comparison result is denoted as r14.
[0307] If at least one of r13 and r14 results in different motion information, the matching block after the clip is offset vertically downward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0308] If the upper boundary of the matching block after clipping is not located at the upper boundary of the current CTU, the motion information of A3 and C1 is obtained, and the motion information of both is compared, and the comparison result is denoted as r15.
[0309] The motion information of A4 and C2 is obtained, and the motion information of both is compared, and the comparison result is denoted as r16.
[0310] If at least one of r15 and r16 results in different motion information, the matching block after the clip is offset vertically upward by 8 pixels to obtain a new matching block, and the prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0311] It should be noted that the order in which the prediction modes corresponding to the matching blocks before the offset and the prediction modes corresponding to the new matching blocks are added to the temporal mode candidate list is not limited.
[0312] Also, when there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0313] If there is no new matching block, the prediction mode corresponding to the matching block before the offset is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0314] Example 12 The original matching block is offset to obtain a new matching block.
[0315] Exemplarily, the offset is performed as follows: Mx1=Mx0+offset1 My1=My0+offset2
[0316] where Mx0 and My0 are the horizontal and vertical coordinates of the upper left corner of the original matching block, Mx1 and My1 are the horizontal and vertical coordinates of the upper left corner of the new matching block, and offset1 and offset2 are offsets, each of which can be any integer.
[0317] The prediction mode corresponding to the new matching block is added to the temporal mode candidate list as an enhanced temporal motion vector prediction mode candidate.
[0318] It should be noted that offset1 and offset2 can take multiple sets of values to obtain multiple new matching blocks, and there is no limit to the number of new matching blocks.
[0319] When there are multiple new matching blocks, the order in which prediction modes corresponding to the new matching blocks are added to the temporal mode candidate list is not limited.
[0320] If there are multiple new matching blocks, prediction modes corresponding to some of the new matching blocks may be added to the temporal mode candidate list as enhanced temporal motion vector prediction mode candidates.
[0321] 4. Obtain the motion information of all sub-blocks in the current block according to the motion information of the matching block, and perform motion compensation for each sub-block in the current block according to the motion information of each sub-block in the current block.
[0322] Exemplarily, for an encoding device, the matching blocks include matching blocks corresponding to any enhanced temporal motion vector prediction mode candidates in the temporal mode candidate list (referred to as target matching candidates in the present invention).
[0323] For a decoding device, the matching blocks include a matching block corresponding to an enhanced temporal motion vector prediction mode (ie, the target matching block).
[0324] Example 13 For any sub-block in the matching block, if both forward motion information and backward motion information of the sub-block are available, the forward motion information and backward motion information of the sub-block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively.
[0325] If forward motion information for the sub-block is available but backward motion information is not available, the forward motion information for the sub-block is scaled to point to the first frame in List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0326] If backward motion information for the sub-block is available but forward motion information is not available, the backward motion information for the sub-block is scaled to point to the first frame in List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0327] Based on the motion information of each sub-block in the current block, motion compensation is performed for each sub-block in the current block.
[0328] Example 14 For any sub-block in the matching block, if both forward motion information and backward motion information of the sub-block are available, the forward motion information and backward motion information of the sub-block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively.
[0329] If forward motion information for the sub-block is available but backward motion information is not available, the forward motion information for the sub-block is scaled to point to the first frame in List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0330] If backward motion information for the sub-block is available but forward motion information is not available, the backward motion information for the sub-block is scaled to point to the first frame in List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0331] If neither forward motion information nor backward motion information for the sub-block is available, when both forward motion information and backward motion information of the second peripheral block of the current block are available, the forward motion information and backward motion information of the second peripheral block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively.
[0332] If forward motion information of the second surrounding block is available but backward motion information is not available, the forward motion information of the second surrounding block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block.
[0333] If backward motion information of the second surrounding block is available but forward motion information is not available, the backward motion information of the second surrounding block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block.
[0334] If neither the forward motion information nor the backward motion information of the second surrounding block is available, zero motion information is provided for the sub-block at the corresponding position of the current block.
[0335] Based on the motion information of each sub-block in the current block, motion compensation is performed for each sub-block in the current block.
[0336] The control of whether the enhanced temporal motion vector prediction technique is activated is described below.
[0337] Example 15 SPS-level syntax can be added to control whether ETMVP is enabled or disabled.
[0338] For example, u(n), u(v) or ue(n), ue(v) can be used for encoding, where u(n) represents the reading of consecutive n bits and is an unsigned number after decoding, and ue(n) represents unsigned exponential Golomb entropy encoding. If the parameter in the parentheses of the descriptor is n, it indicates that the syntax element is fixed-length encoded, and if the parameter is v, it indicates that the syntax element is variable-length encoded. The selected encoding method is not limited.
[0339] As an example, u(1) is used for encoding, and the control of whether or not to activate ETMVP is realized by 1 bit.
[0340] The above is a description of the method provided by the present invention. The following is a description of the apparatus provided by the present invention.
[0341] Please refer to Figure 9, which is a structural schematic diagram of a decoding device provided in an embodiment of the present invention. The device may include: A decoding unit 910 for analyzing index information of an enhanced temporal motion vector prediction mode from the bitstream of the current block when it is determined that the enhanced temporal motion vector prediction technique is applied to the current block; a first determining unit 920 for determining a matching block of the current block; a construction unit 930 for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a second determining unit 940 for determining an enhanced temporal motion vector prediction mode from the temporal mode candidate list based on the index information; a prediction unit 950 for determining motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; Wherein, the prediction unit 950 further comprises: For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or If the backward motion information of the sub-block is available but the forward motion information is not available, the backward motion information of the sub-block is scaled to point to the first frame of List1, and the scaled backward motion information is used to provide the sub-block at the corresponding position of the current block; using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is in operation for a current block; When determining a matching block of the current block, the first determination 920 unit determines a matching block of the current block according to at least a target reference frame index, a target reference direction, and the position of the current block, where the target reference frame index is the index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is the index of the first frame in List1 and the target reference direction is the List1 direction.
[0342] In one possible embodiment, the construction unit 930 is used to offset the matching block horizontally and vertically based on one or more offset amount pairs, respectively, to obtain one or more new matching blocks.
[0343] In one possible embodiment, the construction unit 930 is used to Clip the matching blocks.
[0344] In one possible embodiment, the construction unit 930 comprises: comparing the motion information of the 13th sub-block with the 14th sub-block, and comparing the motion information of the 15th sub-block with the 16th sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clip by one unit in the horizontal direction to the right to obtain a new matching block; or comparing the motion information of the 17th sub-block with the 18th sub-block, and comparing the motion information of the 19th sub-block with the 20th sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clipping by one unit in the horizontal left direction to obtain a new matching block; or comparing the motion information of the 13th sub-block with the 21st sub-block, and comparing the motion information of the 17th sub-block with the 22nd sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clip vertically downward by one unit to obtain a new matching block; or The motion information of the 15th sub-block is compared with the 23rd sub-block, and the motion information of the 19th sub-block is compared with the 24th sub-block. If at least one of the two comparison results is different motion information, the matching block after the clip is offset vertically upward by one unit to obtain a new matching block; where the 13th subblock is the subblock in the upper left corner of the matching block after the clip, the 14th subblock is the topmost adjacent subblock immediately to the right of the matching block after the clip, the 15th subblock is the subblock in the lower left corner of the matching block after the clip, the 16th subblock is the bottommost adjacent subblock immediately to the right of the matching block after the clip, the 17th subblock is the subblock in the upper right corner of the matching block after the clip, the 18th subblock is the topmost adjacent subblock immediately to the left of the matching block after the clip, and the 19th subblock is the subblock in the lower left corner of the matching block after the clip. The 20th subblock is the subblock in the bottom right corner of the matching block after clipping, the 20th subblock is the bottommost adjacent subblock immediately to the left of the matching block after clipping, the 21st subblock is the leftmost adjacent subblock immediately below the matching block after clipping, the 22nd subblock is the rightmost adjacent subblock immediately below the matching block after clipping, the 23rd subblock is the leftmost adjacent subblock immediately above the matching block after clipping, and the 24th subblock is the rightmost adjacent subblock immediately above the matching block after clipping, and one unit is the size of a subblock.
[0345] In one possible embodiment, the construction unit 930 comprises:
[0346] If there is at least one new matching block, the prediction mode corresponding to the matching block before the offset and the prediction mode corresponding to the new matching block obtained by the offset are used to determine as enhanced temporal motion vector prediction mode candidates.
[0347] In one possible embodiment, the prediction unit 950 further comprises: When neither the forward motion information nor the backward motion information of the sub-block is available, when both the forward motion information and the backward motion information of the second peripheral block of the current block are available, the forward motion information and the backward motion information of the second peripheral block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively; when the forward motion information of the second peripheral block is available but the backward motion information is not available, the forward motion information of the second peripheral block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block; when the backward motion information of the second peripheral block is available but the forward motion information is not available, the backward motion information of the second peripheral block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block; and when neither the forward motion information nor the backward motion information of the second peripheral block is available, zero motion information is provided to the sub-block at the corresponding position of the current block.
[0348] In one possible embodiment, when the sequence parameter set level syntax is used to indicate whether the enhanced temporal motion vector prediction technique is applied to the current block, the decoding unit 910 may: determining that an enhanced temporal motion vector prediction technique is applied to the current block if an enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs; If the enhanced temporal motion vector prediction technique is not applied to the image sequence to which the current block belongs, it is determined that the enhanced temporal motion vector prediction technique is not applied to the current block.
[0349] In one possible embodiment, the decoding device may be a video decoder.
[0350] 10, which is a schematic diagram of a hardware structure of a decoding device shown in an embodiment of the present invention. The decoding device may include a processor 1001 and a machine-readable storage medium 1002 storing machine-executable instructions, and the processor 1001 and the machine-readable storage medium 1002 can communicate with each other via a system bus 1003. Furthermore, the processor 1001 can execute the above-mentioned decoding method by reading and executing the machine-executable instructions corresponding to the decoding control logic of the machine-readable storage medium 1002.
[0351] The machine-readable storage medium 1002 referred to in the present invention may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a random access memory (RAM), a volatile memory, a non-volatile memory, a flash memory, a storage drive (e.g., a hard disk drive), a solid-state drive, any type of storage disk (e.g., an optical disk, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0352] In some embodiments, a machine-readable storage medium is also provided having machine-executable instructions stored therein, which when executed by a processor perform the above-mentioned decoding method. For example, the machine-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0353] Please refer to Figure 11, which is a schematic diagram of the structure of an encoding device provided in an embodiment of the present invention. The device may include: a first determining unit 1110 for determining a matching block of the current block; a construction unit 1120 for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a prediction unit 1130 for traversing each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determining motion information of each sub-block in the current block according to the enhanced temporal motion vector prediction mode candidate, and performing motion compensation for each sub-block in the current block according to the motion information of each sub-block in the current block; a second determining unit 1140 for determining, according to the rate-distortion costs corresponding to each enhanced temporal motion vector prediction mode candidate, an enhanced temporal motion vector prediction mode candidate having a minimum rate-distortion cost as an enhanced temporal motion vector prediction mode of the current block; a coding unit 1150 for adding index information to a bitstream of the current block, the index information being used to indicate a mode index of the determined enhanced temporal motion vector prediction mode; The prediction unit 1130 further comprises: For any sub-block in the target matching block, if both forward motion information and backward motion information of the sub-block are available, scale the forward motion information and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward motion information and backward motion information, respectively, to the sub-block at the corresponding position of the current block; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or If the backward motion information of the sub-block is available but the forward motion information is not available, a prediction unit 1130 is used to scale the backward motion information of the sub-block to point to the first frame of List1, and provide the scaled backward motion information to the sub-block at the corresponding position of the current block; When determining a matching block of the current block, the first determination unit determines a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is the index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is the index of the first frame in List1 and the target reference direction is the List1 direction.
[0354] In one possible embodiment, the construction unit 1120 is used to Clip the matching blocks.
[0355] In one possible embodiment, the construction unit 1120 comprises: comparing the motion information of the 13th sub-block with the 14th sub-block, and comparing the motion information of the 15th sub-block with the 16th sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clip by one unit in the horizontal direction to the right to obtain a new matching block; or comparing the motion information of the 17th sub-block with the 18th sub-block, and comparing the motion information of the 19th sub-block with the 20th sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clipping by one unit in the horizontal left direction to obtain a new matching block; or comparing the motion information of the 13th sub-block with the 21st sub-block, and comparing the motion information of the 17th sub-block with the 22nd sub-block; if at least one of the two comparison results is different motion information, offsetting the matching block after the clip vertically downward by one unit to obtain a new matching block; or The motion information of the 15th sub-block is compared with the 23rd sub-block, and the motion information of the 19th sub-block is compared with the 24th sub-block. If at least one of the two comparison results is different motion information, the matching block after the clip is offset vertically upward by one unit to obtain a new matching block; where the 13th subblock is the subblock in the upper left corner of the matching block after the clip, the 14th subblock is the topmost adjacent subblock immediately to the right of the matching block after the clip, the 15th subblock is the subblock in the lower left corner of the matching block after the clip, the 16th subblock is the bottommost adjacent subblock immediately to the right of the matching block after the clip, the 17th subblock is the subblock in the upper right corner of the matching block after the clip, the 18th subblock is the topmost adjacent subblock immediately to the left of the matching block after the clip, and the 19th subblock is the subblock in the lower right corner of the matching block after the clip. the 20th subblock is the bottommost adjacent subblock immediately to the left of the matching block after clipping, the 21st subblock is the leftmost adjacent subblock immediately below the matching block after clipping, the 22nd subblock is the rightmost adjacent subblock immediately below the matching block after clipping, the 23rd subblock is the leftmost adjacent subblock immediately above the matching block after clipping, and the 24th subblock is the rightmost adjacent subblock immediately above the matching block after clipping, wherein one unit is the size of a subblock.
[0356] In one possible embodiment, the construction unit 1120 comprises:
[0357] If there is at least one new matching block, the prediction mode corresponding to the matching block before the offset and the prediction mode corresponding to the new matching block obtained by the offset are used to determine as enhanced temporal motion vector prediction mode candidates.
[0358] In one possible embodiment, the prediction unit 1130 comprises: When neither the forward motion information nor the backward motion information of the sub-block is available, when both the forward motion information and the backward motion information of the second peripheral block of the current block are available, the forward motion information and the backward motion information of the second peripheral block are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and backward motion information are provided to the sub-block at the corresponding position of the current block, respectively; when the forward motion information of the second peripheral block is available but the backward motion information is not available, the forward motion information of the second peripheral block is scaled to point to the first frame of List0, and the scaled forward motion information is provided to the sub-block at the corresponding position of the current block; when the backward motion information of the second peripheral block is available but the forward motion information is not available, the backward motion information of the second peripheral block is scaled to point to the first frame of List1, and the scaled backward motion information is provided to the sub-block at the corresponding position of the current block; and when neither the forward motion information nor the backward motion information of the second peripheral block is available, zero motion information is provided to the sub-block at the corresponding position of the current block.
[0359] In one possible embodiment, the construction unit 1120 is used to determine an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block when an enhanced temporal motion vector prediction technique is applied to the current block, and to construct a first temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate.
[0360] In one possible embodiment, a sequence parameter set level syntax is used to control whether enhanced temporal motion vector prediction techniques are applied to the current block.
[0361] In one possible embodiment, the encoding device may be a video encoder.
[0362] 12, which is a schematic diagram of a hardware structure of an encoding device shown in an exemplary embodiment of the present invention. The encoding device may include a processor 1201 and a machine-readable storage medium 1202 storing machine-executable instructions, and the processor 1201 and the machine-readable storage medium 1202 can communicate with each other via a system bus 1203. Furthermore, by reading and executing the machine-executable instructions corresponding to the encoding control logic in the machine-readable storage medium 1202, the processor 1201 can execute the above-mentioned encoding method.
[0363] The machine-readable storage medium 1202 referred to in the present invention may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium may be a RAM (Radom Access Memory), a volatile memory, a non-volatile memory, a flash memory, a storage drive (e.g., a hard disk drive), a solid-state drive, any type of storage disk (e.g., a CD-ROM, a DVD, etc.), or a similar storage medium, or a combination thereof.
[0364] In some embodiments, a machine-readable storage medium is also provided having machine-executable instructions stored therein, which when executed by a processor perform the coding methods described above. For example, the machine-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0365] In some embodiments, there is further provided a camera device comprising the encoding device of any of the above embodiments and the decoding device of any of the above embodiments.
[0366] It should be explained that in the present invention, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply an actual relationship or order between those entities or operations. Furthermore, the terms "comprise", "comprises" or their derivatives are intended to convey a non-exclusive inclusion such that a process, method, article or device that includes a set of elements not only includes such elements, but also includes other elements not expressly listed, or further includes the inherent elements of the process, method, article or device. Without further limitation, an element limited by "comprises a ..." does not exclude the presence of another identical element in the process, method, article or device that includes said element.
[0367] The above are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made without departing from the spirit and principle of the present invention shall be within the protection scope of the present invention. [Explanation of symbols]
[0368] 910 Decoding Unit 920 First Decision Unit 930 Building Units 940 2nd Decision Unit 950 prediction units 1001 Processor 1002 Machine-readable storage medium 1003 System Bus 1110 First Decision Unit 1120 Construction Unit 1130 Prediction Units 1140 Second Decision Unit 1150 coding units 1201 Processor 1202 Machine-readable storage medium 1203 System Bus
Claims
1. 1. A method of decoding, comprising: If it is determined that the enhanced temporal motion vector prediction technique is applied to the current block, analyzing index information of the enhanced temporal motion vector prediction mode from the bitstream of the current block; determining a matching block for the current block, determining a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of a first frame in List0, and the target reference direction is a List0 direction; or the target reference frame index is an index of a first frame in List1, and the target reference direction is a List1 direction; determining an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate; determining an enhanced temporal motion vector prediction mode from the temporal mode candidate list based on the index information; determining motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode; and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is in operation for a current block; If an enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs, the enhanced temporal motion vector prediction technique is determined to be applied to the current block; A decoding method comprising: determining that an enhanced temporal motion vector prediction technique is not applied to the current block if an enhanced temporal motion vector prediction technique is not applied to the image sequence to which the current block belongs.
2. The new matching block obtained by offsetting the matching block is 2. The method of claim 1, wherein the matching block is determined by offsetting the matching block horizontally and vertically based on one or more pairs of offset amounts to obtain one or more new matching blocks.
3. Determining motion information for each sub-block within the current block based on the determined enhanced temporal motion vector prediction mode includes: For any sub-block in the target matching block, if both forward and backward motion information of the sub-block are available, scale the forward and backward motion information of the sub-block to point to the first frame of List0 and the first frame of List1, respectively, and provide the scaled forward and backward motion information to the sub-block at the corresponding position of the current block, respectively; or If the forward motion information of the sub-block is available but the backward motion information is not available, scale the forward motion information of the sub-block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; or if the backward motion information of the sub-block is available but the forward motion information is not available, scaling the backward motion information of the sub-block to point to the first frame of List1, and providing the scaled backward motion information to the sub-block at the corresponding position of the current block; Determining motion information for each sub-block within the current block based on the determined enhanced temporal motion vector prediction mode further includes: When neither the forward motion information nor the backward motion information of the sub-block is available, when both the forward motion information and the backward motion information of the neighboring blocks of the current block are available, the forward motion information and the backward motion information of the neighboring blocks are scaled to point to the first frame of List0 and the first frame of List1, respectively, and the scaled forward motion information and the backward motion information are provided to the sub-blocks at the corresponding positions of the current block, respectively; If the forward motion information of the neighboring block is available but the backward motion information is not available, scale the forward motion information of the neighboring block to point to the first frame of List0, and provide the scaled forward motion information to the sub-block at the corresponding position of the current block; If the backward motion information of the neighboring block is available but the forward motion information is not available, scale the backward motion information of the neighboring block to point to the first frame of List1, and provide the scaled backward motion information to the sub-block at the corresponding position of the current block; 2. The method of claim 1, further comprising providing zero motion information to a subblock at a corresponding position of the current block if neither forward motion information nor backward motion information of the neighboring block is available.
4. determining an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, The method according to claim 2, characterized in that, when at least one new matching block exists, the method includes determining a prediction mode corresponding to the matching block before the offset and a prediction mode corresponding to the new matching block obtained by the offset as enhanced temporal motion vector prediction mode candidates.
5. An encoding method comprising: determining a matching block for the current block, determining a matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of a first frame in List0, and the target reference direction is a List0 direction; or the target reference frame index is an index of a first frame in List1, and the target reference direction is a List1 direction; determining an enhanced temporal motion vector prediction mode candidate based on the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list based on the enhanced temporal motion vector prediction mode candidate; traversing each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determining motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; determining an enhanced temporal motion vector prediction mode candidate having a minimum rate-distortion cost as an enhanced temporal motion vector prediction mode of the current block according to rate-distortion costs corresponding to each enhanced temporal motion vector prediction mode candidate; adding index information to a bitstream of the current block, the index information being used to indicate a mode index of the determined enhanced temporal motion vector prediction mode; using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is in operation for a current block; If an enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs, the enhanced temporal motion vector prediction technique is determined to be applied to the current block; 11. An encoding method comprising: determining that an enhanced temporal motion vector prediction technique is not applied to the current block if an enhanced temporal motion vector prediction technique is not applied to the image sequence to which the current block belongs.
6. 1. A decoding device, comprising: a decoding unit for analyzing index information of an enhanced temporal motion vector prediction mode from a bitstream of the current block when it is determined that an enhanced temporal motion vector prediction technique is applied to the current block; a first determining unit for determining a matching block of the current block; a construction unit for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a second determining unit for determining an enhanced temporal motion vector prediction mode from the temporal mode candidate list according to index information of the enhanced temporal motion vector prediction mode; a prediction unit for determining motion information of each sub-block in the current block based on the determined enhanced temporal motion vector prediction mode, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; Using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is applied to the current block, the decoding unit further comprises: If an enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs, the enhanced temporal motion vector prediction technique is determined to be applied to the current block; if the enhanced temporal motion vector prediction technique is not applied to the image sequence to which the current block belongs, determining that the enhanced temporal motion vector prediction technique is not applied to the current block; The first determination unit, when determining a matching block of the current block, determines the matching block of the current block according to at least a target reference frame index, a target reference direction, and the position of the current block, wherein the target reference frame index is an index of the first frame in List0 and the target reference direction is the List0 direction, or the target reference frame index is an index of the first frame in List1 and the target reference direction is the List1 direction.
7. 1. An encoding device, comprising: a first determination unit for determining a matching block of the current block; a construction unit for determining an enhanced temporal motion vector prediction mode candidate according to the matching block and a new matching block obtained by offsetting the matching block, and constructing a temporal mode candidate list according to the enhanced temporal motion vector prediction mode candidate; a prediction unit for traversing each enhanced temporal motion vector prediction mode candidate in the temporal mode candidate list, and for any enhanced temporal motion vector prediction mode candidate, determining motion information of each sub-block in the current block based on the enhanced temporal motion vector prediction mode candidate, and performing motion compensation for each sub-block in the current block based on the motion information of each sub-block in the current block; a second determining unit for determining, according to a rate-distortion cost corresponding to each enhanced temporal motion vector prediction mode candidate, an enhanced temporal motion vector prediction mode candidate having a minimum rate-distortion cost as an enhanced temporal motion vector prediction mode of the current block; a coding unit for adding index information to a bitstream of the current block, the index information being used to indicate a mode index of the determined enhanced temporal motion vector prediction mode; When determining the matching block of the current block, the first determination unit determines the matching block of the current block according to at least a target reference frame index, a target reference direction, and a position of the current block, where the target reference frame index is an index of a first frame in List0, and the target reference direction is a List0 direction; or the target reference frame index is an index of a first frame in List1, and the target reference direction is a List1 direction; Using a sequence parameter set level syntax to indicate whether an enhanced temporal motion vector prediction technique is applied to a current block, the encoding unit further comprises: If an enhanced temporal motion vector prediction technique is applied to the image sequence to which the current block belongs, the enhanced temporal motion vector prediction technique is determined to be applied to the current block; An encoding device characterized in that it is used to determine that enhanced temporal motion vector prediction technology is not applied to the current block when enhanced temporal motion vector prediction technology is not applied to the image sequence to which the current block belongs.
8. 1. A decoding device comprising: A decoding device comprising a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to perform the method according to any one of claims 1 to 4 by executing the machine-executable instructions.
9. 1. A coding device, comprising:
6. An encoding device comprising: a processor; and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being adapted to implement the method of claim 5 by executing the machine-executable instructions.
10. A machine-readable storage medium having stored therein machine-executable instructions executable by a processor, the processor implementing the method according to any one of claims 1 to 5 by executing the machine-executable instructions.
Citation Information
Patent Citations
Improved temporal motion vector prediction derivation
CN110662075A
Efficient Affine Merge Motion Vector Derivation
JP2021530154A
JPP7375223B
Encoding device, decoding device, encoding method, and decoding method
WO2018105580A1